aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2021-12-10 23:29:21 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2021-12-10 23:29:21 +0100
commitf521b3ea4ce83725075ed049af14b006bed8033c (patch)
tree1e2feb5abd3b4fc0c6a18969e17162cbf571c7f7
parentfb6b634de37e38fd1821f2cf9228df176f9526f5 (diff)
downloadmini-kvm-rs-f521b3ea4ce83725075ed049af14b006bed8033c.tar.gz
mini-kvm-rs-f521b3ea4ce83725075ed049af14b006bed8033c.zip
example:long_mode: Map guest software page readonly.
-rw-r--r--examples/long_mode.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/long_mode.rs b/examples/long_mode.rs
index 0696ae4..01b3f53 100644
--- a/examples/long_mode.rs
+++ b/examples/long_mode.rs
@@ -95,7 +95,8 @@ fn setup_long_mode_4level_paging(mem: &mut UserMem) -> PhysAddr {
w(PhysAddr(0x2000), PAGE_ENTRY_PRESENT | PAGE_RENTRY_RW | 0x3000);
// PTE[0] maps Virt [0x0000:0x0fff] -> Phys [0x4000:0x4fff].
- w(PhysAddr(0x3000), PAGE_ENTRY_PRESENT | PAGE_RENTRY_RW | 0x4000);
+ // Just because we can, map this page readonly, as we loaded our guest sw here.
+ w(PhysAddr(0x3000), PAGE_ENTRY_PRESENT | 0x4000);
// PTE[1] maps Virt [0x1000:0x1fff] -> Phys [0x5000:0x5fff].
w(PhysAddr(0x3008), PAGE_ENTRY_PRESENT | PAGE_RENTRY_RW | 0x5000);
// PTE[2] maps Virt [0x2000:0x2fff] -> Phys [0x6000:0x6fff].