2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 Desc: Display an alert in supervisor mode.
9 #include <aros/debug.h>
10 #include <exec/execbase.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
)
22 buf
= Alert_AddString(PrivExecBase(SysBase
)->AlertBuffer
, Alert_GetTitle(alertNum
));
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
);
68 Alert_DisplayKrnAlert(GET_THIS_TASK
, alertNum
, location
, stack
, type
, data
, SysBase
);