Avoid many instances of dynamic allocation #114
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patchset make some significant changes to the allocation layout
of Mythril. Now, instead of heap allocation of devices and virtual
machines, these are allocated in the following way:
There is a static 'VirtualMachineSet' object that contains a list
of virtual machines and associated message passing contexts. This
structure is how inter-core and inter-vm communication occurs. Each
'VirtualMachine' now contains an ArrayVec of 'DynamicVirtualDevice'.
A 'DynamicVirtualDevice' is a wrapper around various EmulatedDevice
types that are not part of the required guest architecture. For
example, a given PCI device is 'dynamic' in the sense that we cannot
state that it is part of the guest at compile time.
Non-dynamic EmulatedDevices are now stored explicitly as part of the
'StaticVirtualDevices' field of the 'VirtualMachine'. This makes it
significantly easier to reference a particular part of the guest
architecture (rather than having to look up a device by Port, for
example).
I also removed the stub EmulatedDevices we had and just started
ignoring the portio operations that are mapped to devices we don't
emulate. I believe this is the right move, architecturally. It may not
be the correct thing to do for memory mapped devices, but they
should trigger an EPT violation anyway.