mirror of
https://github.com/bitdefender/bddisasm.git
synced 2025-06-25 18:02:35 +00:00
Improved linear address computation in bdshemu.
This commit is contained in:
parent
6c248cc4c1
commit
d11fe85599
@ -788,12 +788,6 @@ ShemuComputeLinearAddress(
|
|||||||
{
|
{
|
||||||
uint64_t gla = 0;
|
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)
|
if (Operand->Info.Memory.HasBase)
|
||||||
{
|
{
|
||||||
gla += ShemuGetGprValue(Context, Operand->Info.Memory.Base, Operand->Info.Memory.BaseSize, false);
|
gla += ShemuGetGprValue(Context, Operand->Info.Memory.Base, Operand->Info.Memory.BaseSize, false);
|
||||||
@ -857,11 +851,24 @@ ShemuComputeLinearAddress(
|
|||||||
gla &= 0xFFFFFFFF;
|
gla &= 0xFFFFFFFF;
|
||||||
break;
|
break;
|
||||||
case ND_ADDR_16:
|
case ND_ADDR_16:
|
||||||
gla &= 0xFFFFF;
|
gla &= 0xFFFF;
|
||||||
default:
|
default:
|
||||||
break;
|
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;
|
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.
|
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
|
.. code-block:: c
|
||||||
|
Loading…
Reference in New Issue
Block a user