Expand description
Functionality to establish a sandbox’s memory layout. This module describes the virtual and physical addresses of a number of special regions in the hyperlight VM, although we hope to reduce the number of these over time.
A snapshot freshly created from an empty VM will result in roughly the following physical layout:
+—————————————––+ | Guest Page Tables | +—————————————––+ | Init Data | (GuestBlob size) +—————————————––+ | Guest Heap | +—————————————––+ | PEB Struct | (HyperlightPEB size) +—————————————––+ | Guest Code | +—————————————––+ 0x1_000 | NULL guard page | +—————————————––+ 0x0_000
Everything except for the guest page tables is currently
identity-mapped; the guest page tables themselves are mapped at
[hyperlight_common::layout::SNAPSHOT_PT_GVA] =
0xffff_8000_0000_0000.
-
InitData- some extra data that can be loaded onto the sandbox during initialization. -
GuestHeap- this is a buffer that is used for heap data in the guest. the length of this field is returned by theheap_size()method of this struct
There is also a scratch region at the top of physical memory, which is mostly laid out as a large undifferentiated blob of memory, although at present the snapshot process specially privileges the statically allocated input and output data regions:
+—————————————––+ (top of physical memory) | Exception Stack, Metadata | +—————————————––+ (1 page below) | Scratch Memory | +—————————————––+ | Output Data | +—————————————––+ | Input Data | +—————————————––+ (scratch size)