1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +00:00

UserspaceEmulator: Make it possible to wrap PODs in ValueWithShadow

Instead of making it hold the shadow data as another `T`, make it hold
the data as a byte array, and allow it to read the byte array as `T`.
This makes it much easier to make a "read_typed" function in the MMU.
This commit is contained in:
Ali Mohammad Pur 2022-02-27 23:56:46 +03:30 committed by Andreas Kling
parent e08cf8f554
commit f6e82a8e0a
7 changed files with 115 additions and 101 deletions

View file

@ -347,7 +347,7 @@ bool SoftMMU::fast_fill_memory8(X86::LogicalAddress address, size_t size, ValueW
size_t offset_in_region = address.offset() - region->base();
memset(region->data() + offset_in_region, value.value(), size);
memset(region->shadow_data() + offset_in_region, value.shadow(), size);
memset(region->shadow_data() + offset_in_region, value.shadow()[0], size);
return true;
}
@ -372,7 +372,7 @@ bool SoftMMU::fast_fill_memory32(X86::LogicalAddress address, size_t count, Valu
size_t offset_in_region = address.offset() - region->base();
fast_u32_fill((u32*)(region->data() + offset_in_region), value.value(), count);
fast_u32_fill((u32*)(region->shadow_data() + offset_in_region), value.shadow(), count);
fast_u32_fill((u32*)(region->shadow_data() + offset_in_region), value.shadow_as_value(), count);
return true;
}