1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#![allow(non_camel_case_types)]
use core::ptr::null_mut;
#[repr(C)]
#[repr(align(4096))]
#[derive(Clone)]
pub struct TrapFrame {
pub regs: [usize; 32],
pub fregs: [usize; 32],
pub satp: usize,
pub sp: usize,
pub hartid: usize,
pub trap: usize,
pub epc: usize
}
impl TrapFrame {
pub const fn zero() -> Self {
TrapFrame {
regs: [0; 32],
fregs: [0; 32],
satp: 0,
sp: 0,
hartid: 0,
trap: 0,
epc: 0
}
}
}
pub enum Register {
zero = 0,
ra = 1,
sp = 2,
gp = 3,
tp = 4,
t0 = 5,
t1 = 6,
t2 = 7,
s0 = 8,
s1 = 9,
a0 = 10,
a1 = 11,
a2 = 12,
a3 = 13,
a4 = 14,
a5 = 15,
a6 = 16,
a7 = 17
}