Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/powerpc Switch to regiser prefixes. Also c...



details:   https://anonhg.NetBSD.org/src/rev/8b517721cbb8
branches:  trunk
changeset: 550160:8b517721cbb8
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jul 31 15:30:41 2003 +0000

description:
Switch to regiser prefixes.  Also change numeric constants to symbolic ones.

diffstat:

 sys/arch/powerpc/powerpc/locore_subr.S |  327 ++++++++++++++++----------------
 1 files changed, 165 insertions(+), 162 deletions(-)

diffs (truncated from 538 to 300 lines):

diff -r 93636cd92d40 -r 8b517721cbb8 sys/arch/powerpc/powerpc/locore_subr.S
--- a/sys/arch/powerpc/powerpc/locore_subr.S    Thu Jul 31 15:29:29 2003 +0000
+++ b/sys/arch/powerpc/powerpc/locore_subr.S    Thu Jul 31 15:30:41 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore_subr.S,v 1.13 2003/06/23 11:01:36 martin Exp $  */
+/*     $NetBSD: locore_subr.S,v 1.14 2003/07/31 15:30:41 matt Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -89,10 +89,10 @@
  * When we get here, interrupts are off (MSR[EE]=0) and sched_lock is held.
  */
 ASENTRY(Idle)
-       lis     8,_C_LABEL(sched_whichqs)@ha
-       lwz     9,_C_LABEL(sched_whichqs)@l(8)
+       lis     %r8,_C_LABEL(sched_whichqs)@ha
+       lwz     %r9,_C_LABEL(sched_whichqs)@l(%r8)
 
-       or.     9,9,9
+       or.     %r9,%r9,%r9
        bne+    .Lsw1                   /* at least one queue non-empty */
 
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
@@ -102,23 +102,23 @@
 #if defined(PPC_IBM4XX)
        wrteei  1                       /* reenable ints again */
 #else /* PPC_OEA */
-       mfmsr   3
-       ori     3,3,PSL_EE@l            /* reenable ints again */
-       mtmsr   3
+       mfmsr   %r3
+       ori     %r3,%r3,PSL_EE@l        /* reenable ints again */
+       mtmsr   %r3
        isync
 #endif
 
 /* Check if we can use power saving mode */
-       lis     8,_C_LABEL(powersave)@ha
-       lwz     9,_C_LABEL(powersave)@l(8)
+       lis     %r8,_C_LABEL(powersave)@ha
+       lwz     %r9,_C_LABEL(powersave)@l(%r8)
 
-       add.    9,9,9
+       add.    %r9,%r9,%r9
        ble     1f
 
 #if defined(PPC_OEA)
        sync
-       oris    3,3,PSL_POW@h           /* enter power saving mode */
-       mtmsr   3
+       oris    %r3,%r3,PSL_POW@h       /* enter power saving mode */
+       mtmsr   %r3
        isync
 #endif /* PPC_OEA */
 
@@ -127,9 +127,9 @@
        wrteei  0                       /* disable interrupts while
                                           manipulating runque */
 #else /* PPC_OEA */
-       andi.   3,3,~PSL_EE@l           /* disable interrupts while
+       andi.   %r3,%r3,~PSL_EE@l       /* disable interrupts while
                                           manipulating runque */
-       mtmsr   3
+       mtmsr   %r3
 #endif
 
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
@@ -143,19 +143,19 @@
  */
 ENTRY(switch_exit)
 /* First switch to the idle pcb/kernel stack */
-       GET_CPUINFO(7)
-       lwz     6,CI_IDLE_PCB(7)
-       stw     6,CI_CURPCB(7)
+       GET_CPUINFO(%r7)
+       lwz     %r6,CI_IDLE_PCB(%r7)
+       stw     %r6,CI_CURPCB(%r7)
 
        /*
         * Adjust the stack to provide space for the callee to save LR.
         */
-       addi    1,6,USPACE-16
+       addi    %r1,%r6,USPACE-CALLFRAMELEN
        /*
         * Schedule the vmspace and stack to be freed (the proc arg is
         * already in r3).  Function to call is in r4.
         */
-       mtctr   4
+       mtctr   %r4
        bctrl
 
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
@@ -163,49 +163,53 @@
 #endif
 
 /* Fall through to cpu_switch to actually select another proc */
-       li      3,0                     /* indicate exited process */
+       li      %r3,0                   /* indicate exited process */
 
 /*
  * void cpu_switch(struct lwp *l)
  * Find a runnable process and switch to it.
  */
 ENTRY_NOPROFILE(cpu_switch)
-       mflr    0                       /* save lr */
-       stw     0,4(1)
-       stwu    1,-16(1)
-       stw     31,12(1)
-       stw     30,8(1)
+       mflr    %r0                     /* save lr */
+       stw     %r0,SZREG(%r1)
+       stwu    %r1,-CALLFRAMELEN(%r1)
+       stw     %r31,(3*SZREG)(%r1)
+       stw     %r30,(2*SZREG)(%r1)
 
-       mr      30,3
+       mr      %r30,%r3
 #if defined(MULTIPROCESSOR)
        /* Switch to the idle PCB unless we're already running on it. */
-       GET_CPUINFO(7)
-       cmpwi   30,0                    /* old process was exiting? */
+       GET_CPUINFO(%r7)
+       cmpwi   %r30,0                  /* old process was exiting? */
        beq     1f
 
-       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,L_ADDR(30)
-       stw     1,PCB_SP(3)             /* save SP */
+#if defined(PPC_OEA) && !defined(_LP64)
+       mfsr    %r10,USER_SR            /* save USER_SR for copyin/copyout */
+#else
+       li      %r10,0                  /* no USER_SR needed */
+#endif
+       mfcr    %r11                    /* save cr */
+       mr      %r12,%r2                /* save r2 */
+       stwu    %r1,-SFRAMELEN(%r1)     /* still running on old stack */
+       stmw    %r10,(2*SZREG)(%r1)     /* save USER_SR, CR, R2, non-volatile */
+       lwz     %r3,L_ADDR(%r30)        /* get PCB address */
+       stw     %r1,PCB_SP(%r3)         /* save SP */
 
-       lwz     6,CI_IDLE_PCB(7)
-       addi    1,6,USPACE-16           /* 16 bytes are reserved at stack top */
+       lwz     %r6,CI_IDLE_PCB(%r7)
+       addi    %r1,%r6,USPACE-CALLFRAMELEN /* callframe rsvd at stack top */
 
 1:
-       li      31,0
-       stw     31,CI_CURLWP(7)         /* Zero to not accumulate cpu time */
-       lwz     31,CI_CURPCB(7)
+       li      %r31,0
+       stw     %r31,CI_CURLWP(%r7)     /* Zero to not accumulate cpu time */
+       lwz     %r31,CI_CURPCB(%r7)
 
-       lwz     3,CI_CPL(7)
-       stw     3,PCB_SPL(31)           /* save spl */
+       lwz     %r3,CI_CPL(%r7)
+       stw     %r3,PCB_SPL(%r31)       /* save spl */
 #else
-       GET_CPUINFO(3)
-       li      31,0
-       stw     31,CI_CURLWP(3)         /* Zero to not accumulate cpu time */
-       lwz     31,CI_CURPCB(3)
+       GET_CPUINFO(%r3)
+       li      %r31,0
+       stw     %r31,CI_CURLWP(%r3)     /* Zero to not accumulate cpu time */
+       lwz     %r31,CI_CURPCB(%r3)
 #endif
 
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
@@ -213,10 +217,10 @@
        bl      _C_LABEL(sched_unlock_idle)
 #endif
 
-       li      3,0                     /* spl0() */
+       li      %r3,0                   /* spl0() */
        bl      _C_LABEL(lcsplx)
 #if !defined(MULTIPROCESSOR)
-       stw     3,PCB_SPL(31)           /* save spl */
+       stw     %r3,PCB_SPL(%r31)       /* save spl */
 #endif
 
 /* Lock the scheduler. */
@@ -224,10 +228,10 @@
        wrteei  0                       /* disable interrupts while
                                           manipulating runque */
 #else /* PPC_OEA */
-       mfmsr   3
-       andi.   3,3,~PSL_EE@l           /* disable interrupts while
+       mfmsr   %r3
+       andi.   %r3,%r3,~PSL_EE@l       /* disable interrupts while
                                           manipulating runque */
