From 4e9f286b9827e8bbcbd9c23f212b03d39eeb349e Mon Sep 17 00:00:00 2001 From: chs Date: Wed, 24 Jul 2002 06:04:43 +0000 Subject: [PATCH] for MP builds, save and restore sprg0 (which contains the curcpu pointer) around restoring OFW's sprg registers while calling into OFW. --- sys/arch/powerpc/mpc6xx/ofw_subr.S | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/arch/powerpc/mpc6xx/ofw_subr.S b/sys/arch/powerpc/mpc6xx/ofw_subr.S index b82030477db3..cfbdb72f57d4 100644 --- a/sys/arch/powerpc/mpc6xx/ofw_subr.S +++ b/sys/arch/powerpc/mpc6xx/ofw_subr.S @@ -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