Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[tangerine.git] / test / exceptiontest.c
blob5484972c8a23c5888f47351bdb8a7cb9c0c0e374
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <aros/libcall.h>
8 #include <clib/exec_protos.h>
9 #include <exec/execbase.h>
10 #include <stdio.h>
12 ULONG s;
14 /* Function prototype needed on Linux-M68K*/
15 AROS_LD2(ULONG,handler,
16 AROS_LDA(ULONG,signals,D0),
17 AROS_LDA(APTR,exceptData,A1),
18 struct ExecBase *,SysBase,0,Test);
20 AROS_LH2(ULONG,handler,
21 AROS_LHA(ULONG,signals,D0),
22 AROS_LHA(APTR,exceptData,A1),
23 struct ExecBase *,SysBase,0,Test)
25 AROS_LIBFUNC_INIT
26 exceptData=0;
27 s=SetSignal(0,0);
28 return signals;
29 AROS_LIBFUNC_EXIT
32 int main(void)
34 int s1,s2;
35 APTR oldexc;
37 s1=AllocSignal(-1);
38 if(s1>=0)
40 printf("sig1: %d\n",s1);
41 s2=AllocSignal(-1);
42 if(s2>=0)
44 printf("sig2: %d\n",s2);
45 oldexc=SysBase->ThisTask->tc_ExceptCode;
46 SysBase->ThisTask->tc_ExceptCode=&AROS_SLIB_ENTRY(handler,Test);
47 SetExcept(1<<s2,1<<s2);
48 Signal(SysBase->ThisTask,(1<<s2)|(1<<s1));
49 SetExcept(0,1<<s2);
50 SysBase->ThisTask->tc_ExceptCode=oldexc;
51 printf("got: %08lx\n",s);
52 FreeSignal(s2);
54 FreeSignal(s1);
56 return 0;