Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-sam440 / exec / alert.c
blob2a27910116864d5cec9b76ddcbfa4a1e8082c93a
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Display an alert.
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <exec/alerts.h>
12 #include <proto/exec.h>
14 #include "../kernel/kernel_intern.h"
16 /*****************************************************************************
18 NAME */
20 AROS_LH1(void, Alert,
22 /* SYNOPSIS */
23 AROS_LHA(ULONG, alertNum, D7),
25 /* LOCATION */
26 struct ExecBase *, SysBase, 18, Exec)
28 /* FUNCTION
29 Alerts the user of a serious system problem.
31 INPUTS
32 alertNum - This is a number which contains information about
33 the reason for the call.
35 RESULT
36 This routine may return, if the alert is not a dead-end one.
38 NOTES
39 You should not call this routine because it halts the machine,
40 displays the message and then may reboot it.
42 EXAMPLE
43 // Dead-End alert: 680x0 Access To Odd Address
44 Alert (0x80000003);
46 BUGS
48 SEE ALSO
50 INTERNALS
52 HISTORY
53 26-08-95 digulla created after EXEC-Routine
55 ******************************************************************************/
57 AROS_LIBFUNC_INIT
58 static const char * CPUStrings[] =
60 "Hardware bus fault/access error",
61 "Illegal address access (ie: odd)",
62 "Illegal instruction",
63 "Divide by zero",
64 "Check instruction error",
65 "TrapV instruction error",
66 "Privilege violation error",
67 "Trace error",
68 "Line 1010 Emulator error",
69 "Line 1111 Emulator error",
70 "Stack frame format error",
71 "Spurious interrupt error",
72 "AutoVector Level 1 interrupt error",
73 "AutoVector Level 2 interrupt error",
74 "AutoVector Level 3 interrupt error",
75 "AutoVector Level 4 interrupt error",
76 "AutoVector Level 5 interrupt error",
77 "AutoVector Level 6 interrupt error",
78 "AutoVector Level 7 interrupt error",
80 * GenPurposeStrings[] =
82 "No memory",
83 "Make library",
84 "Open library",
85 "Open device",
86 "Open resource",
87 "I/O error",
88 "No signal",
89 "Bad parameter",
90 "Close library",
91 "Close device",
92 "Create process",
94 * AlertObjects[] =
96 "Exec",
97 "Graphics",
98 "Layers",
99 "Intuition",
101 "Math",
102 "DOS",
103 "RAM",
104 "Icon",
106 "Expansion",
107 "Diskfont",
108 "Utility",
109 "Keymap",
111 NULL,
112 NULL,
113 NULL,
114 NULL,
115 /* 0x10 */
116 "Audio",
117 "Console",
118 "Gameport",
119 "Keyboard",
121 "Trackdisk",
122 "Timer",
123 NULL,
124 NULL,
126 NULL,
127 NULL,
128 NULL,
129 NULL,
131 NULL,
132 NULL,
133 NULL,
134 NULL,
135 /* 0x20 */
136 "CIA",
137 "Disk",
138 "Misc",
139 NULL,
141 NULL,
142 NULL,
143 NULL,
144 NULL,
146 NULL,
147 NULL,
148 NULL,
149 NULL,
151 NULL,
152 NULL,
153 NULL,
154 NULL,
155 /* 0x30 */
156 "Bootstrap",
157 "Workbench",
158 "Diskcopy",
159 "Gadtools",
161 "Unknown",
163 * ExecStrings[] =
165 "68000 exception vector checksum",
166 "Execbase checksum",
167 "Library checksum failure",
168 NULL,
170 "Corrupt memory list detected in FreeMem",
171 "No memory for interrupt servers",
172 "InitStruct() of an APTR source",
173 "A semaphore is in an illegal state at ReleaseSemaphore",
175 "Freeing memory already freed",
176 "Illegal 68k exception taken",
177 "Attempt to reuse active IORequest",
178 "Sanity check on memory list failed",
180 "IO attempted on closed IORequest",
181 "Stack appears to extend out of range",
182 "Memory header not located. (Usually an invalid address passed to FreeMem())",
183 "An attempt was made to use the old message semaphores",
187 struct Task * task;
189 # define GetSubSysId(a) (((a) >> 24) & 0x7F)
190 # define GetGenError(a) (((a) >> 16) & 0xFF)
191 # define GetSpecError(a) ((a) & 0xFFFF)
193 task = FindTask (NULL);
195 /* since this is an emulation, we just show the bug in the console */
196 bug ( "[exec] GURU Meditation %04lx %04lx\n[exec] "
197 , alertNum >> 16
198 , alertNum & 0xFFFF
201 if (alertNum & 0x80000000)
202 bug ( "Deadend/" );
203 else
204 bug( "Recoverable/" );
206 switch (GetSubSysId (alertNum))
208 case 0: /* CPU/OS/App */
209 if (GetGenError (alertNum) == 0)
211 bug( "CPU/" );
213 if (GetSpecError (alertNum) >= 2 && GetSpecError (alertNum) <= 0x1F)
214 bug("%s"
215 , CPUStrings[GetSpecError (alertNum) - 2]
217 else
218 bug("*unknown*");
220 else if (GetGenError (alertNum) <= 0x0B)
222 bug("%s/"
223 , GenPurposeStrings[GetGenError (alertNum) - 1]
226 if (GetSpecError (alertNum) >= 0x8001
227 && GetSpecError (alertNum) <= 0x8035)
229 bug("%s"
230 , AlertObjects[GetSpecError (alertNum) - 0x8001]
233 else
234 bug("*unknown*");
237 break;
239 case 1: /* Exec */
240 bug("Exec/");
242 if (!GetGenError (alertNum)
243 && GetSpecError (alertNum) >= 0x0001
244 && GetSpecError (alertNum) <= 0x0010)
246 bug("%s"
247 , ExecStrings[GetSpecError (alertNum) - 0x0001]
250 else
252 bug("*unknown*");
255 break;
257 case 2: /* Graphics */
258 bug("Graphics/*unknown*");
260 break;
262 default:
263 bug("*unknown*/*unknown*");
266 bug("\n[exec] Task: %p (%s)\n"
267 , task
268 , (task && task->tc_Node.ln_Name) ?
269 task->tc_Node.ln_Name
270 : "-- unknown task --"
273 if (alertNum & AT_DeadEnd)
275 /* Um, we have to do something here in order to prevent the
276 computer from continuing... */
277 ColdReboot();
279 AROS_LIBFUNC_EXIT
280 } /* Alert */