Use %r<n> for register names.

This commit is contained in:
eeh 2003-08-03 23:26:55 +00:00
parent 9cf81bef79
commit f77f1feee5
3 changed files with 127 additions and 126 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: walnut_start.S,v 1.7 2003/04/27 10:42:50 ragge Exp $ */
/* $NetBSD: walnut_start.S,v 1.8 2003/08/03 23:26:55 eeh Exp $ */
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
/*
@ -68,6 +68,7 @@
*/
#undef PPC_4XX_NOCACHE
#define _NOREGNAMES
#include "opt_ddb.h"
#include "opt_ipkdb.h"
@ -147,17 +148,17 @@ __start:
nop
1:
mr 31,3 /* Save address of PROM info_block */
li 0,0
mtmsr 0 /* Disable FPU/MMU/exceptions */
mr %r31,%r3 /* Save address of PROM info_block */
li %r0,0
mtmsr %r0 /* Disable FPU/MMU/exceptions */
isync
/* PPC405GP errata, item #58.
* Load string instructions may write incorrect data into the last GPR
* targeted in the operation.
* Workaround: set OCM0_DSCNTL[DSEN]=0 and OCM0_DSCNTL[DOF]=0 */
mtdcr DCR_OCM0_DSCNTL, 0 /* Disable Data access to OCM */
mtdcr DCR_OCM0_ISCNTL, 0 /* Disable Instruction access to OCM. Just in case */
mtdcr DCR_OCM0_DSCNTL, %r0 /* Disable Data access to OCM */
mtdcr DCR_OCM0_ISCNTL, %r0 /* Disable Instruction access to OCM. Just in case */
/*
* Cpu detect.
*
@ -165,38 +166,38 @@ __start:
__start_cpu0:
#ifdef PPC_4XX_NOCACHE
/* Disable all caches for physical addresses */
li 0,0
li %r0,0
#else
/* Allow cacheing for only the first 2GB of RAM */
lis 0,0xffff
lis %r0,0xffff
#endif
mtdccr 0
mticcr 0
mtdccr %r0
mticcr %r0
/* Invalidate all TLB entries */
tlbia
sync
isync
/* get start of bss */
lis 3,_C_LABEL(_edata)-4@ha
addi 3,3,_C_LABEL(_edata)-4@l
lis %r3,_C_LABEL(_edata)-4@ha
addi %r3,%r3,_C_LABEL(_edata)-4@l
/* get end of kernel memory */
lis 8,_C_LABEL(end)@ha
addi 8,8,_C_LABEL(end)@l
lis %r8,_C_LABEL(end)@ha
addi %r8,%r8,_C_LABEL(end)@l
/* zero bss */
li 4,0
2: stwu 4,4(3)
cmpw 3,8
li %r4,0
2: stwu %r4,%r4(3)
cmpw %r3,%r8
bne+ 2b
#if NKSYMS || defined(DDB) || defined(LKM)
/* If we had symbol table location we'd store it here and would've adjusted r8 here */
lis 7,_C_LABEL(startsym)@ha
addi 7,7,_C_LABEL(startsym)@l
stw 8,0(7)
lis 7,_C_LABEL(endsym)@ha
addi 7,7,_C_LABEL(endsym)@l
stw 8,0(7)
lis %r7,_C_LABEL(startsym)@ha
addi %r7,%r7,_C_LABEL(startsym)@l
stw %r8,0(%r7)
lis %r7,_C_LABEL(endsym)@ha
addi %r7,%r7,_C_LABEL(endsym)@l
stw %r8,0(%r7)
#endif
/*
@ -205,60 +206,60 @@ __start_cpu0:
* XXX: Skip TLB 0 for now, due to unresolved TLB 0 replacement
* and hard hangs
*/
li 0,1
mtpid 0
li %r0,1
mtpid %r0
sync
li 0,0
li %r0,0
#ifdef PPC_4XX_NOCACHE
li 4,TLB_EX|TLB_WR|TLB_I /* |TLB_W */
li %r4,TLB_EX|TLB_WR|TLB_I /* |TLB_W */
#else
li 4,TLB_EX|TLB_WR /* |TLB_W */
li %r4,TLB_EX|TLB_WR /* |TLB_W */
#endif
li 3,TLB_VALID|TLB_PG_16M
tlbwe 4,0,1 /* Load the data(Low) portion of the entry */
tlbwe 3,0,0 /* Load the tag(High) portion of the entry */
li %r3,TLB_VALID|TLB_PG_16M
tlbwe %r4,%r0,1 /* Load the data(Low) portion of the entry */
tlbwe %r3,%r0,0 /* Load the tag(High) portion of the entry */
#if 1
/* Damn. Have to be able to access all real memory.... Hardcode for 32M for now. */
li 0,1
lis 4,0x01000000@h
ori 3,4,0
li %r0,1
lis %r4,0x01000000@h
ori %r3,%r4,0
#ifdef PPC_4XX_NOCACHE
addi 4,4,TLB_EX|TLB_WR|TLB_I /* |TLB_W */
addi %r4,%r4,TLB_EX|TLB_WR|TLB_I /* |TLB_W */
#else
addi 4,4,TLB_EX|TLB_WR /* |TLB_W */
addi %r4,%r4,TLB_EX|TLB_WR /* |TLB_W */
#endif
addi 3,3,TLB_VALID|TLB_PG_16M
tlbwe 4,0,1 /* Load the data(Low) portion of the entry */
tlbwe 3,0,0 /* Load the tag(High) portion of the entry */
addi %r3,%r3,TLB_VALID|TLB_PG_16M
tlbwe %r4,%r0,1 /* Load the data(Low) portion of the entry */
tlbwe %r3,%r0,0 /* Load the tag(High) portion of the entry */
#endif
/* set up a TLB mapping to cover uart0 */
lis 3,0xef000000@h /* Load the virtual address */
ori 4,3,0 /* Load the physical address */
lis %r3,0xef000000@h /* Load the virtual address */
ori %r4,%r3,0 /* Load the physical address */
clrrwi 4,4,10 /* Mask off the real page number */
clrrwi %r4,%r4,10 /* Mask off the real page number */
/* write, execute, cache inhibit, guarded */
ori 4,4,(TLB_WR|TLB_EX|TLB_I|TLB_G)
ori %r4,%r4,(TLB_WR|TLB_EX|TLB_I|TLB_G)
clrrwi 3,3,10 /* Mask off the effective page number */
ori 3,3,(TLB_VALID|TLB_PG_16M)
clrrwi %r3,%r3,10 /* Mask off the effective page number */
ori %r3,%r3,(TLB_VALID|TLB_PG_16M)
li 0,2
li %r0,2
tlbwe 4,0,1 /* Load the data portion of the entry */
tlbwe 3,0,0 /* Load the tag portion of the entry */
tlbwe %r4,%r0,1 /* Load the data portion of the entry */
tlbwe %r3,%r0,0 /* Load the tag portion of the entry */
/* END of TLB setup */
INIT_CPUINFO(8,1,9,0)
mr 4,8
mr %r4,%r8
lis 3,__start@ha
addi 3,3,__start@l
lis %r3,__start@ha
addi %r3,%r3,__start@l
mr 6,31 /* info_block address */
mr %r6,%r31 /* info_block address */
bl _C_LABEL(initppc)
bl _C_LABEL(main)

