mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 05:00:27 +00:00
[FAST486]
Implement the BOUND instruction. svn path=/branches/ntvdm/; revision=61205
This commit is contained in:
parent
2064d10bad
commit
978c08c15c
1 changed files with 95 additions and 3 deletions
|
@ -3524,10 +3524,102 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePopAll)
|
||||||
|
|
||||||
FAST486_OPCODE_HANDLER(Fast486OpcodeBound)
|
FAST486_OPCODE_HANDLER(Fast486OpcodeBound)
|
||||||
{
|
{
|
||||||
// TODO: NOT IMPLEMENTED
|
BOOLEAN OperandSize, AddressSize;
|
||||||
UNIMPLEMENTED;
|
FAST486_MOD_REG_RM ModRegRm;
|
||||||
|
FAST486_SEG_REGS Segment = FAST486_REG_DS;
|
||||||
|
|
||||||
return FALSE;
|
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
|
||||||
|
|
||||||
|
NO_LOCK_PREFIX();
|
||||||
|
TOGGLE_OPSIZE(OperandSize);
|
||||||
|
TOGGLE_ADSIZE(AddressSize);
|
||||||
|
|
||||||
|
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ModRegRm.Memory)
|
||||||
|
{
|
||||||
|
/* Invalid */
|
||||||
|
Fast486Exception(State, FAST486_EXCEPTION_UD);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for the segment override */
|
||||||
|
if (State->PrefixFlags & FAST486_PREFIX_SEG)
|
||||||
|
{
|
||||||
|
/* Use the override segment instead */
|
||||||
|
Segment = State->SegmentOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OperandSize)
|
||||||
|
{
|
||||||
|
LONG Index, LowerBound, UpperBound;
|
||||||
|
|
||||||
|
/* Read the operands */
|
||||||
|
if (!Fast486ReadModrmDwordOperands(State,
|
||||||
|
&ModRegRm,
|
||||||
|
(PULONG)&Index,
|
||||||
|
(PULONG)&LowerBound))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Fast486ReadMemory(State,
|
||||||
|
Segment,
|
||||||
|
ModRegRm.MemoryAddress + sizeof(ULONG),
|
||||||
|
FALSE,
|
||||||
|
&UpperBound,
|
||||||
|
sizeof(ULONG)))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Index < LowerBound) || (Index > UpperBound))
|
||||||
|
{
|
||||||
|
/* Out of bounds */
|
||||||
|
Fast486Exception(State, FAST486_EXCEPTION_BR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHORT Index, LowerBound, UpperBound;
|
||||||
|
|
||||||
|
/* Read the operands */
|
||||||
|
if (!Fast486ReadModrmWordOperands(State,
|
||||||
|
&ModRegRm,
|
||||||
|
(PUSHORT)&Index,
|
||||||
|
(PUSHORT)&LowerBound))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Fast486ReadMemory(State,
|
||||||
|
Segment,
|
||||||
|
ModRegRm.MemoryAddress + sizeof(USHORT),
|
||||||
|
FALSE,
|
||||||
|
&UpperBound,
|
||||||
|
sizeof(USHORT)))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Index < LowerBound) || (Index > UpperBound))
|
||||||
|
{
|
||||||
|
/* Out of bounds */
|
||||||
|
Fast486Exception(State, FAST486_EXCEPTION_BR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FAST486_OPCODE_HANDLER(Fast486OpcodeArpl)
|
FAST486_OPCODE_HANDLER(Fast486OpcodeArpl)
|
||||||
|
|
Loading…
Reference in a new issue