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

UserspaceEmulator: Add an initial stack and implement PUSH/POP reg32

Programs now start out with a 64 KB stack at 0x10000000. :^)
This commit is contained in:
Andreas Kling 2020-07-09 16:20:08 +02:00
parent d5c46cf528
commit d10765bec3
3 changed files with 99 additions and 5 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <LibX86/Instruction.h>
#include <LibX86/Interpreter.h>
namespace UserspaceEmulator {
@ -37,6 +38,21 @@ public:
explicit SoftCPU(Emulator&);
void dump() const;
void push32(u32);
u32 pop32();
u32 get_esp() const { return m_esp; }
void set_esp(u32 value) { m_esp = value; }
u16 get_cs() const { return 0x18; }
u16 get_ds() const { return 0x20; }
u16 get_es() const { return 0x20; }
u16 get_ss() const { return 0x20; }
u32 read_memory32(X86::LogicalAddress);
void write_memory32(X86::LogicalAddress, u32);
private:
virtual void AAA(const X86::Instruction&) override;
virtual void AAD(const X86::Instruction&) override;
virtual void AAM(const X86::Instruction&) override;