return kvm_vcpu_get_hsr(vcpu) & HSR_IL;
}
+static inline u8 kvm_vcpu_trap_get_class(struct kvm_vcpu *vcpu)
+{
+ return kvm_vcpu_get_hsr(vcpu) >> HSR_EC_SHIFT;
+}
+
#endif /* __ARM_KVM_EMULATE_H__ */
* catch undefined instructions, and then we won't get past
* the arm_exit_handlers test anyway.
*/
- BUG_ON(((kvm_vcpu_get_hsr(vcpu) & HSR_EC) >> HSR_EC_SHIFT) == 0);
+ BUG_ON(!kvm_vcpu_trap_get_class(vcpu));
/* Top two bits non-zero? Unconditional. */
if (kvm_vcpu_get_hsr(vcpu) >> 30)
case ARM_EXCEPTION_DATA_ABORT:
case ARM_EXCEPTION_PREF_ABORT:
case ARM_EXCEPTION_HVC:
- hsr_ec = (kvm_vcpu_get_hsr(vcpu) & HSR_EC) >> HSR_EC_SHIFT;
+ hsr_ec = kvm_vcpu_trap_get_class(vcpu);
if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers)
|| !arm_exit_handlers[hsr_ec]) {
gfn_t gfn;
int ret, idx;
- hsr_ec = kvm_vcpu_get_hsr(vcpu) >> HSR_EC_SHIFT;
+ hsr_ec = kvm_vcpu_trap_get_class(vcpu);
is_iabt = (hsr_ec == HSR_EC_IABT);
fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);