mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:28:12 +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
|
@ -70,6 +70,12 @@ ValueWithShadow<u32> SharedBufferRegion::read32(u32 offset)
|
|||
return { *reinterpret_cast<const u32*>(m_data + offset), *reinterpret_cast<const u32*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
ValueWithShadow<u64> SharedBufferRegion::read64(u32 offset)
|
||||
{
|
||||
ASSERT(offset + 7 < size());
|
||||
return { *reinterpret_cast<const u64*>(m_data + offset), *reinterpret_cast<const u64*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
void SharedBufferRegion::write8(u32 offset, ValueWithShadow<u8> value)
|
||||
{
|
||||
ASSERT(offset < size());
|
||||
|
@ -91,6 +97,13 @@ void SharedBufferRegion::write32(u32 offset, ValueWithShadow<u32> value)
|
|||
*reinterpret_cast<u32*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
void SharedBufferRegion::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();
|
||||
}
|
||||
|
||||
int SharedBufferRegion::allow_all()
|
||||
{
|
||||
return syscall(SC_shbuf_allow_all, m_shbuf_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue