mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 14:27:35 +00:00
UserspaceEmulator: Simplify the STOSB/STOSW/STOSD instructions
This commit is contained in:
parent
79290696cf
commit
8959f9950a
1 changed files with 12 additions and 33 deletions
|
@ -2076,47 +2076,26 @@ void SoftCPU::STI(const X86::Instruction&) { TODO(); }
|
||||||
|
|
||||||
void SoftCPU::STOSB(const X86::Instruction& insn)
|
void SoftCPU::STOSB(const X86::Instruction& insn)
|
||||||
{
|
{
|
||||||
if (insn.has_address_size_override_prefix()) {
|
do_once_or_repeat<false>(insn, [&] {
|
||||||
do_once_or_repeat<false>(insn, [&] {
|
write_memory8({ es(), destination_index(insn.a32()) }, al());
|
||||||
write_memory8({ es(), di() }, al());
|
step_destination_index(insn.a32(), 1);
|
||||||
set_di(di() + (df() ? -1 : 1));
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
do_once_or_repeat<false>(insn, [&] {
|
|
||||||
write_memory8({ es(), edi() }, al());
|
|
||||||
set_edi(edi() + (df() ? -1 : 1));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoftCPU::STOSD(const X86::Instruction& insn)
|
void SoftCPU::STOSD(const X86::Instruction& insn)
|
||||||
{
|
{
|
||||||
if (insn.has_address_size_override_prefix()) {
|
do_once_or_repeat<false>(insn, [&] {
|
||||||
do_once_or_repeat<false>(insn, [&] {
|
write_memory32({ es(), destination_index(insn.a32()) }, eax());
|
||||||
write_memory32({ es(), di() }, eax());
|
step_destination_index(insn.a32(), 4);
|
||||||
set_di(di() + (df() ? -4 : 4));
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
do_once_or_repeat<false>(insn, [&] {
|
|
||||||
write_memory32({ es(), edi() }, eax());
|
|
||||||
set_edi(edi() + (df() ? -4 : 4));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoftCPU::STOSW(const X86::Instruction& insn)
|
void SoftCPU::STOSW(const X86::Instruction& insn)
|
||||||
{
|
{
|
||||||
if (insn.has_address_size_override_prefix()) {
|
do_once_or_repeat<false>(insn, [&] {
|
||||||
do_once_or_repeat<false>(insn, [&] {
|
write_memory16({ es(), destination_index(insn.a32()) }, ax());
|
||||||
write_memory16({ es(), di() }, ax());
|
step_destination_index(insn.a32(), 2);
|
||||||
set_di(di() + (df() ? -2 : 2));
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
do_once_or_repeat<false>(insn, [&] {
|
|
||||||
write_memory16({ es(), edi() }, ax());
|
|
||||||
set_edi(edi() + (df() ? -2 : 2));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoftCPU::STR_RM16(const X86::Instruction&) { TODO(); }
|
void SoftCPU::STR_RM16(const X86::Instruction&) { TODO(); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue