From 7ddf7e448ad59e15741e33ea65bc50ae72db4334 Mon Sep 17 00:00:00 2001 From: Andrei Vlad LUTAS Date: Thu, 23 Jul 2020 16:19:08 +0300 Subject: [PATCH] Apply address size override to gla computation. --- bdshemu/bdshemu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bdshemu/bdshemu.c b/bdshemu/bdshemu.c index a39b16c..0e9a53e 100644 --- a/bdshemu/bdshemu.c +++ b/bdshemu/bdshemu.c @@ -850,6 +850,18 @@ ShemuComputeLinearAddress( } } + // Make sure we truncate the linear address to the address size. + switch (Context->Instruction.AddrMode) + { + case ND_ADDR_32: + gla &= 0xFFFFFFFF; + break; + case ND_ADDR_16: + gla &= 0xFFFFF; + default: + break; + } + return gla; }