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>
28 #elif defined __aarch64__
29 #include <aros/aarch64/cpucontext.h>
31 #include <aros/arm/cpucontext.h>
33 #error unsupported CPU type
40 VOID (* is_Code
)(); /* server code entry */
48 struct Node
* iv_Node
;
58 #define SIH_PRIMASK (0xf0)
61 #define INTF_NMI (1L<<15)
63 /* Offset of kernel interrupt vectors.
66 * AddIntServer(INTB_KERNEL + irq, irq_handler);
67 * RemIntServer(INTB_KERNEL + irq, irq_handler);
69 #define INTB_KERNEL (16)
72 /* AROS helper macros.
73 * These are used to abstract away architectural
74 * differences between AROS ports.
76 #include <aros/asmcall.h>
78 /* Define a function prototype and call methods
79 * for Cause(), SetIntVector(), and AddIntServer()
80 * struct Interrupt is_Code fields.
82 * The prototype matches:
84 * ULONG func(APTR data, ULONG intmask, struct Custom *custom,
85 * VOID_FUNC code, struct ExecBase *sysBase)
86 * (A1, D1, A0, A5, A6)
88 * Handler should return TRUE (interrupt handled)
89 * or FALSE (continue interrupt processing)
91 #define AROS_INTP(n) \
93 AROS_UFPA(APTR, __ufi_data, A1), \
94 AROS_UFPA(ULONG, __ufi_intmask, D1), \
95 AROS_UFPA(APTR, __ufi_custom, A0), \
96 AROS_UFPA(VOID_FUNC, __ufi_code, A5), \
97 AROS_UFPA(struct ExecBase *, __ufi_SysBase, A6))
99 #define AROS_INTC4(n, data, intmask, custom, code) \
100 AROS_UFC5(ULONG, n, \
101 AROS_UFCA(APTR, data, A1), \
102 AROS_UFCA(ULONG, intmask, D1), \
103 AROS_UFCA(APTR, custom, A0), \
104 AROS_UFCA(VOID_FUNC, code, A5), \
105 AROS_UFCA(struct ExecBase *, SysBase, A6))
106 #define AROS_INTC3(n, data, intmask, custom) AROS_INTC4(n, data, intmask, custom, (VOID_FUNC)(n))
107 #define AROS_INTC2(n, data, intmask) AROS_INTC4(n, data, intmask, (APTR)(IPTR)0xdff000, (VOID_FUNC)(n));
108 #define AROS_INTC1(n, data) AROS_INTC4(n, data, 0, (APTR)(IPTR)0xdff000, (VOID_FUNC)(n));
110 #define AROS_INTH4(n, type, data, intmask, custom, code) \
111 AROS_UFH5(ULONG, n, \
112 AROS_UFHA(APTR, __ufi_data, A1), \
113 AROS_UFHA(ULONG, intmask, D1), \
114 AROS_UFHA(APTR, custom, A0), \
115 AROS_UFHA(VOID_FUNC, code, A5), \
116 AROS_UFHA(struct ExecBase *, SysBase, A6) \
117 ) { AROS_USERFUNC_INIT \
118 type __unused data = __ufi_data;
120 #define AROS_INTH3(n, type, data, intmask, custom) AROS_INTH4(n, type, data, intmask, custom, __ufi_code)
121 #define AROS_INTH2(n, type, data, intmask) AROS_INTH4(n, type, data, intmask, __ufi_custom, __ufi_code)
122 #define AROS_INTH1(n, type, data) AROS_INTH4(n, type, data, __ufi_intmask, __ufi_custom, __ufi_code)
123 #define AROS_INTH0(n) AROS_INTH4(n, APTR, data, __ufi_intmask, __ufi_custom, __ufi_code)
126 /* Special hack for setting the 'Z' condition code upon exit
127 * for m68k architectures.
129 #define AROS_INTFUNC_INIT inline ULONG _handler(void) {
130 #define AROS_INTFUNC_EXIT }; register ULONG _res asm ("d0") = _handler(); \
131 asm volatile ("tst.l %0\n" : : "r" (_res)); \
132 return _res; /* gcc only generates movem/unlk/rts */ \
134 #else /* ! __mc68000 */
136 #define AROS_INTFUNC_INIT
137 #define AROS_INTFUNC_EXIT AROS_USERFUNC_EXIT }
138 #endif /* ! __mc68000 */
140 #endif /* __AROS__ */
142 #endif /* EXEC_INTERRUPTS_H */