[prev in list] [next in list] [prev in thread] [next in thread]
List: xen-cvs
Subject: [Xen-changelog] [xen master] x86: fix instruction emulator test's xgetbv constraints
From: patchbot () xen ! org
Date: 2014-04-18 8:46:09
Message-ID: E1Wb4Qz-0003Sy-I4 () xenbits ! xen ! org
[Download RAW message or body]
commit 09c856316d67045d170679b6980f34348e4c402f
Author: Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Apr 16 18:18:35 2014 +0200
Commit: Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Apr 16 18:18:35 2014 +0200
x86: fix instruction emulator test's xgetbv constraints
The "A" constraint, while documented up to gcc 4.5 as "The a and d
registers, as a pair (for instructions that return half the result in
one and half in the other)," never really behaved that (natural) way,
but always meant (and is now also documented so) %eax _or_ %edx (%rax
_or_ %rdx on x86-64) unless the operand was wide enough to require both
(i.e. more than 32 bits on ix86 and more than 64 bits on x86-64).
Interestingly something internal to the compiler changed between 4.4
and 4.5 to actually expose the difference - up to gcc 4.4 I was unable
to construct a case where, when only the low half of the result is
actually looked at, the result would be considered to be in %edx/%rdx
(and %eax/%rax would be treated as unmodified by the instruction).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Tested-by: Don Slutz <dslutz@verizon.com>
---
tools/tests/x86_emulator/test_x86_emulator.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 17b674b..0a00d5a 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -102,11 +102,11 @@ static int cpuid(
static inline uint64_t xgetbv(uint32_t xcr)
{
- uint64_t res;
+ uint32_t lo, hi;
- asm ( ".byte 0x0f, 0x01, 0xd0" : "=A" (res) : "c" (xcr) );
+ asm ( ".byte 0x0f, 0x01, 0xd0" : "=a" (lo), "=d" (hi) : "c" (xcr) );
- return res;
+ return ((uint64_t)hi << 32) | lo;
}
#define cpu_has_avx ({ \
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic