Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v retrieving revision 1.44.2.1 retrieving revision 1.45 diff -u -p -r1.44.2.1 -r1.45 --- src/sys/arch/i386/i386/locore.S 2010/12/10 22:14:57 1.44.2.1 +++ src/sys/arch/i386/i386/locore.S 2007/02/09 21:55:04 1.45 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.44.2.1 2010/12/10 22:14:57 bouyer Exp $ */ +/* $NetBSD: locore.S,v 1.45 2007/02/09 21:55:04 ad Exp $ */ /*- * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc. @@ -720,6 +720,13 @@ NENTRY(lgdt) pushl %eax lret +NENTRY(x86_flush) + /* Reload code selector by doing intersegment return. */ + popl %eax + pushl $GSEL(GCODE_SEL, SEL_KPL) + pushl %eax + lret + /*****************************************************************************/ /* @@ -879,12 +886,10 @@ ENTRY(cpu_switch) xorl %esi,%esi sti idle_unlock: -#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG) call _C_LABEL(sched_unlock_idle) -#endif /* Interrupts are okay again. */ pushl $IPL_NONE # spl0() - call _C_LABEL(Xspllower) # process pending interrupts + call _C_LABEL(spllower) # process pending interrupts addl $4,%esp jmp idle_start idle_zero: @@ -908,9 +913,7 @@ idle_start: idle_exit: movl $IPL_HIGH,CPUVAR(ILEVEL) # splhigh sti -#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG) call _C_LABEL(sched_lock_idle) -#endif movl _C_LABEL(sched_whichqs),%ecx bsfl %ecx,%ebx jz idle_unlock @@ -920,7 +923,7 @@ switch_dequeue: * we're running at splhigh(), but it's otherwise okay to take * interrupts here. */ - /*sti -- no it isn't! */ + sti leal _C_LABEL(sched_qs)(,%ebx,8),%eax # select q movl L_FORW(%eax),%edi # unlink from front of process q @@ -1049,7 +1052,7 @@ switch_restored: SET_CURPCB(%esi) /* Interrupts are okay again. */ - /*sti -- nope, not yet! */ + sti /* * Check for restartable atomic sequences (RAS) @@ -1062,14 +1065,11 @@ switch_restored: movl $1,%ebx switch_return: -#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG) call _C_LABEL(sched_unlock_idle) -#endif - sti /* NOW we can do this, after releasing sched_lock */ cmpl $0,CPUVAR(IPENDING) jz 3f pushl $IPL_NONE # spl0() - call _C_LABEL(Xspllower) # process pending interrupts + call _C_LABEL(spllower) # process pending interrupts addl $4,%esp 3: movl $IPL_HIGH,CPUVAR(ILEVEL) # splhigh() @@ -1130,7 +1130,7 @@ ENTRY(cpu_switchto) * We're running at splhigh(), but it's otherwise okay to take * interrupts here. */ - /*sti -- no it isn't! */ + sti /* Jump into the middle of cpu_switch */ xorl %eax,%eax @@ -1156,8 +1156,6 @@ ENTRY(cpu_exit) movl CPUVAR(IDLE_PCB),%esi movl CPUVAR(IDLE_TSS_SEL),%edx #endif - /* In case we fault... */ - movl $0,CPUVAR(CURLWP) /* Restore the idle context. */ cli @@ -1188,19 +1186,14 @@ ENTRY(cpu_exit) /* Record new pcb. */ SET_CURPCB(%esi) + /* Now off the CPU. */ + movl $0,CPUVAR(CURLWP) + /* Interrupts are okay again. */ sti - /* - * Schedule the dead LWP's stack to be freed. - */ - pushl %edi - call _C_LABEL(lwp_exit2) - addl $4,%esp - /* Jump into cpu_switch() with the right state. */ xorl %esi,%esi - movl %esi,CPUVAR(CURLWP) jmp idle_start /*