diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-16 17:04:04 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-16 19:21:45 +0200 |
commit | 7e132442387e42a96c4f9ea4a0a1fe22ce5cc30e (patch) | |
tree | c29f9f9ae5270d66351c5c491eca6ba963656dae /DevTools | |
parent | 9f1221c785d6547892a33fb15610c3fe74c9fc27 (diff) | |
download | serenity-7e132442387e42a96c4f9ea4a0a1fe22ce5cc30e.zip |
UserspaceEmulator: Add ways to check if a Region is stack/mmap
Diffstat (limited to 'DevTools')
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 1 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/MmapRegion.h | 1 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/SoftMMU.h | 6 |
3 files changed, 8 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index fac2bf92b6..f7006504f6 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -75,6 +75,7 @@ Emulator::Emulator(const Vector<String>& arguments, NonnullRefPtr<ELF::Loader> e void Emulator::setup_stack(const Vector<String>& arguments) { auto stack_region = make<SimpleRegion>(stack_location, stack_size); + stack_region->set_stack(true); m_mmu.add_region(move(stack_region)); m_cpu.set_esp(stack_location + stack_size); diff --git a/DevTools/UserspaceEmulator/MmapRegion.h b/DevTools/UserspaceEmulator/MmapRegion.h index d169e1746d..57c02ed73d 100644 --- a/DevTools/UserspaceEmulator/MmapRegion.h +++ b/DevTools/UserspaceEmulator/MmapRegion.h @@ -55,6 +55,7 @@ public: private: MmapRegion(u32 base, u32 size, int prot); + virtual bool is_mmap() const override { return true; } u8* m_data { nullptr }; int m_prot { 0 }; diff --git a/DevTools/UserspaceEmulator/SoftMMU.h b/DevTools/UserspaceEmulator/SoftMMU.h index 5d154c4b30..049796158b 100644 --- a/DevTools/UserspaceEmulator/SoftMMU.h +++ b/DevTools/UserspaceEmulator/SoftMMU.h @@ -58,6 +58,10 @@ public: virtual u8* cacheable_ptr([[maybe_unused]] u32 offset) { return nullptr; } virtual bool is_shared_buffer() const { return false; } + virtual bool is_mmap() const { return false; } + + bool is_stack() const { return m_stack; } + void set_stack(bool b) { m_stack = b; } protected: Region(u32 base, u32 size) @@ -69,6 +73,8 @@ public: private: u32 m_base { 0 }; u32 m_size { 0 }; + + bool m_stack { false }; }; u8 read8(X86::LogicalAddress); |