[PATCH] hwf-x86: add EDX as output register for xgetbv asm block

Jussi Kivilinna jussi.kivilinna at iki.fi
Tue May 5 18:49:49 CEST 2015


* src/hwf-x86.c (get_xgetbv): Add EDX as output.
--

XGETBV instruction modifies EAX:EDX register pair, so we need to mark
EDX as output to let compiler know that contents in this register are
lost.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 src/hwf-x86.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/hwf-x86.c b/src/hwf-x86.c
index 7ee246d..baef2df 100644
--- a/src/hwf-x86.c
+++ b/src/hwf-x86.c
@@ -100,11 +100,11 @@ get_cpuid(unsigned int in, unsigned int *eax, unsigned int *ebx,
 static unsigned int
 get_xgetbv(void)
 {
-  unsigned int t_eax;
+  unsigned int t_eax, t_edx;
 
   asm volatile
     ("xgetbv\n\t"
-     : "=a" (t_eax)
+     : "=a" (t_eax), "=d" (t_edx)
      : "c" (0)
     );
 
@@ -151,11 +151,11 @@ get_cpuid(unsigned int in, unsigned int *eax, unsigned int *ebx,
 static unsigned int
 get_xgetbv(void)
 {
-  unsigned int t_eax;
+  unsigned int t_eax, t_edx;
 
   asm volatile
     ("xgetbv\n\t"
-     : "=a" (t_eax)
+     : "=a" (t_eax), "=d" (t_edx)
      : "c" (0)
     );
 




More information about the Gcrypt-devel mailing list