mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:43:01 +00:00
[SOFT386]
Implement PUSHA and POPA. svn path=/branches/ntvdm/; revision=60049
This commit is contained in:
parent
f092154985
commit
76b87315a8
1 changed files with 80 additions and 6 deletions
|
@ -3485,18 +3485,92 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeAas)
|
||||||
|
|
||||||
SOFT386_OPCODE_HANDLER(Soft386OpcodePushAll)
|
SOFT386_OPCODE_HANDLER(Soft386OpcodePushAll)
|
||||||
{
|
{
|
||||||
// TODO: NOT IMPLEMENTED
|
INT i;
|
||||||
UNIMPLEMENTED;
|
BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
|
||||||
|
SOFT386_REG SavedEsp = State->GeneralRegs[SOFT386_REG_ESP];
|
||||||
|
|
||||||
return FALSE;
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0x60);
|
||||||
|
|
||||||
|
if (State->PrefixFlags == SOFT386_PREFIX_OPSIZE)
|
||||||
|
{
|
||||||
|
/* The OPSIZE prefix toggles the size */
|
||||||
|
Size = !Size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Invalid prefix */
|
||||||
|
Soft386Exception(State, SOFT386_EXCEPTION_UD);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Push all the registers in order */
|
||||||
|
for (i = 0; i < SOFT386_NUM_GEN_REGS; i++)
|
||||||
|
{
|
||||||
|
if (i == SOFT386_REG_ESP)
|
||||||
|
{
|
||||||
|
/* Use the saved ESP instead */
|
||||||
|
if (!Soft386StackPush(State, Size ? SavedEsp.Long : SavedEsp.LowWord))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Push the register */
|
||||||
|
if (!Soft386StackPush(State, Size ? State->GeneralRegs[i].Long
|
||||||
|
: State->GeneralRegs[i].LowWord))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SOFT386_OPCODE_HANDLER(Soft386OpcodePopAll)
|
SOFT386_OPCODE_HANDLER(Soft386OpcodePopAll)
|
||||||
{
|
{
|
||||||
// TODO: NOT IMPLEMENTED
|
INT i;
|
||||||
UNIMPLEMENTED;
|
BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
|
||||||
|
ULONG Value;
|
||||||
|
|
||||||
return FALSE;
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0x61);
|
||||||
|
|
||||||
|
if (State->PrefixFlags == SOFT386_PREFIX_OPSIZE)
|
||||||
|
{
|
||||||
|
/* The OPSIZE prefix toggles the size */
|
||||||
|
Size = !Size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Invalid prefix */
|
||||||
|
Soft386Exception(State, SOFT386_EXCEPTION_UD);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pop all the registers in reverse order */
|
||||||
|
for (i = SOFT386_NUM_GEN_REGS - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
/* Pop the value */
|
||||||
|
if (!Soft386StackPop(State, &Value))
|
||||||
|
{
|
||||||
|
/* Exception occurred */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't modify ESP */
|
||||||
|
if (i != SOFT386_REG_ESP)
|
||||||
|
{
|
||||||
|
if (Size) State->GeneralRegs[i].Long = Value;
|
||||||
|
else State->GeneralRegs[i].LowWord = LOWORD(Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SOFT386_OPCODE_HANDLER(Soft386OpcodeBound)
|
SOFT386_OPCODE_HANDLER(Soft386OpcodeBound)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue