Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libx86emu Fix decoding of near CALL when address-...
details: https://anonhg.NetBSD.org/src/rev/1e1d4adeb55d
branches: trunk
changeset: 331181:1e1d4adeb55d
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Aug 04 21:41:44 2014 +0000
description:
Fix decoding of near CALL when address-size prefix (67h) is present.
>From Wolf Ramovsky via FreeBSD.
diffstat:
common/lib/libx86emu/x86emu.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diffs (35 lines):
diff -r a54b7e1e1861 -r 1e1d4adeb55d common/lib/libx86emu/x86emu.c
--- a/common/lib/libx86emu/x86emu.c Mon Aug 04 21:40:11 2014 +0000
+++ b/common/lib/libx86emu/x86emu.c Mon Aug 04 21:41:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x86emu.c,v 1.9 2014/08/04 21:40:11 joerg Exp $ */
+/* $NetBSD: x86emu.c,v 1.10 2014/08/04 21:41:44 joerg Exp $ */
/****************************************************************************
*
@@ -3604,12 +3604,19 @@
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;
+ }
}
/****************************************************************************
REMARKS:
Home |
Main Index |
Thread Index |
Old Index