From 864650101bf7ae119800699945edf176d174c08a Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 9 Jan 2022 21:27:42 -0800 Subject: [PATCH] arch-x86: Handle a special case for MODRM in 16 bit mode. When the address size is 16 bit, the mod field is 0, and the rm is 6, there is no base register, only a displacement. Change-Id: Ib67a6e5ce617d08913b9ca6dee66877f0154ffe1 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55285 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- src/arch/x86/emulenv.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arch/x86/emulenv.cc b/src/arch/x86/emulenv.cc index bfca1e513d..44afc5acc9 100644 --- a/src/arch/x86/emulenv.cc +++ b/src/arch/x86/emulenv.cc @@ -82,7 +82,8 @@ void EmulEnv::doModRM(const ExtMachInst & machInst) base = INTREG_RDI; break; case 6: - base = INTREG_RBP; + // There is a special case when mod is 0 and rm is 6. + base = machInst.modRM.mod == 0 ? INTREG_T0 : INTREG_RBP; break; case 7: base = INTREG_RBX;