kh_runtime/cpu/regs.rs
1//! Guest AArch64 thread register snapshot (Darwin ABI conventions later).
2
3/// General-purpose and control registers for one guest thread.
4///
5/// Layout is filled in when micro-execution lands; fields exist so the CLI and
6/// loader can share a stable type early.
7#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
8pub struct ThreadRegs {
9 /// `x0`–`x30` (LR in `x[30]`).
10 pub x: [u64; 31],
11 /// Stack pointer.
12 pub sp: u64,
13 /// Program counter.
14 pub pc: u64,
15 /// Process state (`PSTATE` / `NZCV` subset as needed later).
16 pub pstate: u64,
17}
18
19impl ThreadRegs {
20 /// Creates a zeroed register file.
21 #[inline]
22 pub const fn new() -> Self {
23 Self {
24 x: [0; 31],
25 sp: 0,
26 pc: 0,
27 pstate: 0,
28 }
29 }
30}