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

[Xen-devel] [PATCH] hvm/vmx: WRITE_MSR() macro hygene



Use the standard "do { } while ( 0 )" semantics, and don't hide the break
statement, incase this macro wants to be used anywhere outside of a switch.

No functional change, but it is now clear that long_mode_do_msr_write()
doesn't have fallthough for the STAR, LSTAR and SYSCALL_MASK cases.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Jun Nakajima <jun.nakajima@xxxxxxxxx>
CC: Eddie Dong <eddie.dong@xxxxxxxxx>
CC: Kevin Tian <kevin.tian@xxxxxxxxx>
---
 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 f2554d6..522892f 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -152,12 +152,12 @@ void vmx_save_host_msrs(void)
         rdmsrl(msr_index[i], host_msr_state->msrs[i]);
 }
 
-#define WRITE_MSR(address)                                              \
+#define WRITE_MSR(address) do {                                         \
         guest_msr_state->msrs[VMX_INDEX_MSR_ ## address] = msr_content; \
         set_bit(VMX_INDEX_MSR_ ## address, &guest_msr_state->flags);    \
         wrmsrl(MSR_ ## address, msr_content);                           \
         set_bit(VMX_INDEX_MSR_ ## address, &host_msr_state->flags);     \
-        break
+    } while ( 0 )
 
 static enum handler_return
 long_mode_do_msr_read(unsigned int msr, uint64_t *msr_content)
@@ -232,11 +232,13 @@ long_mode_do_msr_write(unsigned int msr, uint64_t 
msr_content)
 
     case MSR_STAR:
         WRITE_MSR(STAR);
+        break;
 
     case MSR_LSTAR:
         if ( !is_canonical_address(msr_content) )
             goto uncanonical_address;
         WRITE_MSR(LSTAR);
+        break;
 
     case MSR_CSTAR:
         if ( !is_canonical_address(msr_content) )
@@ -246,6 +248,7 @@ long_mode_do_msr_write(unsigned int msr, uint64_t 
msr_content)
 
     case MSR_SYSCALL_MASK:
         WRITE_MSR(SYSCALL_MASK);
+        break;
 
     default:
         return HNDL_unhandled;
-- 
1.7.10.4


_______________________________________________
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®.