View File

@ -1,4 +1,4 @@
/* $NetBSD: 4xx_locore.S,v 1.3 2003/07/25 10:12:42 scw Exp $ */
/* $NetBSD: 4xx_locore.S,v 1.4 2003/08/03 23:26:55 eeh Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -89,9 +89,9 @@
.globl _C_LABEL(ppc4xx_reset)
_C_LABEL(ppc4xx_reset):
mfspr 3,SPR_DBCR0
oris 3,r13,DBCR0_RST_SYSTEM@h
mtspr SPR_DBCR0,3
mfspr %r3,SPR_DBCR0
oris %r3,%r13,DBCR0_RST_SYSTEM@h
mtspr SPR_DBCR0,%r3
ba 0
#if 0
@ -101,17 +101,17 @@ _C_LABEL(ppc4xx_reset):
/*
* void bcopy(const void *src, void *dst, size_t len);
*
* swap r3 and r4 and fall through to memcopy.
* swap %r3 and %r4 and fall through to memcopy.
*/
.globl _C_LABEL(bcopy)
_C_LABEL(bcopy):
mr r0,r3
mr r3,r4
mr r4,r0
mr %r0,%r3
mr %r3,%r4
mr %r4,%r0
/* FALLTHROUGH */
/*
* void * memcpy(void *dst (r3), const void *src (r4), size_t len (r5));
* void * memcpy(void *dst (%r3), const void *src (%r4), size_t len (%r5));
*
* Copy memory (obviously)
*
@ -121,71 +121,71 @@ _C_LABEL(bcopy):
*
* Register use:
*
* r1 stack (of course)
* r3 dst
* r4 src
* r5 len
* r6 tmp
* r7 holds 32
* r8 holds dst
* r24-r31 block move regs
* %r1 stack (of course)
* %r3 dst
* %r4 src
* %r5 len
* %r6 tmp
* %r7 holds 32
* %r8 holds dst
* %r24-%r31 block move regs
*
*/
ENTRY(memcpy)
stwu r1,-(10*4)(r1) /* Allocate some RAM to save 8 regs to. */
cmpwi r5, 32 /* Less than 32 bytes ? */
stmw r24,8(r1) /* Save ALL regs (could be optimized) */
stwu %r1,-(10*4)(%r1) /* Allocate some RAM to save 8 regs to. */
cmpwi %r5, 32 /* Less than 32 bytes ? */
stmw %r24,8(%r1) /* Save ALL regs (could be optimized) */
mr r8,r3 /* save dst */
li r7,32
mr %r8,%r3 /* save dst */
li %r7,32
dcbt 0,r4 /* Start bringing in cache line. */
dcbt %r0,%r4 /* Start bringing in cache line. */
blt 1f /* Finish up */
neg r6,r3 /* Find how far unaligned we are... */
andi. r6,r6,31 /* Cache-align dest. */
mtxer r6
sub r5,r5,r6 /* subtract count */
lswx r24,0,r4 /* Load some. */
add r4,r4,r6
dcbt 0,r4 /* Fetch next line */
stswx r24,0,r3 /* Store some */
add r3,r3,r6
addic. r6,r5,-32 /* Pre-decrement next line */
neg %r6,%r3 /* Find how far unaligned we are... */
andi. %r6,%r6,31 /* Cache-align dest. */
mtxer %r6
sub %r5,%r5,%r6 /* subtract count */
lswx %r24,%r0,%r4 /* Load some. */
add %r4,%r4,%r6
dcbt %r0,%r4 /* Fetch next line */
stswx %r24,%r0,%r3 /* Store some */
add %r3,%r3,%r6
addic. %r6,%r5,-32 /* Pre-decrement next line */
ble 1f /* Less than 32-bytes? finishup */
/* Dest should not be cache line aligned. */
/* XXX need gas 2.11 to grok dcba insn */
#ifdef GAS_2_11
dcba 0,r3 /* Allocate a line */
dcba %r0,%r3 /* Allocate a line */
#else
.long 0x7c001dec /* dcba 0,r3 */
#endif
0:
dcbt r7,r4 /* Bring in the next line, too */
dcbt %r7,%r4 /* Bring in the next line, too */
lswi r24,r4,32
addi r4,r4,32 /* Inc src */
mr r5,r6
lswi %r24,%r4,32
addi %r4,%r4,32 /* Inc src */
mr %r5,%r6
addic. r6,r5,-32
stswi r24,r3,32
addi r3,r3,32 /* Inc dst */
addic. %r6,%r5,-32
stswi %r24,%r3,32
addi %r3,%r3,32 /* Inc dst */
#ifdef GAS_2_11
dcba 0,r3 /* Allocate another line */
dcba 0,%r3 /* Allocate another line */
#else
.long 0x7c071dec /* dcba r7,r3 */
.long 0x7c071dec /* dcba %r7,%r3 */
#endif
bgt 0b
1:
mtxer r5 /* Store byte count */
lswx r24,0,r4 /* Load up to 32 bytes */
stswx r24,0,r3 /* Store up to 32 bytes */
mtxer %r5 /* Store byte count */
lswx %r24,%r0,%r4 /* Load up to 32 bytes */
stswx %r24,%r0,%r3 /* Store up to 32 bytes */
mr r3,r8 /* Return dst */
mr %r3,%r8 /* Return dst */
lmw r24,8(r1)
addi r1,r1,(10*4)
lmw %r24,8(%r1)
addi %r1,%r1,(10*4)
blr
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: 4xx_trap_subr.S,v 1.3 2003/03/11 10:40:16 hannken Exp $ */
/* $NetBSD: 4xx_trap_subr.S,v 1.4 2003/08/03 23:26:55 eeh Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -79,18 +79,18 @@ _C_LABEL(errata51size) = .-_C_LABEL(errata51handler)
.globl _C_LABEL(tlbdmiss4xx),_C_LABEL(tlbdm4size)
_C_LABEL(tlbdmiss4xx):
STANDARD_PROLOG(tlbsave)
mfdear r30 /* Get fault address */
mfesr r31
stmw r30,16+tlbsave(0)
mfdear %r30 /* Get fault address */
mfesr %r31
stmw %r30,16+tlbsave(0)
bla s4xx_miss
_C_LABEL(tlbdm4size) = .-_C_LABEL(tlbdmiss4xx)
.globl _C_LABEL(tlbimiss4xx),_C_LABEL(tlbim4size)
_C_LABEL(tlbimiss4xx):
STANDARD_PROLOG(tlbsave)
mfsrr0 r30 /* XXX Get fault address */
mfesr r31
stmw r30,16+tlbsave(0)
mfsrr0 %r30 /* XXX Get fault address */
mfesr %r31
stmw %r30,16+tlbsave(0)
bla s4xx_miss
_C_LABEL(tlbim4size) = .-_C_LABEL(tlbimiss4xx)
@ -98,12 +98,12 @@ s4xx_miss:
.globl _C_LABEL(pmap_tlbmiss)
/* If the kernel stack would fault, don't use it. */
mfpid r30
li r31,KERNEL_PID
mtpid r31
li r31,-FRAMELEN
tlbsx. r31,r31,r1
mtpid r30
mfpid %r30
li %r31,KERNEL_PID
mtpid %r31
li %r31,-FRAMELEN
tlbsx. %r31,%r31,%r1
mtpid %r30
beq 1f
/*
@ -117,22 +117,22 @@ s4xx_miss:
*/
/* Switch to tlbstack */
addi r30,r1,-FRAMELEN
lis r1,tlbstack@ha
addi r1,r1,tlbstack@l
stw r30,4(1)
addi %r30,%r1,-FRAMELEN
lis %r1,tlbstack@ha
addi %r1,%r1,tlbstack@l
stw %r30,4(1)
FRAME_SETUP(tlbsave)
/* Take an explicit fault at (kernelstack,pid) */
lwz r3, tlbstack+4(0)
li r4,KERNEL_PID
lwz %r3, tlbstack+4(0)
li %r4,KERNEL_PID
bl _C_LABEL(pmap_tlbmiss)
/*
* We can retry the old fault or switch stacks and
* take it now. It's easier to retry.
*/
mr. r3,r3
mr. %r3,%r3
beq 2f
/* kernel stack not in the pmap? we should panic */
@ -140,15 +140,15 @@ s4xx_miss:
ba trapagain
1:
FRAME_SETUP(tlbsave)
lwz r3,FRAME_DEAR+8(1)
lwz r4,FRAME_PID+8(1)
lwz %r3,FRAME_DEAR+8(1)
lwz %r4,FRAME_PID+8(1)
bl _C_LABEL(pmap_tlbmiss)
mr. r3,r3
mr. %r3,%r3
beq 2f
/* XXX DEBUG -- make sure we're not on tlbstack */
addi r7,r1,-tlbsave
twllei r7,(tlbstacksize)
addi %r7,%r1,-tlbsave
twllei %r7,(tlbstacksize)
/* PTE not found, time to cause a fault */
ba trapagain