Module Name: src Committed By: reinoud Date: Mon Sep 5 11:56:53 UTC 2011
Modified Files: src/sys/arch/usermode/usermode: trap.c Log Message: Initialise the alternative signal stack before referring to it To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/usermode/usermode/trap.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/usermode/trap.c diff -u src/sys/arch/usermode/usermode/trap.c:1.24 src/sys/arch/usermode/usermode/trap.c:1.25 --- src/sys/arch/usermode/usermode/trap.c:1.24 Mon Sep 5 11:10:36 2011 +++ src/sys/arch/usermode/usermode/trap.c Mon Sep 5 11:56:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud Exp $ */ +/* $NetBSD: trap.c,v 1.25 2011/09/05 11:56:52 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk <rein...@netbsd.org> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.25 2011/09/05 11:56:52 reinoud Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -70,6 +70,14 @@ { static struct sigaction sa; + if ((sigstk.ss_sp = thunk_malloc(SIGSTKSZ)) == NULL) + panic("can't allocate signal stack space\n"); + sigstk.ss_size = SIGSTKSZ; + sigstk.ss_flags = 0; + if (thunk_sigaltstack(&sigstk, 0) < 0) + panic("can't set alternate stacksize : %d", + thunk_geterrno()); + sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK; sa.sa_sigaction = mem_access_handler; @@ -87,14 +95,6 @@ if (thunk_sigaction(SIGILL, &sa, NULL) == -1) panic("couldn't register SIGILL handler : %d", thunk_geterrno()); - if ((sigstk.ss_sp = thunk_malloc(SIGSTKSZ)) == NULL) - panic("can't allocate signal stack space\n"); - sigstk.ss_size = SIGSTKSZ; - sigstk.ss_flags = 0; - if (thunk_sigaltstack(&sigstk, 0) < 0) - panic("can't set alternate stacksize : %d", - thunk_geterrno()); - // debug_fh = thunk_open("/usr/sources/debug", O_RDWR | O_TRUNC | O_CREAT, 0666); }