adjust cpu_lwp_inkernel in mem access and illegal insn handlers

This commit is contained in:
jmcneill 2011-09-05 21:38:05 +00:00
parent d7545ef1db
commit 3610f83b31

View File

@ -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 <reinoud@netbsd.org>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__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 <sys/types.h>
#include <sys/param.h>
@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $");
//#include <machine/instr.h>
//#include <machine/userret.h>
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--;
}