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
use register::{cpu::RegisterReadWrite, register_bitfields};
register_bitfields! {u64,
pub TTBR1_EL1 [
ASID OFFSET(48) NUMBITS(16) [],
BADDR OFFSET(1) NUMBITS(47) [],
CnP OFFSET(0) NUMBITS(1) []
]
}
pub struct Reg;
impl RegisterReadWrite<u64, TTBR1_EL1::Register> for Reg {
sys_coproc_read_raw!(u64, "TTBR1_EL1", "x");
sys_coproc_write_raw!(u64, "TTBR1_EL1", "x");
}
impl Reg {
#[inline]
pub fn get_baddr(&self) -> u64 {
self.read(TTBR1_EL1::BADDR) << 1
}
#[inline]
pub fn set_baddr(&self, addr: u64) {
self.write(TTBR1_EL1::BADDR.val(addr >> 1));
}
}
pub static TTBR1_EL1: Reg = Reg {};