Build sdi/library by default.
[AROS.git] / test / exec / alert.c
blobdceb858985c5e0f4669d0dec69d4643e7b808dbf
1 /* The main purpose is to test alert address detection and stack trace */
3 #include <aros/asmcall.h>
4 #include <aros/debug.h>
5 #include <exec/alerts.h>
6 #include <exec/interrupts.h>
7 #include <proto/dos.h>
8 #include <proto/exec.h>
10 #include <string.h>
13 * SoftInt is the only way to simulate supervisor mode on hosted AROS.
14 * Of course there's no real privilege level difference, however interrupts
15 * in hosted AROS are running on a simulated supervisor level for internal
16 * purposes (in order to avoid nesting interrupts).
18 static AROS_INTH1(superAlert, APTR, interruptData)
20 AROS_INTFUNC_INIT
22 D(bug("Supervisor code called\n"));
24 Alert((IPTR)interruptData);
26 return 0;
28 AROS_INTFUNC_EXIT
31 struct Interrupt MyInt;
33 int main(int argc, char **argv)
35 IPTR n = AN_InitAPtr;
36 BOOL super = FALSE;
37 int i;
39 for (i = 1; i < argc; i++)
41 if (!stricmp(argv[i], "deadend"))
42 n = AN_BogusExcpt;
43 else if (!stricmp(argv[i], "supervisor"))
44 super = TRUE;
47 if (super)
50 D(bug("Calling supervisor alert...\n"));
52 MyInt.is_Data = (APTR)n;
53 MyInt.is_Code = (APTR)superAlert;
55 Cause(&MyInt);
57 else
59 Alert(n);
62 return 0;