mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:35:09 +00:00
UserspaceEmulator+LibX86: Add support for 64-bit memory reads and writes (#3584)
This is useful for reading and writing doubles for #3329. It is also useful for emulating 64-bit binaries. MemoryOrRegisterReference assumes that 64-bit values are always memory references since that's enough for fpu support. If we ever want to emulate 64-bit binaries, that part will need minor updating.
This commit is contained in:
parent
1fa5a526e8
commit
f1c0f661f4
12 changed files with 156 additions and 0 deletions
|
@ -61,6 +61,12 @@ ValueWithShadow<u32> SimpleRegion::read32(u32 offset)
|
|||
return { *reinterpret_cast<const u32*>(m_data + offset), *reinterpret_cast<const u32*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
ValueWithShadow<u64> SimpleRegion::read64(u32 offset)
|
||||
{
|
||||
ASSERT(offset + 7 < size());
|
||||
return { *reinterpret_cast<const u64*>(m_data + offset), *reinterpret_cast<const u64*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
void SimpleRegion::write8(u32 offset, ValueWithShadow<u8> value)
|
||||
{
|
||||
ASSERT(offset < size());
|
||||
|
@ -82,6 +88,13 @@ void SimpleRegion::write32(u32 offset, ValueWithShadow<u32> value)
|
|||
*reinterpret_cast<u32*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
void SimpleRegion::write64(u32 offset, ValueWithShadow<u64> value)
|
||||
{
|
||||
ASSERT(offset + 7 < size());
|
||||
*reinterpret_cast<u64*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u64*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
u8* SimpleRegion::cacheable_ptr(u32 offset)
|
||||
{
|
||||
return m_data + offset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue