diff --git a/sys/arch/cesfic/cesfic/locore.s b/sys/arch/cesfic/cesfic/locore.s index c508842a301e..7d8a340d8e99 100644 --- a/sys/arch/cesfic/cesfic/locore.s +++ b/sys/arch/cesfic/cesfic/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.6 2002/11/02 20:03:05 chs Exp $ */ +/* $NetBSD: locore.s,v 1.7 2003/01/19 16:33:54 thorpej Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -207,7 +207,7 @@ Lmemok: subl %d0,%d1 | compute amount of RAM present RELOC(physmem, %a0) movl %d1,%a0@ | and physmem -/* configure kernel and proc0 VA space so we can get going */ +/* configure kernel and lwp0 VA space so we can get going */ .globl _Sysseg, _pmap_bootstrap, _avail_start #ifdef DDB RELOC(esym,%a0) | end of static kernel test/data/syms @@ -298,13 +298,13 @@ Lenab1: lea _ASM_LABEL(tmpstk),%sp | temporary stack jbsr _C_LABEL(uvm_setpagesize) | select software page size /* set kernel stack, user SP, and initial pcb */ - movl _C_LABEL(proc0paddr),%a1 | get proc0 pcb addr + movl _C_LABEL(proc0paddr),%a1 | get lwp0 pcb addr lea %a1@(USPACE-4),%sp | set kernel stack to end of area - lea _C_LABEL(proc0),%a2 | initialize proc0.p_addr so that - movl %a1,%a2@(P_ADDR) | we don't deref NULL in trap() + lea _C_LABEL(lwp0),%a2 | initialize lwp0.l_addr so that + movl %a1,%a2@(L_ADDR) | we don't deref NULL in trap() movl #USRSTACK-4,%a2 movl %a2,%usp | init user SP - movl %a1,_C_LABEL(curpcb) | proc0 is running + movl %a1,_C_LABEL(curpcb) | lwp0 is running tstl _C_LABEL(fputype) | Have an FPU? jeq Lenab2 | No, skip. @@ -335,8 +335,8 @@ Lnocache0: movw #PSL_USER,%sp@- | in user mode clrl %sp@- | stack adjust count and padding lea %sp@(-64),%sp | construct space for D0-D7/A0-A7 - lea _C_LABEL(proc0),%a0 | save pointer to frame - movl %sp,%a0@(P_MD_REGS) | in proc0.p_md.md_regs + lea _C_LABEL(lwp0),%a0 | save pointer to frame + movl %sp,%a0@(L_MD_REGS) | in lwp0.l_md.md_regs jra _C_LABEL(main) | main() @@ -675,7 +675,8 @@ Ltrap1: * command in d0, addr in a1, length in d1 */ ENTRY_NOPROFILE(trap12) - movl _C_LABEL(curproc),%sp@- | push current proc pointer + movl _C_LABEL(curlwp),%a0 + movl %a0@(L_PROC),%sp@- | push current proc pointer movl %d1,%sp@- | push length movl %a1,%sp@- | push addr movl %d0,%sp@- | push command @@ -934,196 +935,12 @@ Ldorte: */ #include - .data -GLOBAL(curpcb) -GLOBAL(masterpaddr) | XXX compatibility (debuggers) - .long 0 - -ASLOCAL(mdpflag) - .byte 0 | copy of proc md_flags low byte -#ifdef __ELF__ - .align 4 -#else - .align 2 -#endif - -ASBSS(nullpcb,SIZEOF_PCB) - /* - * At exit of a process, do a switch for the last time. - * Switch to a safe stack and PCB, and deallocate the process's resources. + * Use common m68k process/lwp switch and context save subroutines. */ -ENTRY(switch_exit) - movl %sp@(4),%a0 - /* save state into garbage pcb */ - movl #_ASM_LABEL(nullpcb),_C_LABEL(curpcb) - lea _ASM_LABEL(tmpstk),%sp | goto a tmp stack +#define FPCOPROC /* XXX: Temporarily required */ +#include - /* Schedule the vmspace and stack to be freed. */ - movl %a0,%sp@- | exit2(p) - jbsr _C_LABEL(exit2) - lea %sp@(4),%sp | pop args - - jra _C_LABEL(cpu_switch) - -/* - * When no processes are on the runq, Swtch branches to Idle - * to wait for something to come ready. - */ -ASENTRY_NOPROFILE(Idle) - stop #PSL_LOWIPL - movw #PSL_HIGHIPL,%sr - movl _C_LABEL(sched_whichqs),%d0 - jeq _ASM_LABEL(Idle) - jra Lsw1 - -Lbadsw: - PANIC("switch") - /*NOTREACHED*/ - -/* - * cpu_switch() - * - * NOTE: On the mc68851 (318/319/330) we attempt to avoid flushing the - * entire ATC. The effort involved in selective flushing may not be - * worth it, maybe we should just flush the whole thing? - * - * NOTE 2: With the new VM layout we now no longer know if an inactive - * user's PTEs have been changed (formerly denoted by the SPTECHG p_flag - * bit). For now, we just always flush the full ATC. - */ -ENTRY(cpu_switch) - movl _C_LABEL(curpcb),%a0 | current pcb - movw %sr,%a0@(PCB_PS) | save %sr before changing ipl -#ifdef notyet - movl _C_LABEL(curproc),%sp@- | remember last proc running -#endif - clrl _C_LABEL(curproc) - - /* - * Find the highest-priority queue that isn't empty, - * then take the first proc from that queue. - */ - movw #PSL_HIGHIPL,%sr | lock out interrupts - movl _C_LABEL(sched_whichqs),%d0 - jeq _ASM_LABEL(Idle) -Lsw1: - movl %d0,%d1 - negl %d0 - andl %d1,%d0 - bfffo %d0{#0:#32},%d1 - eorib #31,%d1 - - movl %d1,%d0 - lslb #3,%d1 | convert queue number to index - addl #_C_LABEL(sched_qs),%d1 | locate queue (q) - movl %d1,%a1 - movl %a1@(P_FORW),%a0 | p = q->p_forw - cmpal %d1,%a0 | anyone on queue? - jeq Lbadsw | no, panic - movl %a0@(P_FORW),%a1@(P_FORW) | q->p_forw = p->p_forw - movl %a0@(P_FORW),%a1 | n = p->p_forw - movl %d1,%a1@(P_BACK) | n->p_back = q - cmpal %d1,%a1 | anyone left on queue? - jne Lsw2 | yes, skip - movl _C_LABEL(sched_whichqs),%d1 - bclr %d0,%d1 | no, clear bit - movl %d1,_C_LABEL(sched_whichqs) -Lsw2: - /* p->p_cpu initialized in fork1() for single-processor */ - movb #SONPROC,%a0@(P_STAT) | p->p_stat = SONPROC - movl %a0,_C_LABEL(curproc) - clrl _C_LABEL(want_resched) -#ifdef notyet - movl %sp@+,%a1 - cmpl %a0,%a1 | switching to same proc? - jeq Lswdone | yes, skip save and restore -#endif - /* - * Save state of previous process in its pcb. - */ - movl _C_LABEL(curpcb),%a1 - moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers - movl %usp,%a2 | grab USP (%a2 has been saved) - movl %a2,%a1@(PCB_USP) | and save it - - tstl _C_LABEL(fputype) | Do we have an FPU? - jeq Lswnofpsave | No Then don't attempt save. - lea %a1@(PCB_FPCTX),%a2 | pointer to FP save area - fsave %a2@ | save FP state - tstb %a2@ | null state frame? - jeq Lswnofpsave | yes, all done - fmovem %fp0-%fp7,%a2@(216) | save FP general registers - fmovem %fpcr/%fpsr/%fpi,%a2@(312) | save FP control registers -Lswnofpsave: - - clrl %a0@(P_BACK) | clear back link - movb %a0@(P_MD_FLAGS+3),mdpflag | low byte of p_md.md_flags - movl %a0@(P_ADDR),%a1 | get p_addr - movl %a1,_C_LABEL(curpcb) - - /* - * Activate process's address space. - * XXX Should remember the last USTP value loaded, and call this - * XXX only if it has changed. - */ - pea %a0@ | push proc - jbsr _C_LABEL(pmap_activate) | pmap_activate(p) - addql #4,%sp - movl _C_LABEL(curpcb),%a1 | restore p_addr - - lea _ASM_LABEL(tmpstk),%sp | now goto a tmp stack for NMI - - moveml %a1@(PCB_REGS),#0xFCFC | and registers - movl %a1@(PCB_USP),%a0 - movl %a0,%usp | and USP - - tstl _C_LABEL(fputype) | If we don't have an FPU, - jeq Lnofprest | don't try to restore it. - lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area - tstb %a0@ | null state frame? - jeq Lresfprest | yes, easy -#if defined(M68040) -#if defined(M68020) || defined(M68030) - cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? - jne Lresnot040 | no, skip -#endif - clrl %sp@- | yes... - frestore %sp@+ | ...magic! -Lresnot040: -#endif - fmovem %a0@(312),%fpcr/%fpsr/%fpi | restore FP control registers - fmovem %a0@(216),%fp0-%fp7 | restore FP general registers -Lresfprest: - frestore %a0@ | restore state - -Lnofprest: - movw %a1@(PCB_PS),%sr | no, restore PS - moveq #1,%d0 | return 1 (for alternate returns) - rts - -/* - * savectx(pcb) - * Update pcb, saving current processor state. - */ -ENTRY(savectx) - movl %sp@(4),%a1 - movw %sr,%a1@(PCB_PS) - movl %usp,%a0 | grab USP - movl %a0,%a1@(PCB_USP) | and save it - moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers - - tstl _C_LABEL(fputype) | Do we have FPU? - jeq Lsvnofpsave | No? Then don't save state. - lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area - fsave %a0@ | save FP state - tstb %a0@ | null state frame? - jeq Lsvnofpsave | yes, all done - fmovem %fp0-%fp7,%a0@(216) | save FP general registers - fmovem %fpcr/%fpsr/%fpi,%a0@(312) | save FP control registers -Lsvnofpsave: - moveq #0,%d0 | return 0 - rts #if defined(M68040) ENTRY(suline) @@ -1301,7 +1118,7 @@ GLOBAL(want_resched) .long 0 GLOBAL(proc0paddr) - .long 0 | KVA of proc0 u-area + .long 0 | KVA of lwp0 u-area #ifdef DEBUG .globl fulltflush, fullcflush fulltflush: diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c index 7b8ed5261589..290a881a86a1 100644 --- a/sys/arch/i386/isa/pccons.c +++ b/sys/arch/i386/isa/pccons.c @@ -1,4 +1,4 @@ -/* $NetBSD: pccons.c,v 1.159 2002/10/23 09:11:23 jdolecek Exp $ */ +/* $NetBSD: pccons.c,v 1.160 2003/01/19 16:35:55 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.159 2002/10/23 09:11:23 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pccons.c,v 1.160 2003/01/19 16:35:55 thorpej Exp $"); #include "opt_ddb.h" #include "opt_xserver.h" @@ -2740,7 +2740,7 @@ pc_xmode_on() #ifdef COMPAT_10 /* This is done by i386_iopl(3) now. */ - fp = curproc->p_md.md_regs; + fp = curlwp->p_md.md_regs; fp->tf_eflags |= PSL_IOPL; #endif } @@ -2760,7 +2760,7 @@ pc_xmode_off() #endif async_update(); - fp = curproc->p_md.md_regs; + fp = curlwp->p_md.md_regs; fp->tf_eflags &= ~PSL_IOPL; } #endif /* XSERVER */ diff --git a/sys/arch/m68k/include/cpu.h b/sys/arch/m68k/include/cpu.h index 6012a68bb8a2..5452cc1335c6 100644 --- a/sys/arch/m68k/include/cpu.h +++ b/sys/arch/m68k/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.8 2002/09/29 23:23:58 wiz Exp $ */ +/* $NetBSD: cpu.h,v 1.9 2003/01/19 16:36:29 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -168,6 +168,8 @@ * From m68k/syscall.c */ /* extern void syscall(register_t, struct frame); Only called from locore.s */ + +#define LWP_PC(l) (((struct trapframe *)((l)->l_md.md_regs))->tf_pc) #endif /* _KERNEL */ #endif /* _M68K_CPU_H_ */ diff --git a/sys/arch/mipsco/mipsco/mips_3x30.c b/sys/arch/mipsco/mipsco/mips_3x30.c index f66d5d3fd566..1181b60d5dde 100644 --- a/sys/arch/mipsco/mipsco/mips_3x30.c +++ b/sys/arch/mipsco/mipsco/mips_3x30.c @@ -1,4 +1,4 @@ -/* $NetBSD: mips_3x30.c,v 1.6 2002/07/07 00:22:19 gmcgarry Exp $ */ +/* $NetBSD: mips_3x30.c,v 1.7 2003/01/19 16:37:39 thorpej Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ pizazz_intr(status, cause, pc, ipending) panic("kernel used FPU: PC %x, CR %x, SR %x", pc, cause, status); #if !defined(SOFTFLOAT) - MachFPInterrupt(status, cause, pc, curproc->p_md.md_regs); + MachFPInterrupt(status, cause, pc, curlwp->l_md.md_regs); #endif } } diff --git a/sys/arch/newsmips/newsmips/news3400.c b/sys/arch/newsmips/newsmips/news3400.c index 34329a7f2e22..ba591de16d81 100644 --- a/sys/arch/newsmips/newsmips/news3400.c +++ b/sys/arch/newsmips/newsmips/news3400.c @@ -1,4 +1,4 @@ -/* $NetBSD: news3400.c,v 1.5 2002/07/07 00:22:19 gmcgarry Exp $ */ +/* $NetBSD: news3400.c,v 1.6 2003/01/19 16:38:43 thorpej Exp $ */ /*- * Copyright (C) 1999 Tsubai Masanari. All rights reserved. @@ -121,7 +121,7 @@ news3400_intr(status, cause, pc, ipending) intrcnt[FPU_INTR]++; #if !defined(SOFTFLOAT) - MachFPInterrupt(status, cause, pc, curproc->p_md.md_regs); + MachFPInterrupt(status, cause, pc, curlwp->l_md.md_regs); #endif } } diff --git a/sys/lkm/vfs/ufs/lfs/lkminit_vfs.c b/sys/lkm/vfs/ufs/lfs/lkminit_vfs.c index f27ced483db0..8080ce250045 100644 --- a/sys/lkm/vfs/ufs/lfs/lkminit_vfs.c +++ b/sys/lkm/vfs/ufs/lfs/lkminit_vfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: lkminit_vfs.c,v 1.4 2002/12/11 12:13:12 scw Exp $ */ +/* $NetBSD: lkminit_vfs.c,v 1.5 2003/01/19 16:30:13 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lkminit_vfs.c,v 1.4 2002/12/11 12:13:12 scw Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lkminit_vfs.c,v 1.5 2003/01/19 16:30:13 thorpej Exp $"); #include #include @@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: lkminit_vfs.c,v 1.4 2002/12/11 12:13:12 scw Exp $"); #define LFS #include +#include #include /* used for lfs syscal entry table */