2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Display an alert.
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <exec/alerts.h>
12 #include <proto/exec.h>
14 //void kprintf(const char *, ...);
16 /*****************************************************************************
23 AROS_LHA(ULONG
, alertNum
, D7
),
26 struct ExecBase
*, SysBase
, 18, Exec
)
29 Alerts the user of a serious system problem.
32 alertNum - This is a number which contains information about
33 the reason for the call.
36 This routine may return, if the alert is not a dead-end one.
39 You should not call this routine because it halts the machine,
40 displays the message and then may reboot it.
43 // Dead-End alert: 680x0 Access To Odd Address
53 26-08-95 digulla created after EXEC-Routine
55 ******************************************************************************/
58 static const char * CPUStrings
[] =
60 "Hardware bus fault/access error",
61 "Illegal address access (ie: odd)",
62 "Illegal instruction",
64 "Check instruction error",
65 "TrapV instruction error",
66 "Privilege violation 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
[] =
165 "68000 exception vector checksum",
167 "Library checksum failure",
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",
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 kprintf ( "GURU Meditation %04lx %04lx\n"
201 if (alertNum
& 0x80000000)
202 kprintf ( "Deadend/" );
204 kprintf( "Recoverable/" );
206 switch (GetSubSysId (alertNum
))
208 case 0: /* CPU/OS/App */
209 if (GetGenError (alertNum
) == 0)
213 if (GetSpecError (alertNum
) >= 2 && GetSpecError (alertNum
) <= 0x1F)
215 , CPUStrings
[GetSpecError (alertNum
) - 2]
218 kprintf ("*unknown*");
220 else if (GetGenError (alertNum
) <= 0x0B)
223 , GenPurposeStrings
[GetGenError (alertNum
) - 1]
226 if (GetSpecError (alertNum
) >= 0x8001
227 && GetSpecError (alertNum
) <= 0x8035)
230 , AlertObjects
[GetSpecError (alertNum
) - 0x8001]
234 kprintf ("*unknown*");
242 if (!GetGenError (alertNum
)
243 && GetSpecError (alertNum
) >= 0x0001
244 && GetSpecError (alertNum
) <= 0x0010)
247 , ExecStrings
[GetSpecError (alertNum
) - 0x0001]
252 kprintf ("*unknown*");
257 case 2: /* Graphics */
258 kprintf ("Graphics/*unknown*");
263 kprintf ("*unknown*/*unknown*");
266 kprintf ("\nTask: %p (%s)\n"
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... */