From 8e79c55717e609e92e5438f67738ebd95f27ae2e Mon Sep 17 00:00:00 2001 From: miod Date: Tue, 2 Jun 2015 04:31:53 +0000 Subject: [PATCH] Override pie range constants (well, only VM_PIE_MAX_ADDR) with a variable which value is decided at runtime, in order to only enable PIE on sun4m which has a large enough address space. --- sys/arch/sparc/include/vmparam.h | 5 ++++- sys/arch/sparc/sparc/machdep.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h index 139e61a0dcc..77d0deb2407 100644 --- a/sys/arch/sparc/include/vmparam.h +++ b/sys/arch/sparc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.45 2015/03/30 20:30:22 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.46 2015/06/02 04:31:53 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.13 1997/07/12 16:20:03 perry Exp $ */ /* @@ -121,6 +121,9 @@ extern vsize_t vm_kernel_space_size; #define VM_MIN_ADDRESS ((vaddr_t)0x2000) #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xfe000000) +extern vaddr_t vm_pie_max_addr; +#define VM_PIE_MAX_ADDR vm_pie_max_addr + #define IOSPACE_BASE VM_MAX_KERNEL_ADDRESS #define IOSPACE_LEN 0x01000000 /* 16 MB of iospace */ diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index c66a7174613..af4e4b762df 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.171 2015/03/30 20:30:22 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.172 2015/06/02 04:31:53 miod Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -100,6 +100,8 @@ #include "led.h" #endif +vaddr_t vm_pie_max_addr = 0; + struct vm_map *exec_map = NULL; struct uvm_constraint_range dma_constraint = { 0x0, (paddr_t)-1 }; @@ -188,6 +190,14 @@ cpu_startup() exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL); + /* + * Set up userland PIE limits. PIE is disabled on sun4/4c/4e due + * to the limited address space. + */ + if (CPU_ISSUN4M) { + vm_pie_max_addr = VM_MAXUSER_ADDRESS / 4; + } + dvma_init(); #ifdef DEBUG -- 2.20.1