Expand description
The MacSim sideband: everything a MacSim .raw record has no room
for, one entry per record, in the same order.
MacSim’s x86 record (80 bytes, crate::macsim) was designed for one
user process traced by Pin. A full-system trace needs more per
instruction, and changing the record would break MacSim’s reader. So
next to trace_<vcpu>.raw the tracer writes trace_<vcpu>.side:
| Field | Why |
|---|---|
cs, cpl | the privilege level: CS bits 1:0 (= CPL in a stable state) |
cr3 | which page table (process) the instruction ran under |
physical_pc, and per access physical / physical_end | guest-physical addresses |
bytes, len | the exact instruction (opcode and operands), not just MacSim’s opcode category |
vcpu, global_seq, local_seq | which core, and the per-core and global order |
every access, with in_macsim | the .raw record holds at most 2 loads + 1 store; this list holds all of them, marking the ones the record has |
Entry k of trace_<v>.side describes record k of trace_<v>.raw
(raw_index = k, checked by the readers). The layout is fixed and
little-endian; macsim/kvmtrace_side.h gives the same structs in C for
use inside MacSim, and a test checks the C offsets against this module.
file = "KVTSIDE\0" u32:version(=1) u32:vcpu u32:entry_size(=72) u32:access_size(=32) entry*
entry = raw_index:u64 global_seq:u64 local_seq:u64 cr3:u64 physical_pc:u64
cs:u16 flags:u16 cpl:u8 mode:u8 outcome:u8 vector:u8 len:u8 bytes:[u8;15]
vcpu:u32 n_access:u16 reserved:u16 (72 bytes)
access*n_access
access = linear:u64 physical:u64 physical_end:u64 size:u32 kind:u8 class:u8 outcome:u8 flags:u8 (32 bytes)Unknown physical addresses are u64::MAX.
Structs§
- Side
Access - One access in a sideband entry.
- Side
Entry - One sideband entry: the extra facts about one MacSim record.
- Side
Reader - Reads a sideband file.
- Side
Writer - Writes one vCPU’s sideband.
Constants§
- ACCESS_
CONDITIONAL - Access flag: the access depends on a condition or mask.
- ACCESS_
IN_ MACSIM - Access flag: the access is one of those in the
.rawrecord (ld_vaddr1,ld_vaddr2orst_vaddr). - ACCESS_
SIZE - Bytes per access.
- ENTRY_
SIZE - Bytes in an entry header.
- MAGIC
- File magic.
- NO_PHYS
- “Unknown” physical address.
- VERSION
- Format version.
Functions§
- side_
path - Path of vCPU
tid’s sideband file for trace base namebase.