Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode/dev Free the systemcall and pagefault stac...



details:   https://anonhg.NetBSD.org/src/rev/735abb3c5538
branches:  trunk
changeset: 771961:735abb3c5538
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sun Dec 11 20:45:14 2011 +0000

description:
Free the systemcall and pagefault stacks on lwp destroy.

XXX what about the main ucps stackspace that is used for the trampoline?

diffstat:

 sys/arch/usermode/dev/cpu.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r b66a62785d43 -r 735abb3c5538 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Sun Dec 11 20:44:44 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Sun Dec 11 20:45:14 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
                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 @@
                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;



Home | Main Index | Thread Index | Old Index