Disable kernel preemption in the critical section of cpu_switchto()
This commit is contained in:
parent
66a2e2bc4b
commit
ebe91428da
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpu.c,v 1.29 2011/09/04 21:01:39 reinoud Exp $ */
|
||||
/* $NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
@ -29,7 +29,7 @@
|
||||
#include "opt_cpu.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.29 2011/09/04 21:01:39 reinoud Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
@ -184,6 +184,8 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
|
||||
}
|
||||
#endif /* !CPU_DEBUG */
|
||||
|
||||
kpreempt_disable();
|
||||
|
||||
ci->ci_stash = oldlwp;
|
||||
curlwp = newlwp;
|
||||
|
||||
@ -197,6 +199,8 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
|
||||
}
|
||||
thunk_seterrno(newpcb->pcb_errno);
|
||||
|
||||
kpreempt_enable();
|
||||
|
||||
#ifdef CPU_DEBUG
|
||||
printf("cpu_switchto: returning %p (was %p)\n", ci->ci_stash, oldlwp);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user