summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2011-08-31 02:10:05 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2011-08-31 02:10:05 +0200
commitfa57c51ac74a8301db7ab8b2fc9cbd63d69d26b3 (patch)
treebbe466379fb371715c43700baabf5b66012e8577 /i386
parent317e678d6d0bff1be16383a6ef9d914f28aebb74 (diff)
Disable global page while writing in kernel space
* i386/i386/db_interface.c (db_write_bytes): If CPU has PGE feature, disable CR4_PGE before enabling kernel page write access, and re-enable the former after disabling the latter.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/db_interface.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index d149adc..c07884d 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -39,6 +39,7 @@
#include <i386/setjmp.h>
#include <i386/pmap.h>
#include <i386/proc_reg.h>
+#include <i386/locore.h>
#include "gdt.h"
#include "trap.h"
@@ -390,6 +391,8 @@ db_write_bytes(
oldmap1 = *ptep1;
*ptep1 |= INTEL_PTE_WRITE;
}
+ if (CPU_HAS_FEATURE(CPU_FEATURE_PGE))
+ set_cr4(get_cr4() & ~CR4_PGE);
flush_tlb();
}
@@ -404,6 +407,8 @@ db_write_bytes(
*ptep1 = oldmap1;
}
flush_tlb();
+ if (CPU_HAS_FEATURE(CPU_FEATURE_PGE))
+ set_cr4(get_cr4() | CR4_PGE);
}
}