diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2014-06-15 11:00:39 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2014-06-15 11:00:39 +0000 |
commit | 996120d931531bbf9d3860b8798ec0359add487d (patch) | |
tree | d8a94682a673a7f23a1f147b8cb2ed9e6f7d88a6 /sys/dev | |
parent | 59f087023f8c520661aae86e3148adfaf89f6cff (diff) |
Fix 0x67 prefixed near CALL decoding.
Heads-up from Xen Li (delphij@FreeBSD), thanks!
Tested on Sony VGN-P530H.
Okay mlarkin@, matthieu@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/x86emu/x86emu.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/dev/x86emu/x86emu.c b/sys/dev/x86emu/x86emu.c index 2ab27ab4d72..21efc90f8c0 100644 --- a/sys/dev/x86emu/x86emu.c +++ b/sys/dev/x86emu/x86emu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x86emu.c,v 1.6 2014/03/29 18:09:31 guenther Exp $ */ +/* $OpenBSD: x86emu.c,v 1.7 2014/06/15 11:00:38 pirofti Exp $ */ /* $NetBSD: x86emu.c,v 1.7 2009/02/03 19:26:29 joerg Exp $ */ /* @@ -3756,12 +3756,19 @@ x86emuOp_out_word_IMM_AX(struct x86emu *emu) static void x86emuOp_call_near_IMM(struct x86emu *emu) { - int16_t ip; - - ip = (int16_t) fetch_word_imm(emu); - ip += (int16_t) emu->x86.R_IP; /* CHECK SIGN */ - push_word(emu, emu->x86.R_IP); - emu->x86.R_IP = ip; + if (emu->x86.mode & SYSMODE_PREFIX_DATA) { + int32_t ip; + ip = (int32_t) fetch_long_imm(emu); + ip += (int32_t) emu->x86.R_EIP; + push_long(emu, emu->x86.R_EIP); + emu->x86.R_EIP = ip; + } else { + int16_t ip; + ip = (int16_t) fetch_word_imm(emu); + ip += (int16_t) emu->x86.R_IP; /* CHECK SIGN */ + push_word(emu, emu->x86.R_IP); + emu->x86.R_IP = ip; + } } /* |