summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/include
diff options
context:
space:
mode:
authorchs <chs@NetBSD.org>2003-08-24 17:52:28 +0000
committerchs <chs@NetBSD.org>2003-08-24 17:52:28 +0000
commit939df36e552ea9012b7b0d0d15080f894ebaaaff (patch)
tree2c4be187b10b4d03eedeccd43a6ba2359fa195e0 /sys/arch/alpha/include
parent4b28d28d7028d98186f61c78a41660eb73edde00 (diff)
add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes fall into two basic catagories: - pmap and trap-handler changes. these are all MD: = alpha: we already track per-page execute permission with the (software) PG_EXEC bit, so just have the trap handler pay attention to it. = i386: use a new GDT segment for %cs for processes that have no executable mappings above a certain threshold (currently the bottom of the stack). track per-page execute permission with the last unused PTE bit. = powerpc/ibm4xx: just use the hardware exec bit. = powerpc/oea: we already track per-page exec bits, but the hardware only implements non-exec mappings at the segment level. so track the number of executable mappings in each segment and turn on the no-exec segment bit iff the count is 0. adjust the trap handler to deal. = sparc (sun4m): fix our use of the hardware protection bits. fix the trap handler to recognize text faults. = sparc64: split the existing unified TSB into data and instruction TSBs, and only load TTEs into the appropriate TSB(s) for the permissions. fix the trap handler to check for execute permission. = not yet implemented: amd64, hppa, sh5 - changes in all the emulations that put a signal trampoline on the stack. instead, we now put the trampoline into a uvm_aobj and map that into the process separately. originally from openbsd, adapted for netbsd by me.
Diffstat (limited to 'sys/arch/alpha/include')
-rw-r--r--sys/arch/alpha/include/pmap.h7
-rw-r--r--sys/arch/alpha/include/pte.h6
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h
index ee2b255d34d..f8e7b318fe0 100644
--- a/sys/arch/alpha/include/pmap.h
+++ b/sys/arch/alpha/include/pmap.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.62 2003/08/07 16:26:33 agc Exp $ */
+/* $NetBSD: pmap.h,v 1.63 2003/08/24 17:52:30 chs Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -258,9 +258,8 @@ boolean_t pmap_pageidlezero(paddr_t);
paddr_t vtophys(vaddr_t);
/* Machine-specific functions. */
-void pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids);
-void pmap_emulate_reference(struct lwp *p, vaddr_t v,
- int user, int write);
+void pmap_bootstrap(paddr_t, u_int, u_long);
+int pmap_emulate_reference(struct lwp *, vaddr_t, int, int);
#ifdef _PMAP_MAY_USE_PROM_CONSOLE
int pmap_uses_prom_console(void);
#endif
diff --git a/sys/arch/alpha/include/pte.h b/sys/arch/alpha/include/pte.h
index e2be9a58f35..a08be807a43 100644
--- a/sys/arch/alpha/include/pte.h
+++ b/sys/arch/alpha/include/pte.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.27 2002/10/14 05:11:23 chs Exp $ */
+/* $NetBSD: pte.h,v 1.28 2003/08/24 17:52:30 chs Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -98,12 +98,12 @@ typedef alpha_pt_entry_t pt_entry_t;
#define PG_URE ALPHA_PTE_UR
#define PG_KWE ALPHA_PTE_KW
#define PG_UWE ALPHA_PTE_UW
-#define PG_PROT ALPHA_PTE_PROT
+#define PG_PROT (ALPHA_PTE_PROT | PG_EXEC | PG_FOE)
#define PG_RSVD 0x000000000000cc80 /* Reserved for hardware */
#define PG_WIRED 0x0000000000010000 /* Wired. [SOFTWARE] */
#define PG_PVLIST 0x0000000000020000 /* on pv list [SOFTWARE] */
#define PG_EXEC 0x0000000000040000 /* execute perms [SOFTWARE] */
-#define PG_FRAME ALPHA_PTE_RAME
+#define PG_FRAME ALPHA_PTE_PFN
#define PG_SHIFT 32
#define PG_PFNUM(x) ALPHA_PTE_TO_PFN(x)