In trap(), curlwp could be NULL so don't refer it implicitly.

This commit is contained in:
tsutsui 2003-11-08 12:08:12 +00:00
parent 7a6d021fe2
commit 3dc4924359
1 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.12 2003/10/31 03:28:13 simonb Exp $ */ /* $NetBSD: trap.c,v 1.13 2003/11/08 12:08:12 tsutsui Exp $ */
/*- /*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.12 2003/10/31 03:28:13 simonb Exp $"); __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.13 2003/11/08 12:08:12 tsutsui Exp $");
/* #define INTRDEBUG */ /* #define INTRDEBUG */
/* #define TRAPDEBUG */ /* #define TRAPDEBUG */
@ -472,8 +472,8 @@ trap(type, frame)
int type; int type;
struct trapframe *frame; struct trapframe *frame;
{ {
struct lwp *l = curlwp; struct lwp *l;
struct proc *p = l->l_proc; struct proc *p;
struct pcb *pcbp; struct pcb *pcbp;
vaddr_t va; vaddr_t va;
struct vm_map *map; struct vm_map *map;
@ -500,6 +500,10 @@ trap(type, frame)
vftype = inst_store(opcode) ? VM_PROT_WRITE : VM_PROT_READ; vftype = inst_store(opcode) ? VM_PROT_WRITE : VM_PROT_READ;
} }
if ((l = curlwp) == NULL)
l = &lwp0;
p = l->l_proc;
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
/* /*
* If we are on the emergency stack, then we either got * If we are on the emergency stack, then we either got