Commit cc2c73dd authored by Luc Verhaegen's avatar Luc Verhaegen Committed by Keith Packard
Browse files

x86emu: fix jump_near_IMM to handle DATA: flag correctly.


Before (data flag ignored -> broken):
66                  DATA:
e944f1              JMP       1ff6

After (fixed):
66                  DATA:
e944f1ffff          JMP       00001ff8

This subtle difference in the length of decoded instruction meant
that the VBE call jumped to the routine setting AX=0x14F (VBE Failed)
instead of the routine that set AX=0x4F (VBE success).

The ability to run the same code in vm86 significantly aided the
debugging of this issue. Those developers who would like to drop
vm86 better take special care towards _all_ vesa bugs, as those will
expose further issues.

Patch applies easily to even xserver 1.4.2.
Signed-off-by: Luc Verhaegen's avatarLuc Verhaegen <>
Tested-by: Luc Verhaegen's avatarLuc Verhaegen <>
Reviewed-by: Adam Jackson's avatarAdam Jackson <>
Signed-off-by: Keith Packard's avatarKeith Packard <>
parent be7cf14c
......@@ -9691,15 +9691,23 @@ Handles opcode 0xe9
static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
int ip;
u32 ip;
ip = (s16)fetch_word_imm();
ip += (s16)M.x86.R_IP;
DECODE_PRINTF2("%04x\n", (u16)ip);
M.x86.R_IP = (u16)ip;
if (M.x86.mode & SYSMODE_PREFIX_DATA) {
ip = (u32)fetch_long_imm();
ip += (u32)M.x86.R_EIP;
DECODE_PRINTF2("%08x\n", (u32)ip);
M.x86.R_EIP = (u32)ip;
} else {
ip = (s16)fetch_word_imm();
ip += (s16)M.x86.R_IP;
DECODE_PRINTF2("%04x\n", (u16)ip);
M.x86.R_IP = (u16)ip;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment