Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amigappc/amigappc Fixes by Klaus Klein.
details: https://anonhg.NetBSD.org/src/rev/4fa104517abd
branches: trunk
changeset: 573281:4fa104517abd
user: is <is%NetBSD.org@localhost>
date: Mon Jan 24 16:57:21 2005 +0000
description:
Fixes by Klaus Klein.
diffstat:
sys/arch/amigappc/amigappc/locore.S | 1218 +----------------------------------
1 files changed, 16 insertions(+), 1202 deletions(-)
diffs (truncated from 1283 to 300 lines):
diff -r 548aa5bae45c -r 4fa104517abd sys/arch/amigappc/amigappc/locore.S
--- a/sys/arch/amigappc/amigappc/locore.S Mon Jan 24 16:27:58 2005 +0000
+++ b/sys/arch/amigappc/amigappc/locore.S Mon Jan 24 16:57:21 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.12 2004/02/13 11:36:10 wiz Exp $ */
+/* $NetBSD: locore.S,v 1.13 2005/01/24 16:57:21 is Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -48,15 +48,19 @@
#include <sys/syscall.h>
#include <machine/param.h>
+#include <machine/vmparam.h>
#include <machine/pmap.h>
#include <machine/psl.h>
#include <machine/trap.h>
+#define _NOREGNAMES
#include <machine/asm.h>
#include <machine/p5reg.h>
#include <machine/hid.h>
#include <amiga/amiga/custom.h>
+#include <powerpc/spr.h>
+
.data
GLOBAL(proc0paddr)
.long 0
@@ -77,8 +81,6 @@
.long 0,0,0,0
GLOBAL(eintrcnt)
-GLOBAL(powersave)
- .long 0
idle_u:
.long 0 /* fake uarea during idle after exit */
@@ -217,13 +219,15 @@
ori 3,3,__start@l
bl _C_LABEL(initppc)
-
/*
* Jump to main() (from kern/init_main.c)
* main() should call consinit(), uvm_init() and cpu_startup()
*/
b _C_LABEL(main)
+loop:
+ b loop /* not reached */
+
/*
* Colours on the screen
* For visual test purposes.
@@ -235,10 +239,10 @@
li 5,0x000
lis 2,0xdff000@h
ori 2,2,0xdff000@l
-loop: sth 3,0x180(2)
+loop1: sth 3,0x180(2)
sth 4,0x180(2)
sth 5,0x180(2)
- b loop
+ b loop1
/*
@@ -260,1208 +264,18 @@
rfi
_C_LABEL(adamintsize) = .-_C_LABEL(adamint)
-/*
- * No processes are runnable, so loop waiting for one.
- * Separate label here for accounting purposes.
- * When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
- */
- .text
-ASENTRY(Idle)
- lis 8,_C_LABEL(sched_whichqs)@ha
- lwz 9,_C_LABEL(sched_whichqs)@l(8)
-
- or. 9,9,9
- bne- .Lsw1 /* at least one queue non-empty */
-
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
- bl _C_LABEL(sched_unlock_idle)
-#endif
-
- mfmsr 3
- ori 3,3,PSL_EE@l /* reenable ints again */
- mtmsr 3
- isync
-
-/* Check if we can use power saving mode */
- lis 8,_C_LABEL(powersave)@ha
- lwz 9,_C_LABEL(powersave)@l(8)
-
- or. 9,9,9
- beq 1f
-
- sync
- oris 3,3,PSL_POW@h /* enter power saving mode */
- mtmsr 3
- isync
-1:
- andi. 3,3,~PSL_EE@l /* disable interrupts while
- manipulating runque */
- mtmsr 3
-
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
- bl _C_LABEL(sched_lock_idle)
-#endif
- b _ASM_LABEL(Idle)
-
-/*
- * switchexit gets called from cpu_exit to complete the exit procedure.
- */
-ENTRY(switchexit)
-/* First switch to the idle pcb/kernel stack */
- lis 6,idle_u@ha
- lwz 6,idle_u@l(6)
- lis 7,_C_LABEL(curpcb)@ha
- stw 6,_C_LABEL(curpcb)@l(7)
- addi 1,6,USPACE-16 /* 16 bytes are reserved at stack top */
- /*
- * Schedule the stack to be freed (the lwp arg is
- * already in r3).
- */
- bl _C_LABEL(lwp_exit2)
-
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
- bl _C_LABEL(sched_lock_idle)
-#endif
-
-/* Fall through to cpu_switch to actually select another proc */
- li 3,0 /* indicate exited process */
/*
- * void cpu_switch(struct proc *p)
- * Find a runnable process and switch to it.
- */
-/* XXX noprofile? --thorpej%NetBSD.org@localhost */
-ENTRY(cpu_switch)
- mflr 0 /* save lr */
- stw 0,4(1)
- stwu 1,-16(1)
- stw 31,12(1)
- stw 30,8(1)
-
- mr 30,3
- lis 3,_C_LABEL(curproc)@ha
- xor 31,31,31
- stw 31,_C_LABEL(curproc)@l(3) /* Zero to not accumulate CPU time */
- lis 3,_C_LABEL(curpcb)@ha
- lwz 31,_C_LABEL(curpcb)@l(3)
-
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
-/* Release the sched_lock before processing interrupts. */
- bl _C_LABEL(sched_unlock_idle)
-#endif
-
- xor 3,3,3
- bl _C_LABEL(lcsplx)
- stw 3,PCB_SPL(31) /* save spl */
-
-/* Lock the scheduler. */
- mfmsr 3
- andi. 3,3,~PSL_EE@l /* disable interrupts while
- manipulating runque */
- mtmsr 3
- isync
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
- bl _C_LABEL(sched_lock_idle)
-#endif
-
-/* Find a new process */
- lis 8,_C_LABEL(sched_whichqs)@ha
- lwz 9,_C_LABEL(sched_whichqs)@l(8)
-
- or. 9,9,9
- beq- _ASM_LABEL(Idle) /* all queues empty */
-.Lsw1:
- cntlzw 10,9
- lis 4,_C_LABEL(sched_qs)@ha
- addi 4,4,_C_LABEL(sched_qs)@l
- slwi 3,10,3
- add 3,3,4 /* select queue */
-
- lwz 31,P_FORW(3) /* unlink first proc from queue */
- lwz 4,P_FORW(31)
- stw 4,P_FORW(3)
- stw 3,P_BACK(4)
-
- cmpl 0,3,4 /* queue empty? */
- bne 1f
-
- lis 3,0x80000000@h
- srw 3,3,10
- andc 9,9,3
- stw 9,_C_LABEL(sched_whichqs)@l(8) /* mark it empty */
-
-1:
- /* just did this resched thing */
- xor 3,3,3
- lis 4,_C_LABEL(want_resched)@ha
- stw 3,_C_LABEL(want_resched)@l(4)
-
- stw 3,P_BACK(31) /* probably superfluous */
-
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
- /* Unlock the sched_lock, but leave interrupts off, for now. */
- bl _C_LABEL(sched_unlock_idle)
-#endif
-
- /* p->p_cpu initialized in fork1() for single-processor */
-
- li 3,SONPROC /* p->p_stat = SONPROC */
- stb 3,P_STAT(31)
-
- /* record new process */
- lis 4,_C_LABEL(curproc)@ha
- stw 31,_C_LABEL(curproc)@l(4)
-
- mfmsr 3
- ori 3,3,PSL_EE@l /* Now we can interrupt again */
- mtmsr 3
-
- cmpl 0,31,30 /* is it the same process? */
- beq switch_return
-
- or. 30,30,30 /* old process was exiting? */
- beq switch_exited
-
- mfsr 10,USER_SR /* save USER_SR for copyin/copyout */
- mfcr 11 /* save cr */
- mr 12,2 /* save r2 */
- stwu 1,-SFRAMELEN(1) /* still running on old stack */
- stmw 10,8(1)
- lwz 3,P_ADDR(30)
- stw 1,PCB_SP(3) /* save SP */
-
-switch_exited:
- mfmsr 3
- andi. 3,3,~PSL_EE@l /* disable interrupts while
- actually switching */
- mtmsr 3
-
- /* indicate new pcb */
- lwz 4,P_ADDR(31)
- lis 5,_C_LABEL(curpcb)@ha
- stw 4,_C_LABEL(curpcb)@l(5)
-
- /* save real pmap pointer for spill fill */
- lwz 5,PCB_PMR(4)
- lis 6,_C_LABEL(curpm)@ha
- stwu 5,_C_LABEL(curpm)@l(6)
- stwcx. 5,0,6 /* clear possible reservation */
-
- addic. 5,5,64
- li 6,0
- mfsr 8,KERNEL_SR /* save kernel SR */
-1:
- addis 6,6,-0x10000000@ha /* set new procs segment registers */
- or. 6,6,6 /* This is done from the real
- address pmap */
- lwzu 7,-4(5) /* so we don't have to worry */
- mtsrin 7,6 /* about accessibility */
- bne 1b
- mtsr KERNEL_SR,8 /* restore kernel SR */
- isync
-
- lwz 1,PCB_SP(4) /* get new procs SP */
-
- ori 3,3,PSL_EE@l /* interrupts are okay again */
- mtmsr 3
-
- lmw 10,8(1) /* get other regs */
- lwz 1,0(1) /* get saved SP */
- mr 2,12 /* get saved r2 */
- mtcr 11 /* get saved cr */
- isync
- mtsr USER_SR,10 /* get saved USER_SR */
- isync
-
-switch_return:
- mr 30,7 /* save proc pointer */
- lwz 3,PCB_SPL(4)
- bl _C_LABEL(lcsplx)
-
- mr 3,30 /* get curproc for special fork
- returns */
-
- lwz 31,12(1)
- lwz 30,8(1)
- addi 1,1,16
- lwz 0,4(1)
- mtlr 0
- blr
-
Home |
Main Index |
Thread Index |
Old Index