diff --git a/sys/arch/usermode/usermode/trap.c b/sys/arch/usermode/usermode/trap.c index 0c001c7b32b6..2c0390ffcaf7 100644 --- a/sys/arch/usermode/usermode/trap.c +++ b/sys/arch/usermode/usermode/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $ */ +/* $NetBSD: trap.c,v 1.28 2011/09/05 21:38:05 jmcneill Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.28 2011/09/05 21:38:05 jmcneill Exp $"); #include #include @@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $"); //#include //#include +extern int cpu_lwp_inkernel; /* forwards and externals */ void setup_signal_handlers(void); @@ -117,6 +118,8 @@ mem_access_handler(int sig, siginfo_t *info, void *ctx) void *onfault; int kmem, lwp_errno, rv; + cpu_lwp_inkernel++; + recurse++; if (recurse > 1) printf("enter trap recursion level %d\n", recurse); @@ -229,6 +232,7 @@ mem_access_handler(int sig, siginfo_t *info, void *ctx) if (recurse > 1) printf("leaving trap recursion level %d\n", recurse); recurse--; + cpu_lwp_inkernel--; } static void @@ -240,6 +244,7 @@ illegal_instruction_handler(int sig, siginfo_t *info, void *ctx) struct pcb *pcb; vaddr_t va; + cpu_lwp_inkernel++; recurse++; if (recurse > 1) printf("enter trap recursion level %d\n", recurse); @@ -287,4 +292,5 @@ illegal_instruction_handler(int sig, siginfo_t *info, void *ctx) panic("illegal instruction encountered\n"); } + cpu_lwp_inkernel--; }