for MP builds, save and restore sprg0 (which contains the curcpu pointer)

around restoring OFW's sprg registers while calling into OFW.
This commit is contained in:
chs 2002-07-24 06:04:43 +00:00
parent 185a5bbcf0
commit 4e9f286b98
1 changed files with 20 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofw_subr.S,v 1.1 2002/07/06 18:01:23 matt Exp $ */
/* $NetBSD: ofw_subr.S,v 1.2 2002/07/24 06:04:43 chs Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -40,6 +40,11 @@
GLOBAL(ofmsr)
.long 0,0,0,0,0 /* msr & sprg[0-3] used in OF */
#ifdef MULTIPROCESSOR
GLOBAL(ofwsprg0save)
.long 0
#endif
.comm firmstk,NBPG,8
.comm openfirmware_entry,4,4 /* openfirmware entry point */
.comm ofwsrsave,64,4 /* openfirmware SR savearea */
@ -107,6 +112,13 @@ ENTRY(openfirmware)
cmpwi 5,0
bne 1b
#ifdef MULTIPROCESSOR
mfsprg 5,0 /* save current sprg0 (curcpu) */
lis 4,ofwsprg0save@ha
addi 4,4,ofwsprg0save@l
stw 5,0(4)
#endif
lis 4,_C_LABEL(ofw_pmap)@ha /* load OFW SR */
addi 4,4,_C_LABEL(ofw_pmap)@l
lwz 0,PM_KERNELSR(4)
@ -135,6 +147,13 @@ ENTRY(openfirmware)
blrl /* call Open Firmware */
#ifdef MULTIPROCESSOR
lis 4,ofwsprg0save@ha /* return saved sprg0 (curcpu) */
addi 4,4,ofwsprg0save@l
lwz 5,0(4)
mtsprg 0,5
#endif
lis 4,ofwsrsave@ha /* restore saved SRs */
addi 4,4,ofwsrsave@l
li 5,0