-       mtmsr   3
+       mtmsr   %r3
        isync
 #endif
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
@@ -235,104 +239,99 @@
 #endif
 
 /* Find a new process */
-       lis     8,_C_LABEL(sched_whichqs)@ha
-       lwz     9,_C_LABEL(sched_whichqs)@l(8)
+       lis     %r8,_C_LABEL(sched_whichqs)@ha
+       lwz     %r9,_C_LABEL(sched_whichqs)@l(%r8)
 
-       or.     9,9,9
+       or.     %r9,%r9,%r9
        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 */
+       cntlzw  %r10,%r9
+       lis     %r4,_C_LABEL(sched_qs)@ha
+       addi    %r4,%r4,_C_LABEL(sched_qs)@l
+       slwi    %r3,%r10,3
+       add     %r3,%r3,%r4             /* select queue */
 
-       lwz     31,L_FORW(3)            /* unlink first proc from queue */
-       lwz     4,L_FORW(31)
-       stw     4,L_FORW(3)
-       stw     3,L_BACK(4)
+       lwz     %r31,L_FORW(%r3)        /* unlink first proc from queue */
+       lwz     %r4,L_FORW(%r31)
+       stw     %r4,L_FORW(%r3)
+       stw     %r3,L_BACK(%r4)
 
-       cmpl    0,3,4                   /* queue empty? */
+       cmpl    %cr0,%r3,%r4            /* 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 */
+       lis     %r3,0x80000000@h
+       srw     %r3,%r3,%r10
+       andc    %r9,%r9,%r3
+       stw     %r9,_C_LABEL(sched_whichqs)@l(%r8) /* mark it empty */
 
 switch_common:
 1:
        /* just did this resched thing */
-       li      3,0
-       GET_CPUINFO(4)
-       stw     3,CI_WANT_RESCHED(4)
-       stw     3,L_BACK(31)            /* probably superfluous */
+       li      %r3,0
+       GET_CPUINFO(%r4)
+       stw     %r3,CI_WANT_RESCHED(%r4)
+       stw     %r3,L_BACK(%r31)        /* probably superfluous */
 
 #ifdef MULTIPROCESSOR
-       stw     4,L_CPU(31)             /* l->l_cpu = curcpu() */
+       stw     %r4,L_CPU(%r31)         /* l->l_cpu = curcpu() */
 #endif
 
        /* Process now running on a processor. */
-       li      3,LSONPROC              /* l->l_stat = LSONPROC */
-       stw     3,L_STAT(31)
+       li      %r3,LSONPROC            /* l->l_stat = LSONPROC */
+       stw     %r3,L_STAT(%r31)
 
        /* record new process */
-       stw     31,CI_CURLWP(4)
-       lwz     4,L_ADDR(31)
+       stw     %r31,CI_CURLWP(%r4)
+       lwz     %r4,L_ADDR(%r31)
 
 #if !defined(MULTIPROCESSOR)           /* XXX */
-       li      3,0                     /* if it is the same lwp, return 0 */
-       cmpl    0,31,30                 /* is it the same lwp? */
+       li      %r3,0                   /* if it is the same lwp, return 0 */
+       cmpl    %cr0,%r31,%r30          /* is it the same lwp? */
        beq     switch_return
 
-       or.     30,30,30                /* old lwp was exiting? */
+       or.     %r30,%r30,%r30          /* old lwp was exiting? */
        beq     switch_exited
 
-#if defined(PPC_IBM4XX)
-       li      10,0                    /* no SR for 4xx CPUs */
+#if defined(PPC_OEA) && !defined(_LP64)
+       mfsr    %r10,USER_SR            /* save USER_SR for copyin/copyout */
 #else /* PPC_OEA */
-       mfsr    10,USER_SR              /* save USER_SR for copyin/copyout */
+       li      %r10,0                  /* no SR needed */
 #endif
-       mfcr    11                      /* save cr */
-       mr      12,2                    /* save r2 */
-       stwu    1,-SFRAMELEN(1)         /* still running on old stack */
-       stmw    10,8(1)
-       lwz     3,L_ADDR(30)
-       stw     1,PCB_SP(3)             /* save SP */



Home | Main Index | Thread Index | Old Index