revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / systemalert.c
blob5cc18ced4920d7bbb4716bb5719bd7a59c7b6d3c
1 /*
2 Copyright © 1995-2017, 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>
12 #include "etask.h"
13 #include "exec_intern.h"
14 #include "exec_util.h"
16 void Alert_DisplayKrnAlert(struct Task * task, ULONG alertNum, APTR location, APTR stack, UBYTE type, APTR data,
17 struct ExecBase *SysBase)
19 char *buf;
21 /* Get the title */
22 buf = Alert_AddString(PrivExecBase(SysBase)->AlertBuffer, Alert_GetTitle(alertNum));
23 *buf++ = '\n';
25 D(bug("[SystemAlert] Got title: %s\n", PrivExecBase(SysBase)->AlertBuffer));
27 /* Get the alert text */
28 buf = FormatAlert(buf, alertNum, task, location, type, SysBase);
29 FormatAlertExtra(buf, stack, type, data, SysBase);
31 /* Task is not available, display an alert via kernel.resource */
32 KrnDisplayAlert(alertNum, PrivExecBase(SysBase)->AlertBuffer);
36 * Display an alert via kernel.resource. This is called in a critical, hardly recoverable condition.
37 * Interrupts and multitasking are disabled here.
39 * Note that we use shared buffer in SysBase for alert text.
41 void Exec_SystemAlert(ULONG alertNum, APTR location, APTR stack, UBYTE type, APTR data, struct ExecBase *SysBase)
43 D(bug("[SystemAlert] Code 0x%08X, type %d, data 0x%p\n", alertNum, type, data));
45 if ((GET_THIS_TASK == PrivExecBase(SysBase)->SAT.sat_Task) &&
46 (PrivExecBase(SysBase)->SAT.sat_Params[1] != (IPTR) NULL))
48 /* SupervisorAlertTask crashed when trying to show crash information for another task */
50 struct Task * t = (struct Task*)PrivExecBase(SysBase)->SAT.sat_Params[1];
51 ULONG alertNum = PrivExecBase(SysBase)->SAT.sat_Params[0];
52 struct IntETask * iet = t ? GetIntETask(t) : NULL;
54 Alert_DisplayKrnAlert(t, alertNum | AT_DeadEnd, iet->iet_AlertLocation, iet->iet_AlertStack,
55 iet->iet_AlertType, (APTR)&iet->iet_AlertData, SysBase);
57 else if (PrivExecBase(SysBase)->SAT.sat_IsAvailable && !(alertNum & AT_DeadEnd))
59 /* SupervisorAlertTask is available, use it */
61 PrivExecBase(SysBase)->SAT.sat_Params[0] = alertNum;
62 PrivExecBase(SysBase)->SAT.sat_Params[1] = (IPTR)GET_THIS_TASK;
64 Signal(PrivExecBase(SysBase)->SAT.sat_Task, SIGF_SINGLE);
66 else
68 Alert_DisplayKrnAlert(GET_THIS_TASK, alertNum, location, stack, type, data, SysBase);