summaryrefslogtreecommitdiff
path: root/src/arch/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/amd64')
-rw-r--r--src/arch/amd64/paging.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/arch/amd64/paging.c b/src/arch/amd64/paging.c
index 3ea79f1..18eb079 100644
--- a/src/arch/amd64/paging.c
+++ b/src/arch/amd64/paging.c
@@ -88,6 +88,8 @@ load_pml4(
void *phys
) {
static struct pte *pt = &paging_pt[0];
+ if ((uint64_t)phys >> 12 == pt->address)
+ return;
pt->address = (uint64_t)phys >> 12;
pt->flags = F_PRESENT | F_WRITEABLE;
invlpg(pml4_mapped);
@@ -98,6 +100,8 @@ load_pdpt(
void *phys
) {
static struct pte *pt = &paging_pt[1];
+ if ((uint64_t)phys >> 12 == pt->address)
+ return;
pt->address = (uint64_t)phys >> 12;
pt->flags = F_PRESENT | F_WRITEABLE;
invlpg(pdpt_mapped);
@@ -108,6 +112,8 @@ load_pd(
void *phys
) {
static struct pte *pt = &paging_pt[2];
+ if ((uint64_t)phys >> 12 == pt->address)
+ return;
pt->address = (uint64_t)phys >> 12;
pt->flags = F_PRESENT | F_WRITEABLE;
invlpg(pdpt_mapped);
@@ -118,6 +124,8 @@ load_pt(
void *phys
) {
static struct pte *pt = &paging_pt[3];
+ if ((uint64_t)phys >> 12 == pt->address)
+ return;
pt->address = (uint64_t)phys >> 12;
pt->flags = F_PRESENT | F_WRITEABLE;
invlpg(pt_mapped);