Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/sys/arch/vax/vax Pull up revision 1.73 (requested by th...
details: https://anonhg.NetBSD.org/src/rev/9cf2f255a265
branches: netbsd-1-6
changeset: 529641:9cf2f255a265
user: he <he%NetBSD.org@localhost>
date: Sun Dec 01 22:35:03 2002 +0000
description:
Pull up revision 1.73 (requested by thorpej in ticket #878):
Record stack growth, done inline to avoid another function
call on every user page fault.
diffstat:
sys/arch/vax/vax/trap.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diffs (74 lines):
diff -r 60e2de3eb976 -r 9cf2f255a265 sys/arch/vax/vax/trap.c
--- a/sys/arch/vax/vax/trap.c Sun Dec 01 22:26:32 2002 +0000
+++ b/sys/arch/vax/vax/trap.c Sun Dec 01 22:35:03 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.70 2002/04/29 01:54:11 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.70.4.1 2002/12/01 22:35:03 he Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -146,9 +146,11 @@
u_int rv, addr, umode;
struct proc *p = curproc;
u_quad_t oticks = 0;
+ struct vmspace *vm;
struct vm_map *map;
vm_prot_t ftype;
-
+ vsize_t nss;
+
uvmexp.traps++;
if ((umode = USERMODE(frame))) {
type |= T_USER;
@@ -224,10 +226,13 @@
* bother doing it here.
*/
addr = trunc_page(frame->code);
- if ((umode == 0) && (frame->code < 0))
+ if ((umode == 0) && (frame->code < 0)) {
+ vm = NULL;
map = kernel_map;
- else
- map = &p->p_vmspace->vm_map;
+ } else {
+ vm = p->p_vmspace;
+ map = &vm->vm_map;
+ }
if (frame->trap & T_WRITE)
ftype = VM_PROT_WRITE;
@@ -238,6 +243,21 @@
KERNEL_PROC_LOCK(p);
else
KERNEL_LOCK(LK_CANRECURSE|LK_EXCLUSIVE);
+
+ nss = 0;
+ if (map != kernel_map &&
+ (caddr_t)addr >= vm->vm_maxsaddr &&
+ (caddr_t)addr < (caddr_t)USRSTACK) {
+ nss = btoc(USRSTACK - addr);
+ if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) {
+ /*
+ * Set nss to 0, since this case is not
+ * a "stack extension".
+ */
+ nss = 0;
+ }
+ }
+
rv = uvm_fault(map, addr, 0, ftype);
if (rv != 0) {
if (umode == 0) {
@@ -256,8 +276,11 @@
} else {
sig = SIGSEGV;
}
- } else
+ } else {
trapsig = 0;
+ if (nss != 0 && nss > vm->vm_ssize)
+ vm->vm_ssize = nss;
+ }
if (umode)
KERNEL_PROC_UNLOCK(p);
else
Home |
Main Index |
Thread Index |
Old Index