00001 /* src_experimental/kernel/kerror.c 00002 CubeOS Version 0.4.90 experimental 00003 Copyright (C) 1999,2000 Holger Kenn 00004 00005 CubeOS is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or any later version. 00009 00010 CubeOS is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 */ 00016 #include <kerror.h> 00017 #include <stdio.h> 00018 #include <cubeos.h> 00019 #include <sys_var.h> 00020 00029 void KERN_panic () 00030 { 00031 asm (" ori.w #0x0700,%sr"); /* disable all further interupts */ 00032 00033 // this will disable clkout, so we are going to get a reset 00034 // when the watchdog expires. This is done so that even if the 00035 // e_handle fails from here on, we will still get the reset 00036 writeshort (SIM_MCR, readshort (SIM_MCR) | 0x8000); 00037 00038 TTY_Blocking_Serial_Out = 1; /* wait until every char is output */ 00039 00040 printf ("KERNEL PANIC\n\r"); 00041 00042 while (1); 00043 00044 } 00045 00052 void KERN_complain (int i, char *text) 00053 { 00054 00055 printf ("KERNEL ERROR LEVEL %d: %s\n\r", i, text); 00056 00057 if (i == ERR_PANIC) 00058 KERN_panic (); 00059 00060 }