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

[Xen-changelog] [xen master] hvm/vmx: WRITE_MSR() macro hygene



commit 463a991e51835ced8d440d37959d5bfc1f79417b
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Jan 9 17:27:04 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jan 9 17:27:04 2015 +0100

    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>
    Reviewed-by: Tim Deegan <tim@xxxxxxx>
    Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmx.c |    7 +++++--
 1 files 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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