1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:38:11 +00:00

UserspaceEmulator: Move the SoftCPU stream virtuals to the header

They don't actually get inlined yet, but at least this devirtualizes
them which is nice.
This commit is contained in:
Andreas Kling 2020-07-13 20:41:48 +02:00
parent 868db2313f
commit 2f81c20002
2 changed files with 33 additions and 33 deletions

View file

@ -74,39 +74,6 @@ void SoftCPU::update_code_cache()
m_cached_code_end = region->cacheable_ptr(region->size());
}
u8 SoftCPU::read8()
{
if (!m_cached_code_ptr || m_cached_code_ptr >= m_cached_code_end)
update_code_cache();
u8 value = *m_cached_code_ptr;
m_cached_code_ptr += 1;
m_eip += 1;
return value;
}
u16 SoftCPU::read16()
{
if (!m_cached_code_ptr || (m_cached_code_ptr + 2) >= m_cached_code_end)
update_code_cache();
u16 value = *reinterpret_cast<const u16*>(m_cached_code_ptr);
m_cached_code_ptr += 2;
m_eip += 2;
return value;
}
u32 SoftCPU::read32()
{
if (!m_cached_code_ptr || (m_cached_code_ptr + 4) >= m_cached_code_end)
update_code_cache();
u32 value = *reinterpret_cast<const u32*>(m_cached_code_ptr);
m_cached_code_ptr += 4;
m_eip += 4;
return value;
}
u8 SoftCPU::read_memory8(X86::LogicalAddress address)
{
ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28);