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

[Xen-changelog] [xen master] x86: fix rdrand asm()



commit 573fd5bd2d8bd068a6cea7ae5fcc58b962d43a78
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Sep 26 10:11:00 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Sep 26 10:11:00 2013 +0200

    x86: fix rdrand asm()
    
    Just learned the hard way that at least for non-volatile asm()s gcc
    indeed does what the documentation says: It may move it across jumps
    (i.e. ahead of the cpu_has() check). While the documentation claims
    that this can also happen for volatile asm()s, if that was the case
    we'd have many more problems in our code (and e,g, Linux would too).
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
---
 xen/include/asm-x86/random.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xen/include/asm-x86/random.h b/xen/include/asm-x86/random.h
index 6198e72..9e1fe0b 100644
--- a/xen/include/asm-x86/random.h
+++ b/xen/include/asm-x86/random.h
@@ -8,7 +8,7 @@ static inline unsigned int arch_get_random(void)
     unsigned int val = 0;
 
     if ( cpu_has(&current_cpu_data, X86_FEATURE_RDRAND) )
-        asm ( ".byte 0x0f,0xc7,0xf0" : "+a" (val) );
+        asm volatile ( ".byte 0x0f,0xc7,0xf0" : "+a" (val) );
 
     return val;
 }
--
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®.