diff options
author | 2019-01-02 12:27:12 +0100 | |
---|---|---|
committer | 2019-01-02 19:17:25 +0100 | |
commit | 88099ed80ebdf89115f649105a1aee3a2c716a50 (patch) | |
tree | f097d2fa4a02396547233fa0c8087b89940514d6 /src | |
parent | a0ebbd3cc50d2a7e41b91ddb1cfaf7b9850ad8c7 (diff) | |
download | rust-x86-88099ed80ebdf89115f649105a1aee3a2c716a50.tar.gz rust-x86-88099ed80ebdf89115f649105a1aee3a2c716a50.tar.zst rust-x86-88099ed80ebdf89115f649105a1aee3a2c716a50.zip |
add cr2_write, for example to reset CR2
Diffstat (limited to 'src')
-rw-r--r-- | src/controlregs.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/controlregs.rs b/src/controlregs.rs index b09a48a..1445eab 100644 --- a/src/controlregs.rs +++ b/src/controlregs.rs @@ -77,6 +77,11 @@ pub unsafe fn cr2() -> usize { ret } +/// Write cr2, for instance to reset cr2 +pub unsafe fn cr2_write(val: u64) { + asm!("mov $0, %cr2" :: "r" (val) : "memory"); +} + /// Contains page-table root pointer. pub unsafe fn cr3() -> u64 { let ret: u64; |