Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jun 2014 20:38:14 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267374 - head/sys/contrib/x86emu
Message-ID:  <201406112038.s5BKcEiR084723@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed Jun 11 20:38:14 2014
New Revision: 267374
URL: http://svnweb.freebsd.org/changeset/base/267374

Log:
  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

Modified:
  head/sys/contrib/x86emu/x86emu.c

Modified: head/sys/contrib/x86emu/x86emu.c
==============================================================================
--- head/sys/contrib/x86emu/x86emu.c	Wed Jun 11 20:31:41 2014	(r267373)
+++ head/sys/contrib/x86emu/x86emu.c	Wed Jun 11 20:38:14 2014	(r267374)
@@ -3753,12 +3753,19 @@ x86emuOp_out_word_IMM_AX(struct x86emu *
 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;
+	}
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406112038.s5BKcEiR084723>