On 24.09.2026 23:04, Artemii Mashanov wrote:
The imm16 operand of RET and RETF specifies an unsigned 16-bit count
of additional bytes to release from the stack.

Previously, gen_RET() and gen_RETF() stored this operand in an int16_t.
For example, 0xcaf5 was interpreted as -13579 instead of 51957.

Use uint16_t for the adjustment in both functions to preserve the
immediate's unsigned value.

Tested locally with near and far returns in both 32-bit and 64-bit
modes. Each combination covered the form without an immediate and
immediate values 0x0000, 0x0001, 0x7fff, 0x8000, 0xcaf5, and 0xffff.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2599

Signed-off-by: Artemii Mashanov <[email protected]>
---
  target/i386/tcg/emit.c.inc | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Hi!

I'm picking this one up for the current qemu stable series too.
Please let me know if I shouldn't.

Thanks,

/mjt

Reply via email to