summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2012-07-26 15:40:06 -0700
committerPatrick Georgi <patrick@georgi-clan.de>2012-08-02 12:36:14 +0200
commitbbf249649336801517f77d1f76aafeaf20d96180 (patch)
treef164b5c356ecc30cb9e6471e164304690e470a9b
parent9fd183efde9b78ba2f2bf1c1922a3968650b3b05 (diff)
downloadcoreboot-bbf249649336801517f77d1f76aafeaf20d96180.tar.xz
x86emu: Respect the LEA 67h address size prefix
From http://cgit.freedesktop.org/xorg/xserver/commit/hw/xfree86/x86emu?id=f57bc0ede8e018c7e264b917927c42a018cd1d5a Change-Id: Ibdcaa27e936464cec512edb46447aa6284a34975 Signed-off-by: Stefan Reinauer <reinauer@google.com> Signed-off-by: Christian Zander <chzander@nvidia.com> Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-on: http://review.coreboot.org/1364 Tested-by: build bot (Jenkins) Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com> Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
-rw-r--r--src/devices/oprom/x86emu/ops.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/devices/oprom/x86emu/ops.c b/src/devices/oprom/x86emu/ops.c
index 70e048dc2f..6bfc71c08c 100644
--- a/src/devices/oprom/x86emu/ops.c
+++ b/src/devices/oprom/x86emu/ops.c
@@ -2058,27 +2058,29 @@ Handles opcode 0x8d
static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
{
int mod, rl, rh;
- u16 *srcreg;
uint destoffset;
-/*
- * TODO: Need to handle address size prefix!
- *
- * lea eax,[eax+ebx*2] ??
- */
-
START_OF_INSTR();
DECODE_PRINTF("LEA\t");
FETCH_DECODE_MODRM(mod, rh, rl);
if (mod < 3) {
- srcreg = DECODE_RM_WORD_REGISTER(rh);
- DECODE_PRINTF(",");
- destoffset = decode_rmXX_address(mod, rl);
- DECODE_PRINTF("\n");
- TRACE_AND_STEP();
- *srcreg = (u16)destoffset;
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rmXX_address(mod, rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u32)destoffset;
+ } else {
+ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rmXX_address(mod, rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16)destoffset;
}
- /* } else { undefined. Do nothing. } */
+ }
+ /* else { undefined. Do nothing. } */
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}