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 rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.14 retrieving revision 1.21 diff -u -p -r1.14 -r1.21 --- src/sys/arch/i386/i386/locore.S 2003/08/11 21:15:50 1.14 +++ src/sys/arch/i386/i386/locore.S 2004/01/04 11:44:52 1.21 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.14 2003/08/11 21:15:50 fvdl Exp $ */ +/* $NetBSD: locore.S,v 1.21 2004/01/04 11:44:52 jdolecek Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -70,16 +70,17 @@ * @(#)locore.s 7.3 (Berkeley) 5/13/91 */ +#include "opt_compat_netbsd.h" +#include "opt_compat_oldboot.h" #include "opt_cputype.h" #include "opt_ddb.h" -#include "opt_ipkdb.h" -#include "opt_vm86.h" -#include "opt_user_ldt.h" #include "opt_dummy_nops.h" -#include "opt_compat_oldboot.h" -#include "opt_multiprocessor.h" +#include "opt_ipkdb.h" #include "opt_lockdebug.h" +#include "opt_multiprocessor.h" #include "opt_realmem.h" +#include "opt_user_ldt.h" +#include "opt_vm86.h" #include "npx.h" #include "assym.h" @@ -705,7 +706,7 @@ NENTRY(proc_trampoline) /* NOTREACHED */ /*****************************************************************************/ - +#ifdef COMPAT_16 /* * Signal trampoline; copied to top of user stack. */ @@ -718,12 +719,19 @@ NENTRY(sigcode) leal 12(%esp),%eax # get pointer to sigcontext movl %eax,4(%esp) # put it in the argument slot # fake return address already there +#if defined(SYS_compat_16___sigreturn14) + movl $SYS_compat_16___sigreturn14,%eax +#elif defined(SYS___sigreturn14) movl $SYS___sigreturn14,%eax +#else + #error "no sigreturn14 syscall" +#endif int $0x80 # enter kernel with args on stack movl $SYS_exit,%eax int $0x80 # exit if sigreturn fails .globl _C_LABEL(esigcode) _C_LABEL(esigcode): +#endif /*****************************************************************************/ @@ -1943,17 +1951,8 @@ switch_restored: */ movl CPUVAR(CURLWP),%edi movl L_PROC(%edi),%esi - cmpl $0,P_NRAS(%esi) - je 1f - movl L_MD_REGS(%edi),%ebx - movl TF_EIP(%ebx),%eax - pushl %eax - pushl %esi - call _C_LABEL(ras_lookup) - addl $8,%esp - cmpl $-1,%eax - je 1f - movl %eax,TF_EIP(%ebx) + cmpl $0,P_RASLIST(%esi) + jne 2f 1: movl $1,%ebx @@ -1973,6 +1972,18 @@ switch_return: popl %ebx ret +2: # check RAS list + movl L_MD_REGS(%edi),%ebx + movl TF_EIP(%ebx),%eax + pushl %eax + pushl %esi + call _C_LABEL(ras_lookup) + addl $8,%esp + cmpl $-1,%eax + je 1b + movl %eax,TF_EIP(%ebx) + jmp 1b + /* * void cpu_switchto(struct lwp *current, struct lwp *next) * Switch to the specified next LWP. @@ -2017,7 +2028,7 @@ ENTRY(cpu_switchto) jmp switch_resume /* - * void switch_exit(struct lwp *l, void (*exit)(struct lwp *)); + * void cpu_exit(struct lwp *l) * Switch to the appropriate idle context (lwp0's if uniprocessor; the cpu's * if multiprocessor) and deallocate the address space and kernel stack for p. * Then jump into cpu_switch(), as if we were in the idle proc all along. @@ -2027,10 +2038,9 @@ ENTRY(cpu_switchto) #endif .globl _C_LABEL(uvmspace_free),_C_LABEL(kernel_map) .globl _C_LABEL(uvm_km_free),_C_LABEL(tss_free) -/* LINTSTUB: Func: void switch_exit(struct lwp *l, void (*exit)(struct lwp *)) */ -ENTRY(switch_exit) +/* LINTSTUB: Func: void cpu_exit(struct lwp *l) */ +ENTRY(cpu_exit) movl 4(%esp),%edi # old process - movl 8(%esp),%eax # exit func #ifndef MULTIPROCESSOR movl $_C_LABEL(lwp0),%ebx movl L_ADDR(%ebx),%esi @@ -2049,9 +2059,6 @@ ENTRY(switch_exit) movl PCB_ESP(%esi),%esp movl PCB_EBP(%esi),%ebp - /* Save exit func. */ - pushl %eax - /* Load TSS info. */ #ifdef MULTIPROCESSOR movl CPUVAR(GDT),%eax @@ -2081,11 +2088,10 @@ ENTRY(switch_exit) sti /* - * Schedule the dead process's vmspace and stack to be freed. + * Schedule the dead LWP's stack to be freed. */ - movl 0(%esp),%eax /* %eax = exit func */ - movl %edi,0(%esp) /* {lwp_}exit2(l) */ - call *%eax + pushl %edi + call _C_LABEL(lwp_exit2) addl $4,%esp /* Jump into cpu_switch() with the right state. */ @@ -2143,7 +2149,9 @@ syscall1: movl CPUVAR(CURLWP),%edx movl %esp,L_MD_REGS(%edx) # save pointer to frame movl L_PROC(%edx),%edx + pushl %esp call *P_MD_SYSCALL(%edx) # get pointer to syscall() function + addl $4,%esp 2: /* Check for ASTs on exit to user mode. */ cli CHECK_ASTPENDING(%eax) @@ -2152,7 +2160,9 @@ syscall1: CLEAR_ASTPENDING(%eax) sti /* Pushed T_ASTFLT into tf_trapno on entry. */ + pushl %esp call _C_LABEL(trap) + addl $4,%esp jmp 2b #ifndef DIAGNOSTIC 1: INTRFASTEXIT