Some powerpc cleanup. Remove unneeded/bad usage of extern oeacpufeat.
Convert asm code to use %r register format. Done by comparison to disassembled output, double checked with diff of dissasembled output before and after, and test booted on my 7044.
This commit is contained in:
parent
c4bfcd4e81
commit
86a2448d10
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu_subr.c,v 1.43 2008/02/05 18:52:56 garbled Exp $ */
|
||||
/* $NetBSD: cpu_subr.c,v 1.44 2008/02/14 19:41:54 garbled Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Matt Thomas.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.43 2008/02/05 18:52:56 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.44 2008/02/14 19:41:54 garbled Exp $");
|
||||
|
||||
#include "opt_ppcparam.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
|
@ -236,8 +236,6 @@ char cpu_model[80];
|
|||
|
||||
/* This is to be called from locore.S, and nowhere else. */
|
||||
|
||||
extern unsigned long oeacpufeat;
|
||||
|
||||
void
|
||||
cpu_model_init(void)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: oea_machdep.c,v 1.43 2008/02/07 03:20:16 garbled Exp $ */
|
||||
/* $NetBSD: oea_machdep.c,v 1.44 2008/02/14 19:41:54 garbled Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 Matt Thomas
|
||||
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.43 2008/02/07 03:20:16 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.44 2008/02/14 19:41:54 garbled Exp $");
|
||||
|
||||
#include "opt_ppcarch.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -97,7 +97,6 @@ struct vm_map *phys_map = NULL;
|
|||
* Global variables used here and there
|
||||
*/
|
||||
extern struct user *proc0paddr;
|
||||
extern unsigned long oeacpufeat;
|
||||
|
||||
static void trap0(void *);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ofw_subr.S,v 1.6 2008/01/28 21:06:29 garbled Exp $ */
|
||||
/* $NetBSD: ofw_subr.S,v 1.7 2008/02/14 19:41:54 garbled Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -58,39 +58,39 @@ GLOBAL(ofwreal_incharge)
|
|||
*/
|
||||
ENTRY_NOPROFILE(ofwinit)
|
||||
#ifdef FIRMWORKSBUGS
|
||||
mfmsr 0
|
||||
andi. 0,0,PSL_IR|PSL_DR
|
||||
mfmsr %r0
|
||||
andi. %r0,%r0,PSL_IR|PSL_DR
|
||||
beq 1f
|
||||
|
||||
li 8,1
|
||||
lis 9,ofwreal_incharge@ha
|
||||
stw 8,ofwreal_incharge@l(9)
|
||||
li %r8,1
|
||||
lis %r9,ofwreal_incharge@ha
|
||||
stw %r8,ofwreal_incharge@l(9)
|
||||
|
||||
mflr 30
|
||||
mflr %r30
|
||||
bl _C_LABEL(ofwr_init)
|
||||
mtlr 30
|
||||
mtlr %r30
|
||||
1:
|
||||
#endif
|
||||
lis 8,openfirmware_entry@ha
|
||||
stw 5,openfirmware_entry@l(8) /* save client interface handler*/
|
||||
lis %r8,openfirmware_entry@ha
|
||||
stw %r5,openfirmware_entry@l(%r8) /* save client interface handler*/
|
||||
|
||||
mfmsr 0
|
||||
lis 9,ofmsr@ha
|
||||
stwu 0,ofmsr@l(9) /* save initial MSR value */
|
||||
mfmsr %r0
|
||||
lis %r9,ofmsr@ha
|
||||
stwu %r0,ofmsr@l(%r9) /* save initial MSR value */
|
||||
|
||||
mfsprg 0,0 /* save SPRGs */
|
||||
stwu 0,4(9)
|
||||
mfsprg 0,1
|
||||
stwu 0,4(9)
|
||||
mfsprg 0,2
|
||||
stwu 0,4(9)
|
||||
mfsprg 0,3
|
||||
stw 0,4(9)
|
||||
mfsprg %r0,0 /* save SPRGs */
|
||||
stwu %r0,4(%r9)
|
||||
mfsprg %r0,1
|
||||
stwu %r0,4(%r9)
|
||||
mfsprg %r0,2
|
||||
stwu %r0,4(%r9)
|
||||
mfsprg %r0,3
|
||||
stw %r0,4(%r9)
|
||||
|
||||
lis 8,OF_buffer@ha
|
||||
addi 8,8,OF_buffer@l
|
||||
lis 9,_C_LABEL(OF_buf)@ha
|
||||
stw 8,_C_LABEL(OF_buf)@l(9)
|
||||
lis %r8,OF_buffer@ha
|
||||
addi %r8,%r8,OF_buffer@l
|
||||
lis %r9,_C_LABEL(OF_buf)@ha
|
||||
stw %r8,_C_LABEL(OF_buf)@l(%r9)
|
||||
|
||||
blr
|
||||
|
||||
|
@ -99,99 +99,99 @@ ENTRY_NOPROFILE(ofwinit)
|
|||
*/
|
||||
.text
|
||||
ENTRY(openfirmware)
|
||||
mflr 0 /* save return address */
|
||||
stw 0,4(1)
|
||||
stwu 1,-16(1) /* setup stack frame */
|
||||
mflr %r0 /* save return address */
|
||||
stw %r0,4(%r1)
|
||||
stwu %r1,-16(%r1) /* setup stack frame */
|
||||
|
||||
lis 4,openfirmware_entry@ha /* get firmware entry point */
|
||||
lwz 4,openfirmware_entry@l(4)
|
||||
mtlr 4
|
||||
lis %r4,openfirmware_entry@ha /* get firmware entry point */
|
||||
lwz %r4,openfirmware_entry@l(%r4)
|
||||
mtlr %r4
|
||||
|
||||
mfsprg 5,0 /* save current sprg0 (curcpu) */
|
||||
lis 4,ofwsprg0save@ha
|
||||
addi 4,4,ofwsprg0save@l
|
||||
stw 5,0(4)
|
||||
mfsprg %r5,0 /* save current sprg0 (curcpu) */
|
||||
lis %r4,ofwsprg0save@ha
|
||||
addi %r4,%r4,ofwsprg0save@l
|
||||
stw %r5,0(%r4)
|
||||
|
||||
#ifdef FIRMWORKSBUGS
|
||||
lis 4,ofwreal_incharge@ha
|
||||
lwz 4,ofwreal_incharge@l(4)
|
||||
cmpwi 4,1
|
||||
lis %r4,ofwreal_incharge@ha
|
||||
lwz %r4,ofwreal_incharge@l(%r4)
|
||||
cmpwi %r4,1
|
||||
bne 1f
|
||||
blrl
|
||||
b 4f
|
||||
1:
|
||||
#endif
|
||||
mfmsr 4 /* save msr */
|
||||
stw 4,8(1)
|
||||
mfmsr %r4 /* save msr */
|
||||
stw %r4,8(%r1)
|
||||
|
||||
li 0,0 /* clear battable translations */
|
||||
li %r0,0 /* clear battable translations */
|
||||
#if defined (PPC_OEA) || defined (PPC_OEA64_BRIDGE)
|
||||
mtdbatu 2,0
|
||||
mtdbatu 3,0
|
||||
mtibatu 2,0
|
||||
mtibatu 3,0
|
||||
mtdbatu 2,%r0
|
||||
mtdbatu 3,%r0
|
||||
mtibatu 2,%r0
|
||||
mtibatu 3,%r0
|
||||
#endif /* PPC_OEA */
|
||||
|
||||
lis 4,ofwsrsave@ha /* save current SRs */
|
||||
addi 4,4,ofwsrsave@l
|
||||
li 5,0
|
||||
1: mfsrin 0,5
|
||||
stw 0,0(4)
|
||||
addi 4,4,4
|
||||
addis 5,5,0x10000000@h
|
||||
cmpwi 5,0
|
||||
lis %r4,ofwsrsave@ha /* save current SRs */
|
||||
addi %r4,%r4,ofwsrsave@l
|
||||
li %r5,0
|
||||
1: mfsrin %r0,%r5
|
||||
stw %r0,0(%r4)
|
||||
addi %r4,%r4,4
|
||||
addis %r5,%r5,0x10000000@h
|
||||
cmpwi %r5,0
|
||||
bne 1b
|
||||
|
||||
lis 4,_C_LABEL(ofw_pmap)@ha /* load OFW SR */
|
||||
addi 4,4,_C_LABEL(ofw_pmap)@l
|
||||
lwz 0,PM_KERNELSR(4)
|
||||
cmpwi 0,0 /* pm_sr[KERNEL_SR] == 0? */
|
||||
lis %r4,_C_LABEL(ofw_pmap)@ha /* load OFW SR */
|
||||
addi %r4,%r4,_C_LABEL(ofw_pmap)@l
|
||||
lwz %r0,PM_KERNELSR(%r4)
|
||||
cmpwi %r0,0 /* pm_sr[KERNEL_SR] == 0? */
|
||||
beq 2f /* then skip (not initialized yet) */
|
||||
li 5,0
|
||||
1: lwz 0,0(4)
|
||||
mtsrin 0,5
|
||||
addi 4,4,4
|
||||
addis 5,5,0x10000000@h
|
||||
cmpwi 5,0
|
||||
li %r5,0
|
||||
1: lwz %r0,0(%r4)
|
||||
mtsrin %r0,%r5
|
||||
addi %r4,%r4,4
|
||||
addis %r5,%r5,0x10000000@h
|
||||
cmpwi %r5,0
|
||||
bne 1b
|
||||
2:
|
||||
lis 4,ofmsr@ha /* Open Firmware msr + sprg[0-3] */
|
||||
lwzu 5,ofmsr+16@l(4)
|
||||
mtsprg 3,5
|
||||
lwzu 5,-4(4)
|
||||
mtsprg 2,5
|
||||
lwzu 5,-4(4)
|
||||
mtsprg 1,5
|
||||
lwzu 5,-4(4)
|
||||
mtsprg 0,5
|
||||
lwz 5,-4(4)
|
||||
mtmsr 5
|
||||
lis %r4,ofmsr@ha /* Open Firmware msr + sprg[0-3] */
|
||||
lwzu %r5,ofmsr+16@l(%r4)
|
||||
mtsprg 3,%r5
|
||||
lwzu %r5,-4(%r4)
|
||||
mtsprg 2,%r5
|
||||
lwzu %r5,-4(%r4)
|
||||
mtsprg 1,%r5
|
||||
lwzu %r5,-4(%r4)
|
||||
mtsprg 0,%r5
|
||||
lwz %r5,-4(%r4)
|
||||
mtmsr %r5
|
||||
isync
|
||||
|
||||
blrl /* call Open Firmware */
|
||||
|
||||
lis 4,ofwsrsave@ha /* restore saved SRs */
|
||||
addi 4,4,ofwsrsave@l
|
||||
li 5,0
|
||||
1: lwz 0,0(4)
|
||||
mtsrin 0,5
|
||||
addi 4,4,4
|
||||
addis 5,5,0x10000000@h
|
||||
cmpwi 5,0
|
||||
lis %r4,ofwsrsave@ha /* restore saved SRs */
|
||||
addi %r4,%r4,ofwsrsave@l
|
||||
li %r5,0
|
||||
1: lwz %r0,0(%r4)
|
||||
mtsrin %r0,%r5
|
||||
addi %r4,%r4,4
|
||||
addis %r5,%r5,0x10000000@h
|
||||
cmpwi %r5,0
|
||||
bne 1b
|
||||
|
||||
lwz 4,8(1) /* restore msr */
|
||||
mtmsr 4
|
||||
lwz %r4,8(%r1) /* restore msr */
|
||||
mtmsr %r4
|
||||
isync
|
||||
4:
|
||||
lis 4,ofwsprg0save@ha /* restore saved sprg0 (curcpu) */
|
||||
addi 4,4,ofwsprg0save@l
|
||||
lwz 5,0(4)
|
||||
mtsprg 0,5
|
||||
lis %r4,ofwsprg0save@ha /* restore saved sprg0 (curcpu) */
|
||||
addi %r4,%r4,ofwsprg0save@l
|
||||
lwz %r5,0(%r4)
|
||||
mtsprg 0,%r5
|
||||
|
||||
lwz 1,0(1) /* and return */
|
||||
lwz 0,4(1)
|
||||
mtlr 0
|
||||
lwz %r1,0(%r1) /* and return */
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
/*
|
||||
|
@ -228,38 +228,38 @@ ENTRY(openfirmware)
|
|||
*/
|
||||
|
||||
ENTRY(ofw_stack)
|
||||
mfmsr 8 /* turn off interrupts */
|
||||
andi. 0,8,~(PSL_EE|PSL_RI)@l
|
||||
mtmsr 0
|
||||
stw 8,4(1) /* abuse return address slot */
|
||||
mfmsr %r8 /* turn off interrupts */
|
||||
andi. %r0,%r8,~(PSL_EE|PSL_RI)@l
|
||||
mtmsr %r0
|
||||
stw %r8,4(%r1) /* abuse return address slot */
|
||||
|
||||
lwz 5,0(1) /* get length of stack frame */
|
||||
subf 5,1,5
|
||||
lwz %r5,0(%r1) /* get length of stack frame */
|
||||
subf %r5,%r1,%r5
|
||||
|
||||
lis 7,firmstk+NBPG-8@ha
|
||||
addi 7,7,firmstk+NBPG-8@l
|
||||
lis 6,ofw_back@ha
|
||||
addi 6,6,ofw_back@l
|
||||
subf 4,5,7 /* make room for stack frame on
|
||||
lis %r7,firmstk+NBPG-8@ha
|
||||
addi %r7,%r7,firmstk+NBPG-8@l
|
||||
lis %r6,ofw_back@ha
|
||||
addi %r6,%r6,ofw_back@l
|
||||
subf %r4,%r5,%r7 /* make room for stack frame on
|
||||
new stack */
|
||||
stw 6,-4(7) /* setup return pointer */
|
||||
stwu 1,-8(7)
|
||||
stw %r6,-4(%r7) /* setup return pointer */
|
||||
stwu %r1,-8(%r7)
|
||||
|
||||
stw 7,-8(4)
|
||||
stw %r7,-8(%r4)
|
||||
|
||||
addi 3,1,8
|
||||
addi 1,4,-8
|
||||
subi 5,5,8
|
||||
addi %r3,%r1,8
|
||||
addi %r1,%r4,-8
|
||||
subi %r5,%r5,8
|
||||
|
||||
b _C_LABEL(ofbcopy) /* and copy it */
|
||||
|
||||
ofw_back:
|
||||
lwz 1,0(1) /* get callers original stack pointer */
|
||||
lwz %r1,0(%r1) /* get callers original stack pointer */
|
||||
|
||||
lwz 0,4(1) /* get saved msr from abused slot */
|
||||
mtmsr 0
|
||||
lwz %r0,4(%r1) /* get saved msr from abused slot */
|
||||
mtmsr %r0
|
||||
|
||||
lwz 1,0(1) /* return */
|
||||
lwz 0,4(1)
|
||||
mtlr 0
|
||||
lwz %r1,0(%r1) /* return */
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ofwoea_machdep.c,v 1.11 2008/02/11 17:32:18 garbled Exp $ */
|
||||
/* $NetBSD: ofwoea_machdep.c,v 1.12 2008/02/14 19:41:54 garbled Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.11 2008/02/11 17:32:18 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.12 2008/02/14 19:41:54 garbled Exp $");
|
||||
|
||||
#include "opt_ppcarch.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -131,7 +131,6 @@ extern int chosen;
|
|||
extern uint32_t ticks_per_sec;
|
||||
extern uint32_t ns_per_tick;
|
||||
extern uint32_t ticks_per_intr;
|
||||
extern unsigned long oeacpufeat;
|
||||
|
||||
static int save_ofmap(struct ofw_translations *, int);
|
||||
static void restore_ofmap(struct ofw_translations *, int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: darwin_commpage_machdep.S,v 1.6 2005/12/11 12:18:46 christos Exp $ */
|
||||
/* $NetBSD: darwin_commpage_machdep.S,v 1.7 2008/02/14 19:41:54 garbled Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
|
@ -49,45 +49,45 @@
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_bzero)
|
||||
_C_LABEL(darwin_commpage_bzero):
|
||||
cmplwi r4,0
|
||||
cmplwi %r4,0
|
||||
beqlr
|
||||
li r0,0
|
||||
cmplwi r4,6
|
||||
li %r0,0
|
||||
cmplwi %r4,6
|
||||
bgt- bzero1
|
||||
addi r3,r3,-1
|
||||
addi %r3,%r3,-1
|
||||
bzero8:
|
||||
mtctr r4
|
||||
mtctr %r4
|
||||
bzero2:
|
||||
stbu r0,1(r3)
|
||||
stbu %r0,1(%r3)
|
||||
bdnz+ bzero2
|
||||
blr
|
||||
bzero1:
|
||||
andi. r5,r3,3
|
||||
andi. %r5,%r3,3
|
||||
beq+ bzero3
|
||||
andi. r5,r3,1
|
||||
andi. %r5,%r3,1
|
||||
beq- bzero5
|
||||
stb r0,0(r3)
|
||||
addi r3,r3,1
|
||||
addi r4,r4,-1
|
||||
andi. r5,r3,2
|
||||
stb %r0,0(%r3)
|
||||
addi %r3,%r3,1
|
||||
addi %r4,%r4,-1
|
||||
andi. %r5,%r3,2
|
||||
beq- bzero3
|
||||
bzero5:
|
||||
sth r0,0(r3)
|
||||
addi r3,r3,2
|
||||
addi r4,r4,-2
|
||||
sth %r0,0(%r3)
|
||||
addi %r3,%r3,2
|
||||
addi %r4,%r4,-2
|
||||
bzero3:
|
||||
cmplwi r4,4
|
||||
cmplwi %r4,4
|
||||
blt- bzero6
|
||||
rlwinm r5,r4,30,2,31
|
||||
mtctr r5
|
||||
addi r3,r3,-4
|
||||
rlwinm %r5,%r4,30,2,31
|
||||
mtctr %r5
|
||||
addi %r3,%r3,-4
|
||||
bzero7:
|
||||
stwu r0,4(r3)
|
||||
stwu %r0,4(%r3)
|
||||
bdnz+ bzero7
|
||||
bzero6:
|
||||
andi. r4,r4,3
|
||||
andi. %r4,%r4,3
|
||||
beqlr+
|
||||
addi r3,r3,3
|
||||
addi %r3,%r3,3
|
||||
b bzero8
|
||||
.globl _C_LABEL(darwin_commpage_bzero_size)
|
||||
_C_LABEL(darwin_commpage_bzero_size) = .-_C_LABEL(darwin_commpage_bzero)
|
||||
|
@ -98,7 +98,7 @@ _C_LABEL(darwin_commpage_bzero_size) = .-_C_LABEL(darwin_commpage_bzero)
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_pthread_self)
|
||||
_C_LABEL(darwin_commpage_pthread_self):
|
||||
li r0,MACH_FASTTRAPS_SYS_cthread_self+MACH_FASTTRAPS
|
||||
li %r0,MACH_FASTTRAPS_SYS_cthread_self+MACH_FASTTRAPS
|
||||
sc
|
||||
blr
|
||||
.globl _C_LABEL(darwin_commpage_pthread_self_size)
|
||||
|
@ -109,7 +109,7 @@ _C_LABEL(darwin_commpage_pthread_self_size) = .-_C_LABEL(darwin_commpage_pthread
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_gettimeofday)
|
||||
_C_LABEL(darwin_commpage_gettimeofday):
|
||||
li r0,DARWIN_SYS_gettimeofday
|
||||
li %r0,DARWIN_SYS_gettimeofday
|
||||
sc
|
||||
blr /* Skipped on success */
|
||||
blr
|
||||
|
@ -126,14 +126,14 @@ _C_LABEL(darwin_commpage_gettimeofday_size) = .-_C_LABEL(darwin_commpage_gettime
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_bigcopy)
|
||||
_C_LABEL(darwin_commpage_bigcopy):
|
||||
stwu r1,-16(r1)
|
||||
stw r31,0(r1)
|
||||
1: lwz r31,0(r12)
|
||||
stw r31,0(r4)
|
||||
addi r5,r5,-4
|
||||
cmplwi r5,0
|
||||
stwu %r1,-16(%r1)
|
||||
stw %r31,0(%r1)
|
||||
1: lwz %r31,0(%r12)
|
||||
stw %r31,0(%r4)
|
||||
addi %r5,%r5,-4
|
||||
cmplwi %r5,0
|
||||
bgt 1b
|
||||
lwz r31,0(r1)
|
||||
lwz %r31,0(%r1)
|
||||
blr
|
||||
.globl _C_LABEL(darwin_commpage_bigcopy_size)
|
||||
_C_LABEL(darwin_commpage_bigcopy_size) = .-_C_LABEL(darwin_commpage_bigcopy)
|
||||
|
@ -143,9 +143,9 @@ _C_LABEL(darwin_commpage_bigcopy_size) = .-_C_LABEL(darwin_commpage_bigcopy)
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_bcopy)
|
||||
_C_LABEL(darwin_commpage_bcopy):
|
||||
mr r6,r3 /* swap $1 and $2 */
|
||||
mr r3,r4
|
||||
mr r4,r6
|
||||
mr %r6,%r3 /* swap $1 and $2 */
|
||||
mr %r3,%r4
|
||||
mr %r4,%r6
|
||||
ba 0xffff87a0 /* Absolute branch to memcpy */
|
||||
.globl _C_LABEL(darwin_commpage_bcopy_size)
|
||||
_C_LABEL(darwin_commpage_bcopy_size) = .-_C_LABEL(darwin_commpage_bcopy)
|
||||
|
@ -155,61 +155,61 @@ _C_LABEL(darwin_commpage_bcopy_size) = .-_C_LABEL(darwin_commpage_bcopy)
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_memcpy)
|
||||
_C_LABEL(darwin_commpage_memcpy):
|
||||
subfic r0,r5,0
|
||||
adde r9,r0,r5
|
||||
stwu r1,-16(r1)
|
||||
xor r0,r3,r4
|
||||
subfic r8,r0,0
|
||||
adde r0,r8,r0
|
||||
or. r11,r9,r0
|
||||
mr r11,r3
|
||||
subfic %r0,%r5,0
|
||||
adde %r9,%r0,%r5
|
||||
stwu %r1,-16(%r1)
|
||||
xor %r0,%r3,%r4
|
||||
subfic %r8,%r0,0
|
||||
adde %r0,%r8,%r0
|
||||
or. %r11,%r9,%r0
|
||||
mr %r11,%r3
|
||||
bne- memcpy1
|
||||
or r0,r4,r3
|
||||
andi. r8,r0,3
|
||||
or %r0,%r4,%r3
|
||||
andi. %r8,%r0,3
|
||||
beq- memcpy2
|
||||
xor r0,r4,r3
|
||||
subfic r9,r5,3
|
||||
li r9,0
|
||||
adde r9,r9,r9
|
||||
clrlwi r0,r0,30
|
||||
mr r10,r5
|
||||
neg r0,r0
|
||||
rlwinm r0,r0,1,31,31
|
||||
or. r8,r0,r9
|
||||
xor %r0,%r4,%r3
|
||||
subfic %r9,%r5,3
|
||||
li %r9,0
|
||||
adde %r9,%r9,%r9
|
||||
clrlwi %r0,%r0,30
|
||||
mr %r10,%r5
|
||||
neg %r0,%r0
|
||||
rlwinm %r0,%r0,1,31,31
|
||||
or. %r8,%r0,%r9
|
||||
bne- memcpy3
|
||||
clrlwi r0,r4,30
|
||||
subfic r10,r0,4
|
||||
clrlwi %r0,%r4,30
|
||||
subfic %r10,%r0,4
|
||||
memcpy3:
|
||||
mtctr r10
|
||||
subf r5,r10,r5
|
||||
mtctr %r10
|
||||
subf %r5,%r10,%r5
|
||||
memcpy4:
|
||||
lbz r0,0(r4)
|
||||
addi r4,r4,1
|
||||
stb r0,0(r11)
|
||||
addi r11,r11,1
|
||||
lbz %r0,0(%r4)
|
||||
addi %r4,%r4,1
|
||||
stb %r0,0(%r11)
|
||||
addi %r11,%r11,1
|
||||
bdnz+ memcpy4
|
||||
memcpy2:
|
||||
rlwinm. r10,r5,30,2,31
|
||||
rlwinm. %r10,%r5,30,2,31
|
||||
beq- memcpy5
|
||||
mtctr r10
|
||||
mtctr %r10
|
||||
memcpy6:
|
||||
lwz r0,0(r4)
|
||||
addi r4,r4,4
|
||||
stw r0,0(r11)
|
||||
addi r11,r11,4
|
||||
lwz %r0,0(%r4)
|
||||
addi %r4,%r4,4
|
||||
stw %r0,0(%r11)
|
||||
addi %r11,%r11,4
|
||||
bdnz+ memcpy6
|
||||
memcpy5:
|
||||
andi. r10,r5,3
|
||||
andi. %r10,%r5,3
|
||||
beq- memcpy1
|
||||
mtctr r10
|
||||
mtctr %r10
|
||||
memcpy7:
|
||||
lbz r0,0(r4)
|
||||
addi r4,r4,1
|
||||
stb r0,0(r11)
|
||||
addi r11,r11,1
|
||||
lbz %r0,0(%r4)
|
||||
addi %r4,%r4,1
|
||||
stb %r0,0(%r11)
|
||||
addi %r11,%r11,1
|
||||
bdnz+ memcpy7
|
||||
memcpy1:
|
||||
addi r1,r1,16
|
||||
addi %r1,%r1,16
|
||||
blr
|
||||
.globl _C_LABEL(darwin_commpage_memcpy_size)
|
||||
_C_LABEL(darwin_commpage_memcpy_size) = .-_C_LABEL(darwin_commpage_memcpy)
|
||||
|
@ -220,11 +220,11 @@ _C_LABEL(darwin_commpage_memcpy_size) = .-_C_LABEL(darwin_commpage_memcpy)
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_pthread_getspecific)
|
||||
_C_LABEL(darwin_commpage_pthread_getspecific):
|
||||
rlwinm r5,r3,2,0,29
|
||||
li r0,MACH_FASTTRAPS_SYS_cthread_self+MACH_FASTTRAPS
|
||||
rlwinm %r5,%r3,2,0,29
|
||||
li %r0,MACH_FASTTRAPS_SYS_cthread_self+MACH_FASTTRAPS
|
||||
sc
|
||||
add r5,r5,r4
|
||||
lwzx r3,r3,r5
|
||||
add %r5,%r5,%r4
|
||||
lwzx %r3,%r3,%r5
|
||||
blr
|
||||
.globl _C_LABEL(darwin_commpage_pthread_getspecific_size)
|
||||
_C_LABEL(darwin_commpage_pthread_getspecific_size) = .-_C_LABEL(darwin_commpage_pthread_getspecific)
|
||||
|
@ -234,10 +234,10 @@ _C_LABEL(darwin_commpage_pthread_getspecific_size) = .-_C_LABEL(darwin_commpage_
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_mach_absolute_time)
|
||||
_C_LABEL(darwin_commpage_mach_absolute_time):
|
||||
1: mftbu r3
|
||||
mftb r4
|
||||
mftbu r5
|
||||
cmpw r3,r5
|
||||
1: mftbu %r3
|
||||
mftb %r4
|
||||
mftbu %r5
|
||||
cmpw %r3,%r5
|
||||
bne- 1b
|
||||
blr
|
||||
.globl _C_LABEL(darwin_commpage_mach_absolute_time_size)
|
||||
|
@ -251,9 +251,9 @@ _C_LABEL(darwin_commpage_mach_absolute_time_size) = .-_C_LABEL(darwin_commpage_m
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_sys_dcache_flush)
|
||||
_C_LABEL(darwin_commpage_sys_dcache_flush):
|
||||
1: dcbf 0,r3
|
||||
addi r3,r3,32 /* CACHELINESIZE */
|
||||
addic. r4,r4,-32 /* len -= CACHELINESIZE */
|
||||
1: dcbf 0,%r3
|
||||
addi %r3,%r3,32 /* CACHELINESIZE */
|
||||
addic. %r4,%r4,-32 /* len -= CACHELINESIZE */
|
||||
bgt 1b
|
||||
sync
|
||||
blr
|
||||
|
@ -265,14 +265,14 @@ _C_LABEL(darwin_commpage_sys_dcache_flush_size) = .-_C_LABEL(darwin_commpage_sys
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_sys_icache_invalidate)
|
||||
_C_LABEL(darwin_commpage_sys_icache_invalidate):
|
||||
mr r5,r3
|
||||
mr r6,r4
|
||||
mflr r7
|
||||
mr %r5,%r3
|
||||
mr %r6,%r4
|
||||
mflr %r7
|
||||
bla 0xffff84e0 /* Absolute branch to dcache_flush */
|
||||
mtlr r7
|
||||
1: icbi 0,r5
|
||||
addi r5,r5,32 /* CACHELINESIZE */
|
||||
addic. r6,r6,-32 /* len -= CACHELINESIZE */
|
||||
mtlr %r7
|
||||
1: icbi 0,%r5
|
||||
addi %r5,%r5,32 /* CACHELINESIZE */
|
||||
addic. %r6,%r6,-32 /* len -= CACHELINESIZE */
|
||||
bgt 1b
|
||||
isync
|
||||
blr
|
||||
|
@ -284,20 +284,20 @@ _C_LABEL(darwin_commpage_sys_icache_invalidate_size) = .-_C_LABEL(darwin_commpag
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_spinlock_try)
|
||||
_C_LABEL(darwin_commpage_spinlock_try):
|
||||
li r4,1
|
||||
lwarx r5,0,r3
|
||||
cmpwi r5,0
|
||||
li %r4,1
|
||||
lwarx %r5,0,%r3
|
||||
cmpwi %r5,0
|
||||
bne- 2f
|
||||
/*
|
||||
* OSX seems to store the address of the lock here. i.e. the equivalent of
|
||||
* stwcx. r3,0,r3 !!!
|
||||
*/
|
||||
stwcx. r4,0,r3
|
||||
stwcx. %r4,0,%r3
|
||||
bne- 2f
|
||||
mr r3,r4
|
||||
mr %r3,%r4
|
||||
isync
|
||||
blr
|
||||
2: li r3,0
|
||||
2: li %r3,0
|
||||
blr
|
||||
.globl _C_LABEL(darwin_commpage_spinlock_try_size)
|
||||
_C_LABEL(darwin_commpage_spinlock_try_size) = .-_C_LABEL(darwin_commpage_spinlock_try)
|
||||
|
@ -307,16 +307,16 @@ _C_LABEL(darwin_commpage_spinlock_try_size) = .-_C_LABEL(darwin_commpage_spinloc
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_spinlock_lock)
|
||||
_C_LABEL(darwin_commpage_spinlock_lock):
|
||||
mr r6,r3 /* copy *p - r6/r7/r8 used for temps */
|
||||
li r7,1
|
||||
1: lwarx r8,0,r6
|
||||
cmpwi r8,0
|
||||
mr %r6,%r3 /* copy *p - r6/r7/r8 used for temps */
|
||||
li %r7,1
|
||||
1: lwarx %r8,0,%r6
|
||||
cmpwi %r8,0
|
||||
bnea- 0xffff85c0 /* Absolute branch to spinlock_relinquish */
|
||||
/*
|
||||
* OSX seems to store the address of the lock here. i.e. the equivalent of
|
||||
* stwcx. r6,0,r3 !!!
|
||||
*/
|
||||
stwcx. r7,0,r6
|
||||
stwcx. %r7,0,%r6
|
||||
bnea- 0xffff85c0 /* Absolute branch to spinlock_relinquish */
|
||||
isync
|
||||
blr
|
||||
|
@ -329,8 +329,8 @@ _C_LABEL(darwin_commpage_spinlock_lock_size) = .-_C_LABEL(darwin_commpage_spinlo
|
|||
.globl _C_LABEL(darwin_commpage_spinlock_unlock)
|
||||
_C_LABEL(darwin_commpage_spinlock_unlock):
|
||||
sync
|
||||
li r4,0
|
||||
stw r4,0(r3)
|
||||
li %r4,0
|
||||
stw %r4,0(%r3)
|
||||
blr
|
||||
.globl _C_LABEL(darwin_commpage_spinlock_unlock_size)
|
||||
_C_LABEL(darwin_commpage_spinlock_unlock_size) = .-_C_LABEL(darwin_commpage_spinlock_unlock)
|
||||
|
@ -340,13 +340,13 @@ _C_LABEL(darwin_commpage_spinlock_unlock_size) = .-_C_LABEL(darwin_commpage_spin
|
|||
*/
|
||||
.globl _C_LABEL(darwin_commpage_spinlock_relinquish)
|
||||
_C_LABEL(darwin_commpage_spinlock_relinquish):
|
||||
mr r6,r3
|
||||
li r3,0 /* THREAD_NULL */
|
||||
li r4,1 /* MACH_SWITCH_OPTION_DEPRESS */
|
||||
li r5,1 /* 1ms */
|
||||
li r0,-MACH_SYS_syscall_thread_switch
|
||||
mr %r6,%r3
|
||||
li %r3,0 /* THREAD_NULL */
|
||||
li %r4,1 /* MACH_SWITCH_OPTION_DEPRESS */
|
||||
li %r5,1 /* 1ms */
|
||||
li %r0,-MACH_SYS_syscall_thread_switch
|
||||
sc
|
||||
mr r3,r6
|
||||
mr %r3,%r6
|
||||
ba 0xffff8260 /* Absolute branch to spin_lock */
|
||||
.globl _C_LABEL(darwin_commpage_spinlock_relinquish_size)
|
||||
_C_LABEL(darwin_commpage_spinlock_relinquish_size) = .-_C_LABEL(darwin_commpage_spinlock_relinquish)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lock_stubs.S,v 1.2 2007/02/09 21:55:11 ad Exp $ */
|
||||
/* $NetBSD: lock_stubs.S,v 1.3 2008/02/14 19:41:54 garbled Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -39,6 +39,7 @@
|
|||
#include "opt_multiprocessor.h"
|
||||
#include "opt_lockdebug.h"
|
||||
|
||||
#define _NOREGNAMES
|
||||
#include <machine/asm.h>
|
||||
|
||||
#include "assym.h"
|
||||
|
@ -58,17 +59,17 @@
|
|||
*/
|
||||
ENTRY_NOPROFILE(_lock_cas)
|
||||
1:
|
||||
lwarx r10,0,r3
|
||||
cmpw r10,r4
|
||||
lwarx %r10,0,%r3
|
||||
cmpw %r10,%r4
|
||||
bne- 2f
|
||||
stwcx. r5,0,r3
|
||||
stwcx. %r5,0,%r3
|
||||
bne- 1b
|
||||
SYNC
|
||||
li r3,1
|
||||
li %r3,1
|
||||
blr
|
||||
2:
|
||||
SYNC
|
||||
li r3,0
|
||||
li %r3,0
|
||||
blr
|
||||
|
||||
#if !defined(LOCKDEBUG)
|
||||
|
@ -76,13 +77,13 @@ ENTRY_NOPROFILE(_lock_cas)
|
|||
* void mutex_enter(kmutex_t *);
|
||||
*/
|
||||
ENTRY_NOPROFILE(mutex_enter)
|
||||
GET_CPUINFO(r8)
|
||||
ldptr r9,CI_CURLWP(r8)
|
||||
GET_CPUINFO(%r8)
|
||||
ldptr %r9,CI_CURLWP(%r8)
|
||||
1:
|
||||
lwarx r10,0,r3
|
||||
cmpwi r10,0
|
||||
lwarx %r10,0,%r3
|
||||
cmpwi %r10,0
|
||||
bne- 2f
|
||||
stwcx. r9,0,r3
|
||||
stwcx. %r9,0,%r3
|
||||
bne- 1b
|
||||
ISYNC
|
||||
blr
|
||||
|
@ -93,15 +94,15 @@ ENTRY_NOPROFILE(mutex_enter)
|
|||
* void mutex_exit(kmutex_t *);
|
||||
*/
|
||||
ENTRY_NOPROFILE(mutex_exit)
|
||||
GET_CPUINFO(r8)
|
||||
ldptr r9,CI_CURLWP(r8)
|
||||
GET_CPUINFO(%r8)
|
||||
ldptr %r9,CI_CURLWP(%r8)
|
||||
SYNC
|
||||
li r7,0
|
||||
li %r7,0
|
||||
1:
|
||||
lwarx r10,0,r3
|
||||
cmpw r10,r9
|
||||
lwarx %r10,0,%r3
|
||||
cmpw %r10,%r9
|
||||
bne- 2f
|
||||
stwcx. r7,0,r3
|
||||
stwcx. %r7,0,%r3
|
||||
bne- 1b
|
||||
blr
|
||||
2:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore_subr.S,v 1.34 2008/02/05 18:10:48 garbled Exp $ */
|
||||
/* $NetBSD: locore_subr.S,v 1.35 2008/02/14 19:41:54 garbled Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
|
@ -292,12 +292,12 @@ _C_LABEL(cpu_lwp_bootstrap):
|
|||
|
||||
#if defined(MULTIPROCESSOR) && !defined(PPC_OEA64) && !defined (PPC_IBM4XX)
|
||||
ENTRY(cpu_spinup_trampoline)
|
||||
li 0,0
|
||||
mtmsr 0
|
||||
li %r0,0
|
||||
mtmsr %r0
|
||||
isync
|
||||
|
||||
lis 3,_C_LABEL(cpu_hatch_stack)@ha
|
||||
lwz 1,_C_LABEL(cpu_hatch_stack)@l(3)
|
||||
lis %r3,_C_LABEL(cpu_hatch_stack)@ha
|
||||
lwz %r1,_C_LABEL(cpu_hatch_stack)@l(%r3)
|
||||
|
||||
bl _C_LABEL(cpu_hatch)
|
||||
b _C_LABEL(idle_loop)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue