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
pub unsafe fn cr0() -> u64 {
let ret: u64;
asm!("mov %cr0, $0" : "=r" (ret));
ret
}
pub unsafe fn cr0_write(val: u64) {
asm!("mov $0, %cr0" :: "r" (val) : "memory");
}
pub unsafe fn cr2() -> u64 {
let ret: u64;
asm!("mov %cr2, $0" : "=r" (ret));
ret
}
pub unsafe fn cr3() -> u64 {
let ret: u64;
asm!("mov %cr3, $0" : "=r" (ret));
ret
}
pub unsafe fn cr3_write(val: u64) {
asm!("mov $0, %cr3" :: "r" (val) : "memory");
}
pub unsafe fn cr4() -> u64 {
let ret: u64;
asm!("mov %cr4, $0" : "=r" (ret));
ret
}
pub unsafe fn cr4_write(val: u64) {
asm!("mov $0, %cr4" :: "r" (val) : "memory");
}