Closed mnemonikr closed 8 months ago
A complication is the load
and store
functions in the Emulator reference the address space by space id. In order to construct the Address
for the VarnodeData
we need the AddressSpace
. We currently fetch that object using the address spaces passed to Memory
at initialization:
Now arguably to read and write we only need the following:
Now in this special case, we are guaranteed that the address space is not one that requires special handling (e.g. constant address space). But to address that more cleanly, it might make sense to move that special handling outside of Memory
entirely.
In addition to the address space id, we also need the address size of the loaded address space. We weren't ensuring this constraint was held previously.
Faking the address space for load
and store
seems like a bad idea. The right thing to do would be to either perform a Sleigh query from the emulator to load the Address Space data, or cache the full set of address spaces in the emulator. Which we already do in the emulator, we just pass it directly to the memory module.
We could stop doing that and just store it in the emulator directly instead.
Resolved in #92 . Address spaces are now cached in the Emulator
.
It would be simpler to allow reading and writing to arbitrary address spaces. If reading from an address space that's never been provided, clearly no data. This allows returning
UndefinedData
instead of needing the specialized errorUnknownAddressSpace
.If writing to an address space for the first time, create it on demand.