summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-11-02 00:11:33 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-11-02 00:11:33 +0000
commit6608cfd13d2ef14cfeb8a3bc788b14a9b99a17b5 (patch)
tree48f728d5db86a3648e86e5d6d6240e425fc386f3
parent4b234ebfbefb6436a0f610da07d2af6e614d440b (diff)
Only mark segment 0 as executable on 64-bit systems. There it is harmless as
we have a proper X bit in the page tables. On 32-bit systems kernel .text is handled by an IBAT, so we don't need page table entries that are executable in the kernel pmap. ok mpi@
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index f8320daab92..965536022f4 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.130 2014/10/27 19:16:38 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.131 2014/11/02 00:11:32 kettenis Exp $ */
/*
* Copyright (c) 2001, 2002, 2007 Dale Rahn.
@@ -1742,11 +1742,11 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend)
ppc_mtsrin(PPC_KERNEL_SEG0 + i, i << ADDR_SR_SHIFT);
}
- /* first segment contains executable pages */
- pmap_kernel()->pm_exec[0]++;
- pmap_kernel()->pm_sr[0] &= ~SR_NOEXEC;
-
if (ppc_proc_is_64b) {
+ /* first segment contains executable pages */
+ pmap_kernel()->pm_exec[0]++;
+ pmap_kernel()->pm_sr[0] &= ~SR_NOEXEC;
+
asm volatile ("sync; mtsdr1 %0; isync"
:: "r"((u_int)pmap_ptable64 | HTABSIZE_64));
} else