[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH V3] Use #defines instead of magic constants in vmx.c


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
  • Date: Fri, 8 Aug 2014 18:16:29 +0300
  • Cc: kevin.tian@xxxxxxxxx, keir@xxxxxxx, jbeulich@xxxxxxxx, Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>, eddie.dong@xxxxxxxxx, jun.nakajima@xxxxxxxxx
  • Comment: DomainKeys? See http://domainkeys.sourceforge.net/
  • Delivery-date: Fri, 08 Aug 2014 15:16:52 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=otrNVOy6DDK4VkuuhgcQwMU9mJ8vFgqwHvGfeef55Kao+hLZjv6TfaY8AwSI8k9Rzm+EGc9oH2+bQ69UFV/fvJO9DtLfNaj59iGkYrYzTU+lo4X7xVaeF4jNqKReqENekTk69X7Gx1fXbIwZhRT83CTZOZxabN7Nn4LC2+6NNg0ba7R9AfykHMJKFBG5l7OkmYe46+R4jj3UrMwOMpTyVLOswcPtEjGjhYYkNeyYNYxPvcI/oyK/cWNlRGaQtz6GAGn/VnznehAlb/4sU2bvTC3OBt+YrFaif0/3SrAZlH2Blr+LT5wS38gPrQU4PKMd2UxWvDFM9mU+28BO7cdsUw==; h=Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:X-BitDefender-Scanner:X-BitDefender-Spam:X-BitDefender-SpamStamp:X-BitDefender-CF-Stamp;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

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.

Changes since V1:
 - Fixed indentation.

Changes since V2:
 - Fixed vmx_idtv_reinject() also.

Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmx.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2caa04a..700f0e3 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -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);
@@ -2513,7 +2514,9 @@ static void vmx_idtv_reinject(unsigned long idtv_info)
     /* Event delivery caused this intercept? Queue for redelivery. */
     if ( unlikely(idtv_info & INTR_INFO_VALID_MASK) )
     {
-        if ( hvm_event_needs_reinjection((idtv_info>>8)&7, idtv_info&0xff) )
+        if ( hvm_event_needs_reinjection(MASK_EXTR(idtv_info,
+                                                   INTR_INFO_INTR_TYPE_MASK),
+                                         idtv_info & INTR_INFO_VECTOR_MASK) )
         {
             /* See SDM 3B 25.7.1.1 and .2 for info about masking resvd bits. */
             __vmwrite(VM_ENTRY_INTR_INFO,
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.