1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:37:43 +00:00

UserspaceEmulator: Add arithmetic CPU flags

This commit is contained in:
Andreas Kling 2020-07-07 21:34:58 +02:00
parent d0dbf92c8d
commit 934f0b999e
2 changed files with 24 additions and 2 deletions

View file

@ -46,8 +46,9 @@ SoftCPU::SoftCPU(Emulator& emulator)
void SoftCPU::dump() const void SoftCPU::dump() const
{ {
printf("eax: %08x ebx: %08x ecx: %08x edx: %08x\n", m_eax, m_ebx, m_ecx, m_edx); printf("eax=%08x ebx=%08x ecx=%08x edx=%08x ", m_eax, m_ebx, m_ecx, m_edx);
printf("ebp: %08x esp: %08x esi: %08x edi: %08x\n", m_ebp, m_esp, m_esi, m_edi); printf("ebp=%08x esp=%08x esi=%08x edi=%08x ", m_ebp, m_esp, m_esi, m_edi);
printf("o=%u s=%u z=%u a=%u p=%u c=%u\n", m_of, m_sf, m_zf, m_af, m_pf, m_cf);
} }
void SoftCPU::AAA(const X86::Instruction&) { TODO(); } void SoftCPU::AAA(const X86::Instruction&) { TODO(); }

View file

@ -510,6 +510,20 @@ public:
private: private:
Emulator& m_emulator; Emulator& m_emulator;
bool get_of() const { return m_of; }
bool get_sf() const { return m_sf; }
bool get_zf() const { return m_zf; }
bool get_af() const { return m_af; }
bool get_pf() const { return m_pf; }
bool get_cf() const { return m_cf; }
void set_of(bool value) { m_of = value; }
void set_sf(bool value) { m_sf = value; }
void set_zf(bool value) { m_zf = value; }
void set_af(bool value) { m_af = value; }
void set_pf(bool value) { m_pf = value; }
void set_cf(bool value) { m_cf = value; }
u32* m_reg32_table[8]; u32* m_reg32_table[8];
u32 m_eax { 0 }; u32 m_eax { 0 };
@ -520,6 +534,13 @@ private:
u32 m_ebp { 0 }; u32 m_ebp { 0 };
u32 m_esi { 0 }; u32 m_esi { 0 };
u32 m_edi { 0 }; u32 m_edi { 0 };
bool m_of { false };
bool m_sf { false };
bool m_zf { false };
bool m_af { false };
bool m_pf { false };
bool m_cf { false };
}; };
} }