Merge from vmlocking.

This commit is contained in:
ad 2007-12-03 20:21:32 +00:00
parent 7a09009b52
commit 395a384526
5 changed files with 25 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.34 2007/12/02 21:43:11 dsl Exp $ */
/* $NetBSD: locore.S,v 1.35 2007/12/03 20:21:32 ad Exp $ */
/*
* Copyright-o-rama!
@ -865,7 +865,8 @@ ENTRY(dumpsys)
ret
/*
* struct lwp *cpu_switchto(struct lwp *, struct lwp *)
* struct lwp *cpu_switchto(struct lwp *oldlwp, struct newlwp,
* bool returning)
*
* 1. if (oldlwp != NULL), save its context.
* 2. then, restore context of newlwp.
@ -903,6 +904,13 @@ ENTRY(cpu_switchto)
movq PCB_RSP(%r14),%rsp
movq PCB_RBP(%r14),%rbp
/* Set curlwp. */
movq %r12,CPUVAR(CURLWP)
/* Skip the rest if returning to a pinned LWP. */
testb %dl,%dl
jnz 4f
/* Switch TSS. Reset "task busy" flag before loading. */
#ifdef XEN
movq %r14, %rdi
@ -914,9 +922,6 @@ ENTRY(cpu_switchto)
ltr %dx
#endif
/* Set curlwp. */
movq %r12,CPUVAR(CURLWP)
/* Don't bother with the rest if switching to a system process. */
testl $LW_SYSTEM,L_FLAG(%r12)
jnz 4f
@ -1103,10 +1108,8 @@ syscall_return:
movl CPUVAR(ILEVEL),%r8d
xorq %rax,%rax
call _C_LABEL(printf)
#ifdef DDB
int $3
#endif /* DDB */
movl $IPL_NONE,CPUVAR(ILEVEL)
movl $IPL_NONE,%edi
call _C_LABEL(spllower)
jmp .Lsyscall_checkast
4: .asciz "WARNING: SPL NOT LOWERED ON SYSCALL %d %d EXIT %x %x\n"
#endif
@ -1218,10 +1221,8 @@ iret_return:
movabsq $4f, %rdi
xorq %rax,%rax
call _C_LABEL(printf)
#ifdef DDB
int $3
#endif /* DDB */
movl $IPL_NONE,CPUVAR(ILEVEL)
movl $IPL_NONE,%edi
call _C_LABEL(spllower)
jmp .Losyscall_checkast
4: .asciz "WARNING: SPL NOT LOWERED ON SYSCALL EXIT\n"
#endif /* DIAGNOSTIC */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.39 2007/12/02 16:37:58 ad Exp $ */
/* $NetBSD: trap.c,v 1.40 2007/12/03 20:21:32 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.39 2007/12/02 16:37:58 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.40 2007/12/03 20:21:32 ad Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -376,9 +376,7 @@ copyfault:
uvmexp.softs++;
if (l->l_flag & LP_OWEUPC) {
p->p_flag &= ~LP_OWEUPC;
KERNEL_LOCK(1, l);
ADDUPROF(l);
KERNEL_UNLOCK_LAST(l);
}
/* Allow a forced task switch. */
if (curcpu()->ci_want_resched)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vector.S,v 1.16 2007/12/03 15:33:10 ad Exp $ */
/* $NetBSD: vector.S,v 1.17 2007/12/03 20:21:33 ad Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -261,10 +261,8 @@ calltrap:
movl %ebx,%edx
xorq %rax,%rax
call _C_LABEL(printf)
#ifdef DDB
int $3
#endif /* DDB */
movl %ebx,CPUVAR(ILEVEL)
movl %ebx,%edi
call _C_LABEL(spllower)
jmp .Lalltraps_checkast
4: .asciz "WARNING: SPL NOT LOWERED ON TRAP EXIT %x %x\n"
#endif /* DIAGNOSTIC */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.227 2007/12/02 16:37:58 ad Exp $ */
/* $NetBSD: trap.c,v 1.228 2007/12/03 20:21:33 ad Exp $ */
/*-
* Copyright (c) 1998, 2000, 2005 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.227 2007/12/02 16:37:58 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.228 2007/12/03 20:21:33 ad Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -530,9 +530,7 @@ copyfault:
uvmexp.softs++;
if (l->l_pflag & LP_OWEUPC) {
l->l_pflag &= ~LP_OWEUPC;
KERNEL_LOCK(1, l);
ADDUPROF(l);
KERNEL_UNLOCK_LAST(l);
}
/* Allow a forced task switch. */
if (curcpu()->ci_want_resched)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vector.S,v 1.31 2007/12/03 15:33:46 ad Exp $ */
/* $NetBSD: vector.S,v 1.32 2007/12/03 20:21:33 ad Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@ -901,10 +901,9 @@ calltrap:
pushl $4f
call _C_LABEL(printf)
addl $4,%esp
#ifdef DDB
int $3
#endif /* DDB */
movl %ebx,CPUVAR(ILEVEL)
pushl %ebx
call _C_LABEL(spllower)
addl $4,%esp
jmp .Lalltraps_checkast /* re-check ASTs */
4: .asciz "WARNING: SPL NOT LOWERED ON TRAP EXIT\n"
#endif /* DIAGNOSTIC */