Port-hp700 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
topdown-vm for hppa
hi folks,
the first attached patch enables __USE_TOPDOWN_VM for hppa
and also moves the stack up to the top of the user address space,
which makes the space available to applications more contiguous.
does anyone see any problem with this?
the second patch fixes setrlimit(RLIM_STACK) for stack-grows-up,
which wasn't causing a problem with the stack out in the middle
of the address space all by its lonesome, but is much more noticable
with the stack and shlib mappings next to each other up at the top.
-Chuck
Index: src/sys/arch/hppa/include/pmap.h
===================================================================
RCS file: /home/chs/netbsd/cvs/src/sys/arch/hppa/include/pmap.h,v
retrieving revision 1.36
diff -u -p -r1.36 pmap.h
--- src/sys/arch/hppa/include/pmap.h 6 Jan 2012 20:55:28 -0000 1.36
+++ src/sys/arch/hppa/include/pmap.h 8 Dec 2012 14:37:49 -0000
@@ -118,13 +118,23 @@ static inline paddr_t hppa_unmap_poolpag
* according to the parisc manual aliased va's should be
* different by high 12 bits only.
*/
-#define PMAP_PREFER(o,h,s,td) do {
\
- vaddr_t pmap_prefer_hint; \
- pmap_prefer_hint = (*(h) & HPPA_PGAMASK) | ((o) & HPPA_PGAOFF); \
- if (pmap_prefer_hint < *(h)) \
- pmap_prefer_hint += HPPA_PGALIAS; \
- *(h) = pmap_prefer_hint; \
-} while(0)
+#define PMAP_PREFER(o,h,s,td) pmap_prefer((o), (h), (td))
+
+static inline void
+pmap_prefer(vaddr_t fo, vaddr_t *va, int td)
+{
+ vaddr_t newva;
+
+ newva = (*va & HPPA_PGAMASK) | (fo & HPPA_PGAOFF);
+ if (td) {
+ if (newva > *va)
+ newva -= HPPA_PGALIAS;
+ } else {
+ if (newva < *va)
+ newva += HPPA_PGALIAS;
+ }
+ *va = newva;
+}
#define pmap_sid2pid(s) (((s) + 1) << 1)
#define pmap_resident_count(pmap)
((pmap)->pm_stats.resident_count)
Index: src/sys/arch/hppa/include/vmparam.h
===================================================================
RCS file: /home/chs/netbsd/cvs/src/sys/arch/hppa/include/vmparam.h,v
retrieving revision 1.19
diff -u -p -r1.19 vmparam.h
--- src/sys/arch/hppa/include/vmparam.h 16 Nov 2010 09:34:24 -0000 1.19
+++ src/sys/arch/hppa/include/vmparam.h 8 Dec 2012 15:44:30 -0000
@@ -28,6 +28,8 @@
#ifndef _HPPA_VMPARAM_H_
#define _HPPA_VMPARAM_H_
+#define __USE_TOPDOWN_VM
+
/*
* Machine dependent constants for HP PA
*/
@@ -43,8 +45,8 @@
/*
* USRSTACK is the bottom (start) of the user stack.
*/
-#define USRSTACK 0x70000000 /* Start of user stack
*/
-#define SYSCALLGATE 0xC0000000 /* syscall gateway page
*/
+#define USRSTACK (VM_MAXUSER_ADDRESS - MAXSSIZ) /* Start of user
stack */
+#define SYSCALLGATE 0xc0000000 /* syscall gateway page
*/
/*
* Virtual memory related constants, all in bytes
Index: src/sys/kern/kern_resource.c
===================================================================
RCS file: /home/chs/netbsd/cvs/src/sys/kern/kern_resource.c,v
retrieving revision 1.170
diff -u -p -r1.170 kern_resource.c
--- src/sys/kern/kern_resource.c 3 Nov 2012 23:22:22 -0000 1.170
+++ src/sys/kern/kern_resource.c 8 Dec 2012 15:41:45 -0000
@@ -409,20 +409,21 @@ dosetrlimit(struct lwp *l, struct proc *
vaddr_t addr;
vsize_t size;
vm_prot_t prot;
+ char *base, *tmp;
+ base = p->p_vmspace->vm_minsaddr;
if (limp->rlim_cur > alimp->rlim_cur) {
prot = VM_PROT_READ | VM_PROT_WRITE;
size = limp->rlim_cur - alimp->rlim_cur;
- addr = (vaddr_t)p->p_vmspace->vm_minsaddr -
- limp->rlim_cur;
+ tmp = STACK_GROW(base, alimp->rlim_cur);
} else {
prot = VM_PROT_NONE;
size = alimp->rlim_cur - limp->rlim_cur;
- addr = (vaddr_t)p->p_vmspace->vm_minsaddr -
- alimp->rlim_cur;
+ tmp = STACK_GROW(base, limp->rlim_cur);
}
+ addr = (vaddr_t)STACK_ALLOC(tmp, size);
(void) uvm_map_protect(&p->p_vmspace->vm_map,
- addr, addr+size, prot, false);
+ addr, addr + size, prot, false);
}
break;
Home |
Main Index |
Thread Index |
Old Index