summaryrefslogtreecommitdiffstats
path: root/sys/contrib/x86emu
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-06-11 20:38:14 +0000
committerdelphij <delphij@FreeBSD.org>2014-06-11 20:38:14 +0000
commit4c6f2b6755a49480a0c894e072c95a272131e1d1 (patch)
tree869f46237b4a9a745249d12c1f036e68a4697020 /sys/contrib/x86emu
parentf0333bcbd4fd2e265bd780911c13c17acf253c53 (diff)
downloadFreeBSD-src-4c6f2b6755a49480a0c894e072c95a272131e1d1.zip
FreeBSD-src-4c6f2b6755a49480a0c894e072c95a272131e1d1.tar.gz
Fix decoding of near CALL when address-size prefix (67h) is present.
Submitted by: Wolf Ramovsky <wolf.ramovsky gmail.com> via core (peter) MFC after: 2 weeks
Diffstat (limited to 'sys/contrib/x86emu')
-rw-r--r--sys/contrib/x86emu/x86emu.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/contrib/x86emu/x86emu.c b/sys/contrib/x86emu/x86emu.c
index 60c5412..87cd777 100644
--- a/sys/contrib/x86emu/x86emu.c
+++ b/sys/contrib/x86emu/x86emu.c
@@ -3753,12 +3753,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;
+ }
}
/*
OpenPOWER on IntegriCloud