* [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop
@ 2010-07-01 12:04 Vic3Dexe
2010-07-01 16:17 ` Richard Henderson
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Vic3Dexe @ 2010-07-01 12:04 UTC (permalink / raw)
To: qemu-devel
Public bug reported:
xchg r8,rax (49h 90h) executed as nop (90h) in long mode, in other words
REX not used.
qemu 0.12.4, host Win 7 x64, running qemu-system-x86_64.exe.
** Affects: qemu
Importance: Undecided
Status: New
--
xchg r8,rax treated as nop
https://bugs.launchpad.net/bugs/600589
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
Status in QEMU: New
Bug description:
xchg r8,rax (49h 90h) executed as nop (90h) in long mode, in other words REX not used.
qemu 0.12.4, host Win 7 x64, running qemu-system-x86_64.exe.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop
2010-07-01 12:04 [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop Vic3Dexe
@ 2010-07-01 16:17 ` Richard Henderson
2010-07-01 16:42 ` [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8 Richard Henderson
2010-07-01 16:43 ` [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop malc
2010-07-06 13:00 ` [Qemu-devel] [Bug 600589] " Jes Sorensen
2011-02-20 17:13 ` Aurelien Jarno
2 siblings, 2 replies; 9+ messages in thread
From: Richard Henderson @ 2010-07-01 16:17 UTC (permalink / raw)
To: Bug 600589; +Cc: Vic3Dexe, qemu-devel
On 07/01/2010 05:04 AM, Vic3Dexe wrote:
> Public bug reported:
>
> xchg r8,rax (49h 90h) executed as nop (90h) in long mode, in other words
> REX not used.
>
> qemu 0.12.4, host Win 7 x64, running qemu-system-x86_64.exe.
>
> ** Affects: qemu
> Importance: Undecided
> Status: New
>
Verified. Test case for x86_64-linux-user:
.globl main
.type main, @function
main:
movl $0, %r8d
movl $1, %eax
xchgq %r8, %rax
ret
Expected result is exit status 0.
r~
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8
2010-07-01 16:17 ` Richard Henderson
@ 2010-07-01 16:42 ` Richard Henderson
2010-07-01 21:52 ` Aurelien Jarno
2010-07-01 16:43 ` [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop malc
1 sibling, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2010-07-01 16:42 UTC (permalink / raw)
To: qemu-devel; +Cc: aurelien, 600589
We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
target-i386/translate.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 708b0a1..8cb5cf0 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -5293,6 +5293,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
break;
case 0x91 ... 0x97: /* xchg R, EAX */
+ do_xchg_reg_eax:
ot = dflag + OT_WORD;
reg = (b & 7) | REX_B(s);
rm = R_EAX;
@@ -6663,10 +6664,14 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
/************************/
/* misc */
case 0x90: /* nop */
- /* XXX: xchg + rex handling */
/* XXX: correct lock test for all insn */
- if (prefixes & PREFIX_LOCK)
+ if (prefixes & PREFIX_LOCK) {
goto illegal_op;
+ }
+ /* If REX_B is set, then this is xchg eax, r8d, not a nop. */
+ if (REX_B(s)) {
+ goto do_xchg_reg_eax;
+ }
if (prefixes & PREFIX_REPZ) {
gen_svm_check_intercept(s, pc_start, SVM_EXIT_PAUSE);
}
--
1.7.0.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop
2010-07-01 16:17 ` Richard Henderson
2010-07-01 16:42 ` [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8 Richard Henderson
@ 2010-07-01 16:43 ` malc
2010-07-02 19:13 ` vic3dexe
1 sibling, 1 reply; 9+ messages in thread
From: malc @ 2010-07-01 16:43 UTC (permalink / raw)
To: Richard Henderson; +Cc: Vic3Dexe, qemu-devel, Bug 600589
On Thu, 1 Jul 2010, Richard Henderson wrote:
> On 07/01/2010 05:04 AM, Vic3Dexe wrote:
> > Public bug reported:
> >
> > xchg r8,rax (49h 90h) executed as nop (90h) in long mode, in other words
> > REX not used.
> >
> > qemu 0.12.4, host Win 7 x64, running qemu-system-x86_64.exe.
> >
> > ** Affects: qemu
> > Importance: Undecided
> > Status: New
> >
>
> Verified. Test case for x86_64-linux-user:
>
> .globl main
> .type main, @function
> main:
> movl $0, %r8d
> movl $1, %eax
> xchgq %r8, %rax
> ret
>
> Expected result is exit status 0.
>
No surprise really:
target-i386/translate.c lines 6665-...
case 0x90: /* nop */
/* XXX: xchg + rex handling */
/* XXX: correct lock test for all insn */
The code to handle that just isn't there.
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8
2010-07-01 16:42 ` [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8 Richard Henderson
@ 2010-07-01 21:52 ` Aurelien Jarno
0 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2010-07-01 21:52 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel, 600589
On Thu, Jul 01, 2010 at 09:42:21AM -0700, Richard Henderson wrote:
> We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> target-i386/translate.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
Applied, thanks.
> diff --git a/target-i386/translate.c b/target-i386/translate.c
> index 708b0a1..8cb5cf0 100644
> --- a/target-i386/translate.c
> +++ b/target-i386/translate.c
> @@ -5293,6 +5293,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> break;
>
> case 0x91 ... 0x97: /* xchg R, EAX */
> + do_xchg_reg_eax:
> ot = dflag + OT_WORD;
> reg = (b & 7) | REX_B(s);
> rm = R_EAX;
> @@ -6663,10 +6664,14 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
> /************************/
> /* misc */
> case 0x90: /* nop */
> - /* XXX: xchg + rex handling */
> /* XXX: correct lock test for all insn */
> - if (prefixes & PREFIX_LOCK)
> + if (prefixes & PREFIX_LOCK) {
> goto illegal_op;
> + }
> + /* If REX_B is set, then this is xchg eax, r8d, not a nop. */
> + if (REX_B(s)) {
> + goto do_xchg_reg_eax;
> + }
> if (prefixes & PREFIX_REPZ) {
> gen_svm_check_intercept(s, pc_start, SVM_EXIT_PAUSE);
> }
> --
> 1.7.0.1
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop
2010-07-01 16:43 ` [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop malc
@ 2010-07-02 19:13 ` vic3dexe
2010-07-02 20:08 ` Richard Henderson
0 siblings, 1 reply; 9+ messages in thread
From: vic3dexe @ 2010-07-02 19:13 UTC (permalink / raw)
To: malc; +Cc: Bug 600589, qemu-devel, Richard Henderson
You wrote 1 июля 2010 г., 19:43:06:
> On Thu, 1 Jul 2010, Richard Henderson wrote:
>> On 07/01/2010 05:04 AM, Vic3Dexe wrote:
>> > Public bug reported:
>> >
>> > xchg r8,rax (49h 90h) executed as nop (90h) in long mode, in other words
>> > REX not used.
>> >
>> > qemu 0.12.4, host Win 7 x64, running qemu-system-x86_64.exe.
>> >
>> > ** Affects: qemu
>> > Importance: Undecided
>> > Status: New
>> >
>>
>> Verified. Test case for x86_64-linux-user:
>>
>> .globl main
>> .type main, @function
>> main:
>> movl $0, %r8d
>> movl $1, %eax
>> xchgq %r8, %rax
>> ret
>>
>> Expected result is exit status 0.
>>
> No surprise really:
> target-i386/translate.c lines 6665-...
> case 0x90: /* nop */
> /* XXX: xchg + rex handling */
> /* XXX: correct lock test for all insn */
> The code to handle that just isn't there.
Sorry for inconvenience, I just forgot to look in source. :)
Do you plan to fix it in the near future?
--
Best regards,
Vic3dexe mailto:vic3dexe@gmail.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop
2010-07-02 19:13 ` vic3dexe
@ 2010-07-02 20:08 ` Richard Henderson
0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2010-07-02 20:08 UTC (permalink / raw)
To: vic3dexe; +Cc: qemu-devel, Bug 600589
On 07/02/2010 12:13 PM, vic3dexe@gmail.com wrote:
> Sorry for inconvenience, I just forgot to look in source. :)
> Do you plan to fix it in the near future?
No, in the near past. ;-)
The fix was committed to qemu.git head yesterday.
r~
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [Bug 600589] Re: xchg r8,rax treated as nop
2010-07-01 12:04 [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop Vic3Dexe
2010-07-01 16:17 ` Richard Henderson
@ 2010-07-06 13:00 ` Jes Sorensen
2011-02-20 17:13 ` Aurelien Jarno
2 siblings, 0 replies; 9+ messages in thread
From: Jes Sorensen @ 2010-07-06 13:00 UTC (permalink / raw)
To: qemu-devel
Per rth's reply to qemu-devel, fix has been pushed into upstream as of
July 1st, commit 7418027ea4fec276455abd4291558bc58a0a7ba7
If problem reappears, please reopen or open a new bug.
Closing
** Changed in: qemu
Status: New => Fix Committed
--
xchg r8,rax treated as nop
https://bugs.launchpad.net/bugs/600589
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
Status in QEMU: Fix Committed
Bug description:
xchg r8,rax (49h 90h) executed as nop (90h) in long mode, in other words REX not used.
qemu 0.12.4, host Win 7 x64, running qemu-system-x86_64.exe.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [Bug 600589] Re: xchg r8,rax treated as nop
2010-07-01 12:04 [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop Vic3Dexe
2010-07-01 16:17 ` Richard Henderson
2010-07-06 13:00 ` [Qemu-devel] [Bug 600589] " Jes Sorensen
@ 2011-02-20 17:13 ` Aurelien Jarno
2 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2011-02-20 17:13 UTC (permalink / raw)
To: qemu-devel
** Changed in: qemu
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/600589
Title:
xchg r8,rax treated as nop
Status in QEMU:
Fix Released
Bug description:
xchg r8,rax (49h 90h) executed as nop (90h) in long mode, in other
words REX not used.
qemu 0.12.4, host Win 7 x64, running qemu-system-x86_64.exe.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-02-20 17:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-01 12:04 [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop Vic3Dexe
2010-07-01 16:17 ` Richard Henderson
2010-07-01 16:42 ` [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8 Richard Henderson
2010-07-01 21:52 ` Aurelien Jarno
2010-07-01 16:43 ` [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop malc
2010-07-02 19:13 ` vic3dexe
2010-07-02 20:08 ` Richard Henderson
2010-07-06 13:00 ` [Qemu-devel] [Bug 600589] " Jes Sorensen
2011-02-20 17:13 ` Aurelien Jarno
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.