Improved linear address computation in bdshemu.

pull/9/head
Andrei Vlad LUTAS 4 years ago
parent 6c248cc4c1
commit d11fe85599

@ -788,12 +788,6 @@ ShemuComputeLinearAddress(
{
uint64_t gla = 0;
// Memory operands usually have a segment.
if (Operand->Info.Memory.HasSeg)
{
gla += ShemuGetSegBase(Context, Operand->Info.Memory.Seg);
}
if (Operand->Info.Memory.HasBase)
{
gla += ShemuGetGprValue(Context, Operand->Info.Memory.Base, Operand->Info.Memory.BaseSize, false);
@ -857,11 +851,24 @@ ShemuComputeLinearAddress(
gla &= 0xFFFFFFFF;
break;
case ND_ADDR_16:
gla &= 0xFFFFF;
gla &= 0xFFFF;
default:
break;
}
// Memory operands usually have a segment. Note that we don't care about any segment checks, since we're most
// likely be provided with flat segments. If checks should be needed, dedicated callbacks should be added.
if (Operand->Info.Memory.HasSeg)
{
gla += ShemuGetSegBase(Context, Operand->Info.Memory.Seg);
if (Context->Mode != ND_CODE_64)
{
// Truncate to 32 bit outside 64 bit.
gla &= 0xFFFFFFFF;
}
}
return gla;
}

@ -376,7 +376,7 @@ Determining if the instruction is a branch of any kind
if (ix.RipAccess & ND_ACCESS_ANY_WRITE) // Instruction writes RIP.
Computing the linear address of a memory operand
Computing the virtual address of a memory operand
------------------------------------------------
.. code-block:: c

Loading…
Cancel
Save