mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +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
|
@ -97,6 +97,17 @@ ValueWithShadow<u32> SoftMMU::read32(X86::LogicalAddress address)
|
|||
return region->read32(address.offset() - region->base());
|
||||
}
|
||||
|
||||
ValueWithShadow<u64> SoftMMU::read64(X86::LogicalAddress address)
|
||||
{
|
||||
auto* region = find_region(address);
|
||||
if (!region) {
|
||||
warn() << "SoftMMU::read64: No region for @" << (const void*)address.offset();
|
||||
TODO();
|
||||
}
|
||||
|
||||
return region->read64(address.offset() - region->base());
|
||||
}
|
||||
|
||||
void SoftMMU::write8(X86::LogicalAddress address, ValueWithShadow<u8> value)
|
||||
{
|
||||
auto* region = find_region(address);
|
||||
|
@ -130,6 +141,17 @@ void SoftMMU::write32(X86::LogicalAddress address, ValueWithShadow<u32> value)
|
|||
region->write32(address.offset() - region->base(), value);
|
||||
}
|
||||
|
||||
void SoftMMU::write64(X86::LogicalAddress address, ValueWithShadow<u64> value)
|
||||
{
|
||||
auto* region = find_region(address);
|
||||
if (!region) {
|
||||
warn() << "SoftMMU::write64: No region for @" << (const void*)address.offset();
|
||||
TODO();
|
||||
}
|
||||
|
||||
region->write64(address.offset() - region->base(), value);
|
||||
}
|
||||
|
||||
void SoftMMU::copy_to_vm(FlatPtr destination, const void* source, size_t size)
|
||||
{
|
||||
// FIXME: We should have a way to preserve the shadow data here as well.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue