Copyright clean-up (part 1):
[AROS.git] / test / exec / alert.c
blobe7d5350be8e1cdd96810875b803ccf6f65a8cb7a
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /* The main purpose is to test alert address detection and stack trace */
8 #include <aros/asmcall.h>
9 #include <aros/debug.h>
10 #include <exec/alerts.h>
11 #include <exec/interrupts.h>
12 #include <proto/dos.h>
13 #include <proto/exec.h>
15 #include <string.h>
18 * SoftInt is the only way to simulate supervisor mode on hosted AROS.
19 * Of course there's no real privilege level difference, however interrupts
20 * in hosted AROS are running on a simulated supervisor level for internal
21 * purposes (in order to avoid nesting interrupts).
23 static AROS_INTH1(superAlert, APTR, interruptData)
25 AROS_INTFUNC_INIT
27 D(bug("Supervisor code called\n"));
29 Alert((IPTR)interruptData);
31 return 0;
33 AROS_INTFUNC_EXIT
36 struct Interrupt MyInt;
38 int main(int argc, char **argv)
40 IPTR n = AN_InitAPtr;
41 BOOL super = FALSE;
42 int i;
44 for (i = 1; i < argc; i++)
46 if (!stricmp(argv[i], "deadend"))
47 n = AN_BogusExcpt;
48 else if (!stricmp(argv[i], "supervisor"))
49 super = TRUE;
52 if (super)
55 D(bug("Calling supervisor alert...\n"));
57 MyInt.is_Data = (APTR)n;
58 MyInt.is_Code = (APTR)superAlert;
60 Cause(&MyInt);
62 else
64 Alert(n);
67 return 0;