grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / kernel / kernel_intr.h
blob6bf4169b641778c00de1cb23660ebbacee878cb5
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 */
8 #include <proto/exec.h>
10 /* Main scheduler entry points */
11 void core_ExitInterrupt(regs_t *regs);
12 void core_SysCall(int sc, regs_t *regs);
14 /* CPU-specific wrappers. Need to be implemented in CPU-specific parts */
15 void cpu_Switch(regs_t *regs);
16 void cpu_Dispatch(regs_t *regs);
18 /* This constant can be redefined this in arch-specific includes */
19 #ifndef _CUSTOM
20 #define _CUSTOM NULL
21 #endif
23 /* Call exec interrupt vector, if present */
24 static inline void core_Cause(unsigned char n, unsigned int mask)
26 struct IntVector *iv = &SysBase->IntVects[n];
28 /* If the SoftInt vector in SysBase is set, call it. It will do the rest for us */
29 if (iv->iv_Code)
30 AROS_INTC3(iv->iv_Code, iv->iv_Data, mask, _CUSTOM);
33 /* Call exec trap handler, if possible */
34 static inline int core_Trap(ULONG code, void *regs)
36 /* exec.library Alert() is inoperative without KernelBase,
37 * but SysBase should not be valid if KernelBase is
38 * not set up.
40 if (SysBase)
42 void (*trapHandler)(ULONG, void *) = SysBase->TaskTrapCode;
43 struct Task *t = SysBase->ThisTask;
45 if (t)
47 if (t->tc_TrapCode)
48 trapHandler = t->tc_TrapCode;
51 if (trapHandler)
53 trapHandler(code, regs);
54 return 1;
57 return 0;