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
//! Architecture-specific primitives for 32-bit Arm.

pub mod interrupt;


#[macro_export]
#[doc(hidden)]
macro_rules! cp15_register_get {
    [$op_1:literal, $cr_n:literal, $cr_m:literal, $op_2:literal] => {
        {
            let mut value: usize;
            unsafe {
                core::arch::asm!(
                    concat!(
                        "mrc p15, ",
                        $op_1,
                        ", {}, ",
                        $cr_n,
                        ", ",
                        $cr_m,
                        ", ",
                        $op_2,
                    ),
                    out(reg) value,
                );
            }
            value
        }
    }
}

#[macro_export]
#[doc(hidden)]
macro_rules! cp15_register_set {
    [$op_1:literal, $cr_n:literal, $cr_m:literal, $op_2:literal, $value:expr] => {
        {
            let value: usize = $value;
            core::arch::asm!(
                concat!(
                    "mcr p15, ",
                    $op_1,
                    ", {}, ",
                    $cr_n,
                    ", ",
                    $cr_m,
                    ", ",
                    $op_2,
                ),
                in(reg) value,
            );
        }
    }
}