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

UserspaceEmulator: Devirtualize read/write/execute region permissions

These are getting quite hot (~4% of general emulation profile combined)
so let's just devirtualize them and turn the function calls into simple
boolean checks.
This commit is contained in:
Andreas Kling 2020-11-16 09:44:30 +01:00
parent f41b9946e2
commit 3c64cec4d7
3 changed files with 17 additions and 10 deletions

View file

@ -69,9 +69,13 @@ public:
bool is_text() const { return m_text; }
void set_text(bool b) { m_text = b; }
virtual bool is_readable() const { return true; }
virtual bool is_writable() const { return true; }
virtual bool is_executable() const { return true; }
bool is_readable() const { return m_readable; }
bool is_writable() const { return m_writable; }
bool is_executable() const { return m_executable; }
void set_readable(bool b) { m_readable = b; }
void set_writable(bool b) { m_writable = b; }
void set_executable(bool b) { m_executable = b; }
virtual u8* data() = 0;
virtual u8* shadow_data() = 0;
@ -89,6 +93,9 @@ public:
bool m_stack { false };
bool m_text { false };
bool m_readable { true };
bool m_writable { true };
bool m_executable { true };
};
ValueWithShadow<u8> read8(X86::LogicalAddress);