Port the SB128 code to AROS.
[AROS.git] / rom / kernel / kernel_intr.h
blob8e332b2295466e3c8480891ac1635347069e99e3
1 #include <proto/exec.h>
3 /* Main scheduler entry point */
4 void core_ExitInterrupt(regs_t *regs);
5 /* CPU-specific wrappers. Need to be implemented in CPU-specific parts */
6 void cpu_Switch(regs_t *regs);
7 void cpu_Dispatch(regs_t *regs);
9 /* This constant can be redefined this in arch-specific includes */
10 #ifndef _CUSTOM
11 #define _CUSTOM NULL
12 #endif
14 /* Call exec interrupt vector, if present */
15 static inline void core_Cause(unsigned char n, unsigned int mask)
17 struct IntVector *iv = &SysBase->IntVects[n];
19 /* If the SoftInt vector in SysBase is set, call it. It will do the rest for us */
20 if (iv->iv_Code)
21 AROS_UFC5(void, iv->iv_Code,
22 AROS_UFCA(ULONG, mask, D1),
23 AROS_UFCA(APTR, _CUSTOM, A0),
24 AROS_UFCA(APTR, iv->iv_Data, A1),
25 AROS_UFCA(APTR, iv->iv_Code, A5),
26 AROS_UFCA(struct ExecBase *, SysBase, A6));
29 /* Call exec trap handler, if possible */
30 static inline int core_Trap(ULONG code, void *regs)
32 /* exec.library Alert() is inoperative without KernelBase */
33 if (SysBase && KernelBase)
35 void (*trapHandler)(ULONG, void *) = SysBase->TaskTrapCode;
36 struct Task *t = SysBase->ThisTask;
38 if (t)
40 if (t->tc_TrapCode)
41 trapHandler = t->tc_TrapCode;
44 if (trapHandler)
46 trapHandler(code, regs);
47 return 1;
50 return 0;