Skip to contentSkip to conversation

ARM: KVM: neaten offset calculations.

PATCH In review Rusty Russell 1 participant 1 message Mar 9, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 2/8 ARM: KVM: neaten offset calculations.

From: Rusty Russell <[email protected]>

If we do this the C-correct way, we use fewer casts and it's a bit clearer.

---
 arch/arm/include/asm/kvm_host.h |    6 +++-
 arch/arm/kvm/emulate.c          |   60 ++++++++++++++++++++-------------------
 2 files changed, 36 insertions(+), 30 deletions(-)
arch/arm/include/asm/kvm_host.h +5 -1
index 8002903..e211d8e 100644
@@ -86,7 +86,11 @@ enum cp15_regs {
 };
 
 struct kvm_vcpu_arch {
-	struct kvm_vcpu_regs regs;
+	/* We sometimes access these as an array for simplicity. */
+	union {
+		struct kvm_vcpu_regs regs;
+		u32 reg_array[sizeof(struct kvm_vcpu_regs) / sizeof(u32)];
+	};
 
 	/* System control coprocessor (cp15) */
 	u32 cp15[nr_cp15_regs];
arch/arm/kvm/emulate.c +31 -29

114 lines not on this page · raw message