1 #ifndef EXEC_INTERRUPTS_H
2 #define EXEC_INTERRUPTS_H
5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
8 Desc: Interrupt structures
13 # include <exec/lists.h>
16 # include <exec/nodes.h>
19 /* CPU-dependent struct ExceptionContext */
21 #include <aros/i386/cpucontext.h>
22 #elif defined __x86_64__
23 #include <aros/x86_64/cpucontext.h>
24 #elif defined __mc68000__
25 #include <aros/m68k/cpucontext.h>
26 #elif defined __powerpc__
27 #include <aros/ppc/cpucontext.h>
29 #include <aros/arm/cpucontext.h>
31 #error unsupported CPU type
38 VOID (* is_Code
)(); /* server code entry */
46 struct Node
* iv_Node
;
56 #define SIH_PRIMASK (0xf0)
59 #define INTF_NMI (1L<<15)
61 /* Offset of kernel interrupt vectors.
64 * AddIntServer(INTB_KERNEL + irq, irq_handler);
65 * RemIntServer(INTB_KERNEL + irq, irq_handler);
67 #define INTB_KERNEL (16)
70 /* AROS helper macros.
71 * These are used to abstract away architectural
72 * differences between AROS ports.
74 #include <aros/asmcall.h>
76 /* Define a function prototype and call methods
77 * for Cause(), SetIntVector(), and AddIntServer()
78 * struct Interrupt is_Code fields.
80 * The prototype matches:
82 * ULONG func(APTR data, ULONG intmask, struct Custom *custom,
83 * VOID_FUNC code, struct ExecBase *sysBase)
84 * (A1, D1, A0, A5, A6)
86 * Handler should return TRUE (interrupt handled)
87 * or FALSE (continue interrupt processing)
89 #define AROS_INTP(n) \
91 AROS_UFPA(APTR, __ufi_data, A1), \
92 AROS_UFPA(ULONG, __ufi_intmask, D1), \
93 AROS_UFPA(APTR, __ufi_custom, A0), \
94 AROS_UFPA(VOID_FUNC, __ufi_code, A5), \
95 AROS_UFPA(struct ExecBase *, __ufi_SysBase, A6))
97 #define AROS_INTC4(n, data, intmask, custom, code) \
99 AROS_UFCA(APTR, data, A1), \
100 AROS_UFCA(ULONG, intmask, D1), \
101 AROS_UFCA(APTR, custom, A0), \
102 AROS_UFCA(VOID_FUNC, code, A5), \
103 AROS_UFCA(struct ExecBase *, SysBase, A6))
104 #define AROS_INTC3(n, data, intmask, custom) AROS_INTC4(n, data, intmask, custom, (VOID_FUNC)(n))
105 #define AROS_INTC2(n, data, intmask) AROS_INTC4(n, data, intmask, (APTR)(IPTR)0xdff000, (VOID_FUNC)(n));
106 #define AROS_INTC1(n, data) AROS_INTC4(n, data, 0, (APTR)(IPTR)0xdff000, (VOID_FUNC)(n));
108 #define AROS_INTH4(n, type, data, intmask, custom, code) \
109 AROS_UFH5(ULONG, n, \
110 AROS_UFHA(APTR, __ufi_data, A1), \
111 AROS_UFHA(ULONG, intmask, D1), \
112 AROS_UFHA(APTR, custom, A0), \
113 AROS_UFHA(VOID_FUNC, code, A5), \
114 AROS_UFHA(struct ExecBase *, SysBase, A6) \
115 ) { AROS_USERFUNC_INIT \
116 type __unused data = __ufi_data;
118 #define AROS_INTH3(n, type, data, intmask, custom) AROS_INTH4(n, type, data, intmask, custom, __ufi_code)
119 #define AROS_INTH2(n, type, data, intmask) AROS_INTH4(n, type, data, intmask, __ufi_custom, __ufi_code)
120 #define AROS_INTH1(n, type, data) AROS_INTH4(n, type, data, __ufi_intmask, __ufi_custom, __ufi_code)
121 #define AROS_INTH0(n) AROS_INTH4(n, APTR, data, __ufi_intmask, __ufi_custom, __ufi_code)
124 /* Special hack for setting the 'Z' condition code upon exit
125 * for m68k architectures.
127 #define AROS_INTFUNC_INIT inline ULONG _handler(void) {
128 #define AROS_INTFUNC_EXIT }; register ULONG _res asm ("d0") = _handler(); \
129 asm volatile ("tst.l %0\n" : : "r" (_res)); \
130 return _res; /* gcc only generates movem/unlk/rts */ \
132 #else /* ! __mc68000 */
134 #define AROS_INTFUNC_INIT
135 #define AROS_INTFUNC_EXIT AROS_USERFUNC_EXIT }
136 #endif /* ! __mc68000 */
138 #endif /* __AROS__ */
140 #endif /* EXEC_INTERRUPTS_H */