2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Display an alert.
8 #include <exec/execbase.h>
9 #include <aros/libcall.h>
10 #include <exec/alerts.h>
11 #include <proto/exec.h>
16 int kprintf(const UBYTE
*, ...);
18 /*****************************************************************************
25 AROS_LHA(ULONG
, alertNum
, D7
),
28 struct ExecBase
*, SysBase
, 18, Exec
)
31 Alerts the user of a serious system problem.
34 alertNum - This is a number which contains information about
35 the reason for the call.
38 This routine may return, if the alert is not a dead-end one.
41 You should not call this routine because it halts the machine,
42 displays the message and then may reboot it.
45 // Dead-End alert: 680x0 Access To Odd Address
54 ******************************************************************************/
57 static const char * CPUStrings
[] =
59 "Hardware bus fault/access error",
60 "Illegal address access (ie: odd)",
61 "Illegal instruction",
63 "Check instruction error",
64 "TrapV instruction error",
65 "Privilege violation error",
67 "Line 1010 Emulator error",
68 "Line 1111 Emulator error",
69 "Stack frame format error",
70 "Spurious interrupt error",
71 "AutoVector Level 1 interrupt error",
72 "AutoVector Level 2 interrupt error",
73 "AutoVector Level 3 interrupt error",
74 "AutoVector Level 4 interrupt error",
75 "AutoVector Level 5 interrupt error",
76 "AutoVector Level 6 interrupt error",
77 "AutoVector Level 7 interrupt error",
79 * GenPurposeStrings
[] =
164 "68000 exception vector checksum",
166 "Library checksum failure",
169 "Corrupt memory list detected in FreeMem",
170 "No memory for interrupt servers",
171 "InitStruct() of an APTR source",
172 "A semaphore is in an illegal state at ReleaseSemaphore",
174 "Freeing memory already freed",
175 "Illegal 68k exception taken",
176 "Attempt to reuse active IORequest",
177 "Sanity check on memory list failed",
179 "IO attempted on closed IORequest",
180 "Stack appears to extend out of range",
181 "Memory header not located. (Usually an invalid address passed to FreeMem())",
182 "An attempt was made to use the old message semaphores",
188 # define GetSubSysId(a) (((a) >> 24) & 0x7F)
189 # define GetGenError(a) (((a) >> 16) & 0xFF)
190 # define GetSpecError(a) ((a) & 0xFFFF)
192 task
= FindTask (NULL
);
194 /* since this is an emulation, we just show the bug in the console */
195 kprintf ( "GURU Meditation %04lx %04lx\n"
200 if (alertNum
& 0x80000000)
201 kprintf ( "Deadend/" );
203 kprintf( "Recoverable/" );
205 switch (GetSubSysId (alertNum
))
207 case 0: /* CPU/OS/App */
208 if (GetGenError (alertNum
) == 0)
212 if (GetSpecError (alertNum
) >= 2 && GetSpecError (alertNum
) <= 0x1F)
214 , CPUStrings
[GetSpecError (alertNum
) - 2]
217 kprintf ("*unknown*");
219 else if (GetGenError (alertNum
) <= 0x0B)
222 , GenPurposeStrings
[GetGenError (alertNum
) - 1]
225 if (GetSpecError (alertNum
) >= 0x8001
226 && GetSpecError (alertNum
) <= 0x8035)
229 , AlertObjects
[GetSpecError (alertNum
) - 0x8001]
233 kprintf ("*unknown*");
241 if (!GetGenError (alertNum
)
242 && GetSpecError (alertNum
) >= 0x0001
243 && GetSpecError (alertNum
) <= 0x0010)
246 , ExecStrings
[GetSpecError (alertNum
) - 0x0001]
251 kprintf ("*unknown*");
256 case 2: /* Graphics */
257 kprintf ("Graphics/*unknown*");
262 kprintf ("*unknown*/*unknown*");
265 kprintf ("\nTask: %p (%s)\n"
267 , (task
&& task
->tc_Node
.ln_Name
) ?
268 task
->tc_Node
.ln_Name
269 : "-- unknown task --"
272 if (alertNum
& AT_DeadEnd
)
274 /* Um, we have to do something here in order to prevent the
275 computer from continuing... */