Skip to main content

Module side

Module side 

Source
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:

FieldWhy
cs, cplthe privilege level: CS bits 1:0 (= CPL in a stable state)
cr3which page table (process) the instruction ran under
physical_pc, and per access physical / physical_endguest-physical addresses
bytes, lenthe exact instruction (opcode and operands), not just MacSim’s opcode category
vcpu, global_seq, local_seqwhich core, and the per-core and global order
every access, with in_macsimthe .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§

SideAccess
One access in a sideband entry.
SideEntry
One sideband entry: the extra facts about one MacSim record.
SideReader
Reads a sideband file.
SideWriter
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 .raw record (ld_vaddr1, ld_vaddr2 or st_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 name base.