1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:07:34 +00:00

UserspaceEmulator: Wrap the GPRs in ValueWithShadow

...instead of manually tracking their shadow data.
This commit is contained in:
Ali Mohammad Pur 2022-02-27 23:58:53 +03:30 committed by Andreas Kling
parent f6e82a8e0a
commit 70b53b44b2
3 changed files with 25 additions and 30 deletions

View file

@ -74,8 +74,10 @@ SoftCPU::SoftCPU(Emulator& emulator)
: m_emulator(emulator)
, m_fpu(emulator, *this)
{
memset(m_gpr, 0, sizeof(m_gpr));
memset(m_gpr_shadow, 1, sizeof(m_gpr_shadow));
PartAddressableRegister empty_reg;
explicit_bzero(&empty_reg, sizeof(empty_reg));
for (auto& gpr : m_gpr)
gpr = ValueWithShadow<PartAddressableRegister>::create_initialized(empty_reg);
m_segment[(int)X86::SegmentRegister::CS] = 0x1b;
m_segment[(int)X86::SegmentRegister::DS] = 0x23;