qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1888165] [NEW] loopz/loopnz clearing previous instruction's modified flags on cx -> 0
@ 2020-07-20  0:15 Jeffrey
  2020-07-20  0:33 ` [Bug 1888165] " Jeffrey
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jeffrey @ 2020-07-20  0:15 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

If you run QBasic in qemu, printing a double-type single-digit number
will print an extra decimal point (e.g. PRINT CDBL(3) prints "3.") that
does not appear when running on a real CPU (or on qemu with -enable-
kvm). I tracked this down to the state of the status flags after a
loopnz instruction.

After executing a sequence like this in qemu:

	mov bx,1
	mov cx,1
	dec bx    ; sets Z bit in flags
A:	loopnz A  ; should not modify flags

Z is incorrectly clear afterwards. loopz does the same thing (but not
plain loop). Interestingly, inserting pushf+popf after dec results in Z
set, so loopnz/loopz does not always clear Z itself but is rather
interfering with the previous instruction's flag setting.

Version 5.1.0-rc0, x86-64 host.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1888165

Title:
  loopz/loopnz clearing previous instruction's modified flags on cx -> 0

Status in QEMU:
  New

Bug description:
  If you run QBasic in qemu, printing a double-type single-digit number
  will print an extra decimal point (e.g. PRINT CDBL(3) prints "3.")
  that does not appear when running on a real CPU (or on qemu with
  -enable-kvm). I tracked this down to the state of the status flags
  after a loopnz instruction.

  After executing a sequence like this in qemu:

  	mov bx,1
  	mov cx,1
  	dec bx    ; sets Z bit in flags
  A:	loopnz A  ; should not modify flags

  Z is incorrectly clear afterwards. loopz does the same thing (but not
  plain loop). Interestingly, inserting pushf+popf after dec results in
  Z set, so loopnz/loopz does not always clear Z itself but is rather
  interfering with the previous instruction's flag setting.

  Version 5.1.0-rc0, x86-64 host.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1888165/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1888165] Re: loopz/loopnz clearing previous instruction's modified flags on cx -> 0
  2020-07-20  0:15 [Bug 1888165] [NEW] loopz/loopnz clearing previous instruction's modified flags on cx -> 0 Jeffrey
@ 2020-07-20  0:33 ` Jeffrey
  2020-07-20  0:34 ` Jeffrey
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeffrey @ 2020-07-20  0:33 UTC (permalink / raw)
  To: qemu-devel

** Attachment added: "bootable image demonstrating bug"
   https://bugs.launchpad.net/qemu/+bug/1888165/+attachment/5394189/+files/loopnzbug.img

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1888165

Title:
  loopz/loopnz clearing previous instruction's modified flags on cx -> 0

Status in QEMU:
  New

Bug description:
  If you run QBasic in qemu, printing a double-type single-digit number
  will print an extra decimal point (e.g. PRINT CDBL(3) prints "3.")
  that does not appear when running on a real CPU (or on qemu with
  -enable-kvm). I tracked this down to the state of the status flags
  after a loopnz instruction.

  After executing a sequence like this in qemu:

  	mov bx,1
  	mov cx,1
  	dec bx    ; sets Z bit in flags
  A:	loopnz A  ; should not modify flags

  Z is incorrectly clear afterwards. loopz does the same thing (but not
  plain loop). Interestingly, inserting pushf+popf after dec results in
  Z set, so loopnz/loopz does not always clear Z itself but is rather
  interfering with the previous instruction's flag setting.

  Version 5.1.0-rc0, x86-64 host.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1888165/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1888165] Re: loopz/loopnz clearing previous instruction's modified flags on cx -> 0
  2020-07-20  0:15 [Bug 1888165] [NEW] loopz/loopnz clearing previous instruction's modified flags on cx -> 0 Jeffrey
  2020-07-20  0:33 ` [Bug 1888165] " Jeffrey
@ 2020-07-20  0:34 ` Jeffrey
  2020-07-20 15:17 ` Richard Henderson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeffrey @ 2020-07-20  0:34 UTC (permalink / raw)
  To: qemu-devel

** Attachment added: "source"
   https://bugs.launchpad.net/qemu/+bug/1888165/+attachment/5394190/+files/loopnzbug.asm

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1888165

Title:
  loopz/loopnz clearing previous instruction's modified flags on cx -> 0

Status in QEMU:
  New

Bug description:
  If you run QBasic in qemu, printing a double-type single-digit number
  will print an extra decimal point (e.g. PRINT CDBL(3) prints "3.")
  that does not appear when running on a real CPU (or on qemu with
  -enable-kvm). I tracked this down to the state of the status flags
  after a loopnz instruction.

  After executing a sequence like this in qemu:

  	mov bx,1
  	mov cx,1
  	dec bx    ; sets Z bit in flags
  A:	loopnz A  ; should not modify flags

  Z is incorrectly clear afterwards. loopz does the same thing (but not
  plain loop). Interestingly, inserting pushf+popf after dec results in
  Z set, so loopnz/loopz does not always clear Z itself but is rather
  interfering with the previous instruction's flag setting.

  Version 5.1.0-rc0, x86-64 host.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1888165/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1888165] Re: loopz/loopnz clearing previous instruction's modified flags on cx -> 0
  2020-07-20  0:15 [Bug 1888165] [NEW] loopz/loopnz clearing previous instruction's modified flags on cx -> 0 Jeffrey
  2020-07-20  0:33 ` [Bug 1888165] " Jeffrey
  2020-07-20  0:34 ` Jeffrey
@ 2020-07-20 15:17 ` Richard Henderson
  2020-07-26 20:01 ` Richard Henderson
  2020-08-20 15:03 ` Thomas Huth
  4 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2020-07-20 15:17 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: New => In Progress

** Changed in: qemu
     Assignee: (unassigned) => Richard Henderson (rth)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1888165

Title:
  loopz/loopnz clearing previous instruction's modified flags on cx -> 0

Status in QEMU:
  In Progress

Bug description:
  If you run QBasic in qemu, printing a double-type single-digit number
  will print an extra decimal point (e.g. PRINT CDBL(3) prints "3.")
  that does not appear when running on a real CPU (or on qemu with
  -enable-kvm). I tracked this down to the state of the status flags
  after a loopnz instruction.

  After executing a sequence like this in qemu:

  	mov bx,1
  	mov cx,1
  	dec bx    ; sets Z bit in flags
  A:	loopnz A  ; should not modify flags

  Z is incorrectly clear afterwards. loopz does the same thing (but not
  plain loop). Interestingly, inserting pushf+popf after dec results in
  Z set, so loopnz/loopz does not always clear Z itself but is rather
  interfering with the previous instruction's flag setting.

  Version 5.1.0-rc0, x86-64 host.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1888165/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1888165] Re: loopz/loopnz clearing previous instruction's modified flags on cx -> 0
  2020-07-20  0:15 [Bug 1888165] [NEW] loopz/loopnz clearing previous instruction's modified flags on cx -> 0 Jeffrey
                   ` (2 preceding siblings ...)
  2020-07-20 15:17 ` Richard Henderson
@ 2020-07-26 20:01 ` Richard Henderson
  2020-08-20 15:03 ` Thomas Huth
  4 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2020-07-26 20:01 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1888165

Title:
  loopz/loopnz clearing previous instruction's modified flags on cx -> 0

Status in QEMU:
  Fix Committed

Bug description:
  If you run QBasic in qemu, printing a double-type single-digit number
  will print an extra decimal point (e.g. PRINT CDBL(3) prints "3.")
  that does not appear when running on a real CPU (or on qemu with
  -enable-kvm). I tracked this down to the state of the status flags
  after a loopnz instruction.

  After executing a sequence like this in qemu:

  	mov bx,1
  	mov cx,1
  	dec bx    ; sets Z bit in flags
  A:	loopnz A  ; should not modify flags

  Z is incorrectly clear afterwards. loopz does the same thing (but not
  plain loop). Interestingly, inserting pushf+popf after dec results in
  Z set, so loopnz/loopz does not always clear Z itself but is rather
  interfering with the previous instruction's flag setting.

  Version 5.1.0-rc0, x86-64 host.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1888165/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1888165] Re: loopz/loopnz clearing previous instruction's modified flags on cx -> 0
  2020-07-20  0:15 [Bug 1888165] [NEW] loopz/loopnz clearing previous instruction's modified flags on cx -> 0 Jeffrey
                   ` (3 preceding siblings ...)
  2020-07-26 20:01 ` Richard Henderson
@ 2020-08-20 15:03 ` Thomas Huth
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2020-08-20 15:03 UTC (permalink / raw)
  To: qemu-devel

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=3cb3a7720b01830abd5

** 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/1888165

Title:
  loopz/loopnz clearing previous instruction's modified flags on cx -> 0

Status in QEMU:
  Fix Released

Bug description:
  If you run QBasic in qemu, printing a double-type single-digit number
  will print an extra decimal point (e.g. PRINT CDBL(3) prints "3.")
  that does not appear when running on a real CPU (or on qemu with
  -enable-kvm). I tracked this down to the state of the status flags
  after a loopnz instruction.

  After executing a sequence like this in qemu:

  	mov bx,1
  	mov cx,1
  	dec bx    ; sets Z bit in flags
  A:	loopnz A  ; should not modify flags

  Z is incorrectly clear afterwards. loopz does the same thing (but not
  plain loop). Interestingly, inserting pushf+popf after dec results in
  Z set, so loopnz/loopz does not always clear Z itself but is rather
  interfering with the previous instruction's flag setting.

  Version 5.1.0-rc0, x86-64 host.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1888165/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-20 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20  0:15 [Bug 1888165] [NEW] loopz/loopnz clearing previous instruction's modified flags on cx -> 0 Jeffrey
2020-07-20  0:33 ` [Bug 1888165] " Jeffrey
2020-07-20  0:34 ` Jeffrey
2020-07-20 15:17 ` Richard Henderson
2020-07-26 20:01 ` Richard Henderson
2020-08-20 15:03 ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).