| 1 |
|
| 2 |
const NT_ARM_HW_BREAK: i32 = 0x402; |
| 3 |
const NT_ARM_HW_WATCH: i32 = 0x403; |
| 4 |
|
| 5 |
pub type DebugRegisters = user_hwdebug_state; |
| 6 |
|
| 7 |
|
| 8 |
#[cfg(target_arch = "aarch64")] |
| 9 |
#[repr(C)] |
| 10 |
#[derive(Clone, Copy, Debug)] |
| 11 |
pub struct user_pt_regs { |
| 12 |
pub regs: [u64; 31], |
| 13 |
pub sp: u64, |
| 14 |
pub pc: u64, |
| 15 |
pub pstate: u64 |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
#[cfg(target_arch = "aarch64")] |
| 20 |
#[repr(C)] |
| 21 |
#[derive(Clone, Copy, Debug)] |
| 22 |
pub struct user_hwdebug_state_reg { |
| 23 |
pub addr: u64, |
| 24 |
pub ctrl: u32, |
| 25 |
pad: u32, |
| 26 |
} |
| 27 |
|
| 28 |
#[cfg(target_arch = "aarch64")] |
| 29 |
impl user_hwdebug_state_reg { |
| 30 |
pub fn new() -> Self { |
| 31 |
Self { |
| 32 |
addr: 0, |
| 33 |
ctrl: 0, |
| 34 |
pad: 0, |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
#[cfg(target_arch = "aarch64")] |
| 40 |
#[repr(i32)] |
| 41 |
#[derive(Copy, Clone)] |
| 42 |
pub enum DebugRegisterType { |
| 43 |
Break = NT_ARM_HW_BREAK, |
| 44 |
Watch = NT_ARM_HW_WATCH, |
| 45 |
} |
| 46 |
|
| 47 |
#[cfg(target_arch = "aarch64")] |
| 48 |
#[repr(C)] |
| 49 |
#[derive(Clone, Copy, Debug)] |
| 50 |
pub struct user_hwdebug_state { |
| 51 |
pub dbg_info: u32, |
| 52 |
pad: u32, |
| 53 |
pub dbg_regs: [user_hwdebug_state_reg; 4], |
| 54 |
} |
| 55 |
|
| 56 |
#[cfg(target_arch = "aarch64")] |
| 57 |
impl user_hwdebug_state { |
| 58 |
pub fn new() -> Self { |
| 59 |
Self { |
| 60 |
dbg_info: 0, |
| 61 |
pad: 0, |
| 62 |
dbg_regs: [user_hwdebug_state_reg::new(); 4], |
| 63 |
} |
| 64 |
} |
| 65 |
} |