xen: Use #defines instead of magic constants in vmx_vmcs_save()
PATCH 1/1 xen: Use #defines instead of magic constants in vmx_vmcs_save()
Now using a combination of INTR_INFO_VECTOR_MASK, INTR_INFO_INTR_TYPE_MASK and MASK_EXTR() to replace the old "(ev >> 8) & 7, ev & 0xff" magic constant code in vmx.c.
--- xen/arch/x86/hvm/vmx/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/vmx/vmx.c +2 -1
@@ -434,7 +434,8 @@ static void vmx_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c) c->error_code =0 ;__vmread (VM_ENTRY_INTR_INFO , &ev);if ( (ev &INTR_INFO_VALID_MASK ) && -hvm_event_needs_reinjection ((ev >>8 ) &7 , ev &0xff ) ) +hvm_event_needs_reinjection (MASK_EXTR (ev,INTR_INFO_INTR_TYPE_MASK ), + ev &INTR_INFO_VECTOR_MASK ) ) { c->pending_event = ev;__vmread (VM_ENTRY_EXCEPTION_ERROR_CODE , &ev);
Signature · 1 line
1.7.9.5
xen/arch/x86/hvm/vmx/vmx.c static void vmx_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c) · line 438
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 05.08.14 at 11:57, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +2
-1@@ -434,7 +434,8 @@ static void vmx_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c) c->error_code =0 ;__vmread (VM_ENTRY_INTR_INFO , &ev);if ( (ev &INTR_INFO_VALID_MASK ) && -hvm_event_needs_reinjection ((ev >>8 ) &7 , ev &0xff ) ) +hvm_event_needs_reinjection (MASK_EXTR (ev,INTR_INFO_INTR_TYPE_MASK ), + ev &INTR_INFO_VECTOR_MASK ) )
Broken indentation, but I guess I can fix this up while committing unless the VMX maintainers dislike the change and don't give their ack.
Jan
Quoted 14 lines · Jan Beulich
xen/arch/x86/hvm/vmx/vmx.c static void vmx_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c) · line 438
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 05.08.14 at 11:57, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +2
-1@@ -434,7 +434,8 @@ static void vmx_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c) c->error_code =0 ;__vmread (VM_ENTRY_INTR_INFO , &ev);if ( (ev &INTR_INFO_VALID_MASK ) && -hvm_event_needs_reinjection ((ev >>8 ) &7 , ev &0xff ) ) +hvm_event_needs_reinjection (MASK_EXTR (ev,INTR_INFO_INTR_TYPE_MASK ), + ev &INTR_INFO_VECTOR_MASK ) )Broken indentation, but I guess I can fix this up while committing unless the VMX maintainers dislike the change and don't give their ack.
No worries, I've sent V2:
http://lists.xen.org/archives/html/xen-devel/2014-08/msg00471.html
Hope it's right this time.
Thanks,
Razvan Cojocaru