indicogniBuild a VMM

Lab

repr(C) layout

Used in chapter 01.

Type a Rust struct and see where each field lands, where the padding goes, and whether it matches the C struct in the header.

Runs in browser
Layout of hv_vcpu_exit_t, 32 bytes Four rows of 8 bytes. Row 0x00: reason, a 32-bit value in bytes 0 to 3, then 4 bytes of padding in bytes 4 to 7. Row 0x08: exception.syndrome, 64 bits. Row 0x10: exception.virtual_address, 64 bits. Row 0x18: exception.physical_address, 64 bits. Offsets 0, 8, 16 and 24; 32 bytes in all. hv_vcpu_exit_t: offsets 0, 8, 16, 24; size 32 0x00 0x08 0x10 0x18 reason (u32) pad exception.syndrome (u64) exception.virtual_address (u64) exception.physical_address (u64) C puts 4 bytes of padding after reason so that the next 64-bit field starts at a multiple of 8.

All labs