ARM: KVM: neaten offset calculations.
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.
Signed-off-by Rusty Russell <[email protected]>
--- 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
@@ -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