Subject: [PATCH v3 24/32] arm64: KVM: 32bit GP register access

From: [email-masked] (Marc Zyngier)
Date: Wed, 24 Apr 2013 14:06:41 +0100

On 24/04/13 00:00, Christoffer Dall wrote:
> On Mon, Apr 08, 2013 at 05:17:26PM +0100, Marc Zyngier wrote:
>> Allow access to the 32bit register file through the usual API.
>>
>> Reviewed-by: Christopher Covington <[email-masked]>
>> Signed-off-by: Marc Zyngier <[email-masked]>
>> ---
>>  arch/arm64/include/asm/kvm_emulate.h |  17 +++-
>>  arch/arm64/kvm/Makefile              |   2 +-
>>  arch/arm64/kvm/regmap.c              | 168 +++++++++++++++++++++++++++++++++++
>>  3 files changed, 184 insertions(+), 3 deletions(-)
>>  create mode 100644 arch/arm64/kvm/regmap.c
>>
>> diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
>> index 2dcfa74..37a6567 100644
>> --- a/arch/arm64/include/asm/kvm_emulate.h
>> +++ b/arch/arm64/include/asm/kvm_emulate.h
>> @@ -28,6 +28,9 @@
>>  #include <asm/kvm_mmio.h>
>>  #include <asm/ptrace.h>
>>  
>> +unsigned long *vcpu_reg32(const struct kvm_vcpu *vcpu, u8 reg_num);
>> +unsigned long *vcpu_spsr32(const struct kvm_vcpu *vcpu);
>> +
>>  void kvm_inject_undefined(struct kvm_vcpu *vcpu);
>>  void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
>>  void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
>> @@ -49,7 +52,7 @@ static inline unsigned long *vcpu_cpsr(const struct kvm_vcpu *vcpu)
>>  
>>  static inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu)
>>  {
>> -	return false;	/* 32bit? Bahhh... */
>> +	return !!(*vcpu_cpsr(vcpu) & PSR_MODE32_BIT);
> 
> nit: you don't need the '!!': it's a bool

No it is not. It is a bitwise and, turned into a bool.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...