1*fae6e9adSlinfeng use crate::arch::interrupt::TrapFrame;
2*fae6e9adSlinfeng
setup_single_step(frame: &mut TrapFrame, step_addr: usize)3*fae6e9adSlinfeng pub fn setup_single_step(frame: &mut TrapFrame, step_addr: usize) {
4*fae6e9adSlinfeng frame.set_pc(step_addr);
5*fae6e9adSlinfeng }
6*fae6e9adSlinfeng
clear_single_step(frame: &mut TrapFrame, return_addr: usize)7*fae6e9adSlinfeng pub fn clear_single_step(frame: &mut TrapFrame, return_addr: usize) {
8*fae6e9adSlinfeng frame.set_pc(return_addr);
9*fae6e9adSlinfeng }
10*fae6e9adSlinfeng
11*fae6e9adSlinfeng #[repr(C)]
12*fae6e9adSlinfeng #[derive(Debug, Copy, Clone)]
13*fae6e9adSlinfeng pub struct KProbeContext {
14*fae6e9adSlinfeng pub pc: usize,
15*fae6e9adSlinfeng pub ra: usize,
16*fae6e9adSlinfeng pub sp: usize,
17*fae6e9adSlinfeng pub gp: usize,
18*fae6e9adSlinfeng pub tp: usize,
19*fae6e9adSlinfeng pub t0: usize,
20*fae6e9adSlinfeng pub t1: usize,
21*fae6e9adSlinfeng pub t2: usize,
22*fae6e9adSlinfeng pub s0: usize,
23*fae6e9adSlinfeng pub s1: usize,
24*fae6e9adSlinfeng pub a0: usize,
25*fae6e9adSlinfeng pub a1: usize,
26*fae6e9adSlinfeng pub a2: usize,
27*fae6e9adSlinfeng pub a3: usize,
28*fae6e9adSlinfeng pub a4: usize,
29*fae6e9adSlinfeng pub a5: usize,
30*fae6e9adSlinfeng pub a6: usize,
31*fae6e9adSlinfeng pub a7: usize,
32*fae6e9adSlinfeng pub s2: usize,
33*fae6e9adSlinfeng pub s3: usize,
34*fae6e9adSlinfeng pub s4: usize,
35*fae6e9adSlinfeng pub s5: usize,
36*fae6e9adSlinfeng pub s6: usize,
37*fae6e9adSlinfeng pub s7: usize,
38*fae6e9adSlinfeng pub s8: usize,
39*fae6e9adSlinfeng pub s9: usize,
40*fae6e9adSlinfeng pub s10: usize,
41*fae6e9adSlinfeng pub s11: usize,
42*fae6e9adSlinfeng pub t3: usize,
43*fae6e9adSlinfeng pub t4: usize,
44*fae6e9adSlinfeng pub t5: usize,
45*fae6e9adSlinfeng pub t6: usize,
46*fae6e9adSlinfeng }
47*fae6e9adSlinfeng
48*fae6e9adSlinfeng impl From<&TrapFrame> for KProbeContext {
from(trap_frame: &TrapFrame) -> Self49*fae6e9adSlinfeng fn from(trap_frame: &TrapFrame) -> Self {
50*fae6e9adSlinfeng Self {
51*fae6e9adSlinfeng pc: trap_frame.epc,
52*fae6e9adSlinfeng ra: trap_frame.ra,
53*fae6e9adSlinfeng sp: trap_frame.sp,
54*fae6e9adSlinfeng gp: trap_frame.gp,
55*fae6e9adSlinfeng tp: trap_frame.tp,
56*fae6e9adSlinfeng t0: trap_frame.t0,
57*fae6e9adSlinfeng t1: trap_frame.t1,
58*fae6e9adSlinfeng t2: trap_frame.t2,
59*fae6e9adSlinfeng s0: trap_frame.s0,
60*fae6e9adSlinfeng s1: trap_frame.s1,
61*fae6e9adSlinfeng a0: trap_frame.a0,
62*fae6e9adSlinfeng a1: trap_frame.a1,
63*fae6e9adSlinfeng a2: trap_frame.a2,
64*fae6e9adSlinfeng a3: trap_frame.a3,
65*fae6e9adSlinfeng a4: trap_frame.a4,
66*fae6e9adSlinfeng a5: trap_frame.a5,
67*fae6e9adSlinfeng a6: trap_frame.a6,
68*fae6e9adSlinfeng a7: trap_frame.a7,
69*fae6e9adSlinfeng s2: trap_frame.s2,
70*fae6e9adSlinfeng s3: trap_frame.s3,
71*fae6e9adSlinfeng s4: trap_frame.s4,
72*fae6e9adSlinfeng s5: trap_frame.s5,
73*fae6e9adSlinfeng s6: trap_frame.s6,
74*fae6e9adSlinfeng s7: trap_frame.s7,
75*fae6e9adSlinfeng s8: trap_frame.s8,
76*fae6e9adSlinfeng s9: trap_frame.s9,
77*fae6e9adSlinfeng s10: trap_frame.s10,
78*fae6e9adSlinfeng s11: trap_frame.s11,
79*fae6e9adSlinfeng t3: trap_frame.t3,
80*fae6e9adSlinfeng t4: trap_frame.t4,
81*fae6e9adSlinfeng t5: trap_frame.t5,
82*fae6e9adSlinfeng t6: trap_frame.t6,
83*fae6e9adSlinfeng }
84*fae6e9adSlinfeng }
85*fae6e9adSlinfeng }
86