remove definition of ARM_PERIIOBASE
[AROS.git] / rom / exec / systemalert.c
blob4b662aa1a53caff64827311153038b54dfda6968
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Display an alert in supervisor mode.
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <exec/execbase.h>
11 #include <proto/kernel.h>
13 #include "etask.h"
14 #include "exec_intern.h"
15 #include "exec_util.h"
17 void Alert_DisplayKrnAlert(struct Task * task, ULONG alertNum, APTR location, APTR stack, UBYTE type, APTR data,
18 struct ExecBase *SysBase)
20 char *buf;
22 /* Get the title */
23 buf = Alert_AddString(PrivExecBase(SysBase)->AlertBuffer, Alert_GetTitle(alertNum));
24 *buf++ = '\n';
26 D(bug("[SystemAlert] Got title: %s\n", PrivExecBase(SysBase)->AlertBuffer));
28 /* Get the alert text */
29 buf = FormatAlert(buf, alertNum, task, location, type, SysBase);
30 FormatAlertExtra(buf, stack, type, data, SysBase);
32 /* Task is not available, display an alert via kernel.resource */
33 KrnDisplayAlert(alertNum, PrivExecBase(SysBase)->AlertBuffer);
37 * Display an alert via kernel.resource. This is called in a critical, hardly recoverable condition.
38 * Interrupts and multitasking are disabled here.
40 * Note that we use shared buffer in SysBase for alert text.
42 void Exec_SystemAlert(ULONG alertNum, APTR location, APTR stack, UBYTE type, APTR data, struct ExecBase *SysBase)
44 D(bug("[SystemAlert] Code 0x%08X, type %d, data 0x%p\n", alertNum, type, data));
46 if ((SysBase->ThisTask == PrivExecBase(SysBase)->SAT.sat_Task) &&
47 (PrivExecBase(SysBase)->SAT.sat_Params[1] != (IPTR) NULL))
49 /* SupervisorAlertTask crashed when trying to show crash information for another task */
51 struct Task * t = (struct Task*)PrivExecBase(SysBase)->SAT.sat_Params[1];
52 ULONG alertNum = PrivExecBase(SysBase)->SAT.sat_Params[0];
53 struct IntETask * iet = GetIntETask(t);
55 Alert_DisplayKrnAlert(t, alertNum | AT_DeadEnd, iet->iet_AlertLocation, iet->iet_AlertStack,
56 iet->iet_AlertType, (APTR)&iet->iet_AlertData, SysBase);
58 else if (PrivExecBase(SysBase)->SAT.sat_IsAvailable && !(alertNum & AT_DeadEnd))
60 /* SupervisorAlertTask is available, use it */
62 PrivExecBase(SysBase)->SAT.sat_Params[0] = alertNum;
63 PrivExecBase(SysBase)->SAT.sat_Params[1] = (IPTR)SysBase->ThisTask;
65 Signal(PrivExecBase(SysBase)->SAT.sat_Task, SIGF_SINGLE);
67 else
69 Alert_DisplayKrnAlert(SysBase->ThisTask, alertNum, location, stack, type, data, SysBase);