1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +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

@ -6,6 +6,7 @@
#include "MmapRegion.h"
#include "Emulator.h"
#include <AK/ByteReader.h>
#include <string.h>
#include <sys/mman.h>
@ -196,7 +197,7 @@ void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value)
VERIFY(offset < size());
m_data[offset] = value.value();
m_shadow_data[offset] = value.shadow();
m_shadow_data[offset] = value.shadow()[0];
}
void MmapRegion::write16(u32 offset, ValueWithShadow<u16> value)