mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
UE+LibX86: Support bigger reads and writes
This commit is contained in:
parent
a99812633b
commit
f1957bb86b
11 changed files with 316 additions and 4 deletions
|
@ -129,6 +129,40 @@ ValueWithShadow<u64> MmapRegion::read64(u32 offset)
|
|||
return { *reinterpret_cast<const u64*>(m_data + offset), *reinterpret_cast<const u64*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
ValueWithShadow<u128> MmapRegion::read128(u32 offset)
|
||||
{
|
||||
if (!is_readable()) {
|
||||
reportln("128-bit read from unreadable MmapRegion @ {:p}", base() + offset);
|
||||
emulator().dump_backtrace();
|
||||
TODO();
|
||||
}
|
||||
|
||||
if (is_malloc_block()) {
|
||||
if (auto* tracer = emulator().malloc_tracer())
|
||||
tracer->audit_read(*this, base() + offset, 16);
|
||||
}
|
||||
|
||||
VERIFY(offset + 15 < size());
|
||||
return { *reinterpret_cast<const u128*>(m_data + offset), *reinterpret_cast<const u128*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
ValueWithShadow<u256> MmapRegion::read256(u32 offset)
|
||||
{
|
||||
if (!is_readable()) {
|
||||
reportln("256-bit read from unreadable MmapRegion @ {:p}", base() + offset);
|
||||
emulator().dump_backtrace();
|
||||
TODO();
|
||||
}
|
||||
|
||||
if (is_malloc_block()) {
|
||||
if (auto* tracer = emulator().malloc_tracer())
|
||||
tracer->audit_read(*this, base() + offset, 32);
|
||||
}
|
||||
|
||||
VERIFY(offset + 31 < size());
|
||||
return { *reinterpret_cast<const u256*>(m_data + offset), *reinterpret_cast<const u256*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value)
|
||||
{
|
||||
if (!is_writable()) {
|
||||
|
@ -203,6 +237,44 @@ void MmapRegion::write64(u32 offset, ValueWithShadow<u64> value)
|
|||
*reinterpret_cast<u64*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
void MmapRegion::write128(u32 offset, ValueWithShadow<u128> value)
|
||||
{
|
||||
if (!is_writable()) {
|
||||
reportln("128-bit write from unwritable MmapRegion @ {:p}", base() + offset);
|
||||
emulator().dump_backtrace();
|
||||
TODO();
|
||||
}
|
||||
|
||||
if (is_malloc_block()) {
|
||||
if (auto* tracer = emulator().malloc_tracer())
|
||||
tracer->audit_write(*this, base() + offset, 16);
|
||||
}
|
||||
|
||||
VERIFY(offset + 15 < size());
|
||||
VERIFY(m_data != m_shadow_data);
|
||||
*reinterpret_cast<u128*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u128*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
void MmapRegion::write256(u32 offset, ValueWithShadow<u256> value)
|
||||
{
|
||||
if (!is_writable()) {
|
||||
reportln("256-bit write from unwritable MmapRegion @ {:p}", base() + offset);
|
||||
emulator().dump_backtrace();
|
||||
TODO();
|
||||
}
|
||||
|
||||
if (is_malloc_block()) {
|
||||
if (auto* tracer = emulator().malloc_tracer())
|
||||
tracer->audit_write(*this, base() + offset, 32);
|
||||
}
|
||||
|
||||
VERIFY(offset + 31 < size());
|
||||
VERIFY(m_data != m_shadow_data);
|
||||
*reinterpret_cast<u256*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u256*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::split_at(VirtualAddress offset)
|
||||
{
|
||||
VERIFY(!m_malloc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue