X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/55e303ae13a4cf49d70f2294092726f2fffb9ef2..483a1d1004b64bbaaef2c64c17c6b999009a54d2:/osfmk/ppc/trap.c diff --git a/osfmk/ppc/trap.c b/osfmk/ppc/trap.c index d5f4e1b07..e87a876e9 100644 --- a/osfmk/ppc/trap.c +++ b/osfmk/ppc/trap.c @@ -3,22 +3,19 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. + * The contents of this file constitute Original Code as defined in and + * are subject to the Apple Public Source License Version 1.1 (the + * "License"). You may not use this file except in compliance with the + * License. Please obtain a copy of the License at + * http://www.apple.com/publicsource and read it before using this file. * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * This Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. * * @APPLE_LICENSE_HEADER_END@ */ @@ -95,6 +92,9 @@ static void unresolved_kernel_trap(int trapno, addr64_t dar, char *message); +static void handleMck(struct savearea *ssp); /* Common machine check handler */ + + struct savearea *trap(int trapno, struct savearea *ssp, unsigned int dsisr, @@ -167,7 +167,6 @@ struct savearea *trap(int trapno, */ case T_DECREMENTER: case T_IN_VAIN: /* Shouldn't ever see this, lowmem_vectors eats it */ - case T_MACHINE_CHECK: case T_SYSTEM_MANAGEMENT: case T_ALTIVEC_ASSIST: case T_INTERRUPT: @@ -179,6 +178,15 @@ struct savearea *trap(int trapno, break; +/* + * Here we handle a machine check in the kernel + */ + + case T_MACHINE_CHECK: + handleMck(ssp); /* Common to both user and kernel */ + break; + + case T_ALIGNMENT: /* * If enaNotifyEMb is set, we get here, and @@ -401,7 +409,6 @@ struct savearea *trap(int trapno, */ case T_DECREMENTER: case T_IN_VAIN: /* Shouldn't ever see this, lowmem_vectors eats it */ - case T_MACHINE_CHECK: case T_INTERRUPT: case T_FP_UNAVAILABLE: case T_SYSTEM_MANAGEMENT: @@ -416,6 +423,15 @@ struct savearea *trap(int trapno, cpu_number(), trapno, dsisr, dar, ssp->save_srr0, ssp->save_srr1); break; + +/* + * Here we handle a machine check in user state + */ + + case T_MACHINE_CHECK: + handleMck(ssp); /* Common to both user and kernel */ + break; + case T_RESET: ml_set_interrupts_enabled(FALSE); /* Turn off interruptions */ if (!Call_Debugger(trapno, ssp)) @@ -815,6 +831,30 @@ void unresolved_kernel_trap(int trapno, panic(message); } +char *corr[2] = {"uncorrected", "corrected "}; + +void handleMck(struct savearea *ssp) { /* Common machine check handler */ + + int cpu; + + cpu = cpu_number(); + + printf("Machine check (%d) - %s - pc = %016llX, msr = %016llX, dsisr = %08X, dar = %016llX\n", + cpu, corr[ssp->save_hdr.save_misc3], ssp->save_srr0, ssp->save_srr1, ssp->save_dsisr, ssp->save_dar); /* Tell us about it */ + printf("Machine check (%d) - AsyncSrc = %016llX, CoreFIR = %016llx\n", cpu, ssp->save_xdat0, ssp->save_xdat1); + printf("Machine check (%d) - L2FIR = %016llX, BusFir = %016llx\n", cpu, ssp->save_xdat2, ssp->save_xdat3); + + if(ssp->save_hdr.save_misc3) return; /* Leave the the machine check was recovered */ + + panic("Uncorrectable machine check: pc = %016llX, msr = %016llX, dsisr = %08X, dar = %016llX\n" + " AsyncSrc = %016llX, CoreFIR = %016llx\n" + " L2FIR = %016llX, BusFir = %016llx\n", + ssp->save_srr0, ssp->save_srr1, ssp->save_dsisr, ssp->save_dar, + ssp->save_xdat0, ssp->save_xdat1, ssp->save_xdat2, ssp->save_xdat3); + + return; +} + void thread_syscall_return( kern_return_t ret)