Module Name: src
Committed By: reinoud
Date: Sun Dec 11 20:45:14 UTC 2011
Modified Files:
src/sys/arch/usermode/dev: cpu.c
Log Message:
Free the systemcall and pagefault stacks on lwp destroy.
XXX what about the main ucps stackspace that is used for the trampoline?
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/usermode/dev/cpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.47 src/sys/arch/usermode/dev/cpu.c:1.48
--- src/sys/arch/usermode/dev/cpu.c:1.47 Sun Nov 27 21:38:17 2011
+++ src/sys/arch/usermode/dev/cpu.c Sun Dec 11 20:45:14 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.47 2011/11/27 21:38:17 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.48 2011/12/11 20:45:14 reinoud Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -30,7 +30,7 @@
#include "opt_hz.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.47 2011/11/27 21:38:17 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.48 2011/12/11 20:45:14 reinoud Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -273,14 +273,20 @@ cpu_lwp_free2(struct lwp *l)
return;
if (pcb->pcb_needfree) {
+#if 0
free(pcb->pcb_ucp.uc_stack.ss_sp, M_TEMP);
pcb->pcb_ucp.uc_stack.ss_sp = NULL;
pcb->pcb_ucp.uc_stack.ss_size = 0;
+#endif
free(pcb->pcb_syscall_ucp.uc_stack.ss_sp, M_TEMP);
pcb->pcb_syscall_ucp.uc_stack.ss_sp = NULL;
pcb->pcb_syscall_ucp.uc_stack.ss_size = 0;
+ free(pcb->pcb_pagefault_ucp.uc_stack.ss_sp, M_TEMP);
+ pcb->pcb_pagefault_ucp.uc_stack.ss_sp = NULL;
+ pcb->pcb_pagefault_ucp.uc_stack.ss_size = 0;
+
pcb->pcb_needfree = false;
}
}
@@ -330,6 +336,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp
panic("getcontext failed");
/* set up the ucontext for the userland switch */
+ /* XXX BUG TODO when is this stack space freed? */
pcb2->pcb_ucp.uc_stack.ss_sp = stack_ucp;
pcb2->pcb_ucp.uc_stack.ss_size = stacksize;
pcb2->pcb_ucp.uc_flags = _UC_STACK | _UC_CPU;