From 52c76ce49fe47bd3a8cdf923e8caba1c7fea6b0f Mon Sep 17 00:00:00 2001 From: luporl Date: Mon, 15 Oct 2018 16:43:07 +0000 Subject: [PATCH] Initialize SPRG0 before its first possible use At early boot, PCPU_GET(), that obtains a pointer from SPRG0, was being used with SPRG0 not yet initialized. If it pointed to an invalid address, the machine would hang. Approved by: re(gjb), jhibbits(mentor) --- sys/powerpc/powerpc/machdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index ea315f586080..cee210bef57a 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -383,12 +383,12 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, if (platform_smp_get_bsp(&bsp) != 0) bsp.cr_cpuid = 0; pc = &__pcpu[bsp.cr_cpuid]; + __asm __volatile("mtsprg 0, %0" :: "r"(pc)); pcpu_init(pc, bsp.cr_cpuid, sizeof(struct pcpu)); pc->pc_curthread = &thread0; thread0.td_oncpu = bsp.cr_cpuid; pc->pc_cpuid = bsp.cr_cpuid; pc->pc_hwref = bsp.cr_hwref; - __asm __volatile("mtsprg 0, %0" :: "r"(pc)); /* * Init KDB