fix __AROS_SETVECADDR invocations.
[AROS.git] / rom / kernel / kernel_intr.h
blob59f30451be531155c3f9bea531854db694313cdd
1 #ifndef KERNEL_INTR_H
2 #define KERNEL_INTR_H
3 /*
4 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 $Id$
7 Desc:
8 */
10 #include <proto/exec.h>
12 #include "exec_platform.h"
14 /* Main scheduler entry points */
15 void core_ExitInterrupt(regs_t *regs);
16 void core_SysCall(int sc, regs_t *regs);
18 /* CPU-specific wrappers. Need to be implemented in CPU-specific parts */
19 void cpu_Switch(regs_t *regs);
20 void cpu_Dispatch(regs_t *regs);
22 /* This constant can be redefined this in arch-specific includes */
23 #ifndef _CUSTOM
24 #define _CUSTOM NULL
25 #endif
27 /* Call exec interrupt vector, if present */
28 static inline void core_Cause(unsigned char n, unsigned int mask)
30 struct IntVector *iv = &SysBase->IntVects[n];
32 /* If the SoftInt vector in SysBase is set, call it. It will do the rest for us */
33 if (iv->iv_Code)
34 AROS_INTC3(iv->iv_Code, iv->iv_Data, mask, _CUSTOM);
37 /* Call exec trap handler, if possible */
38 static inline int core_Trap(ULONG code, void *regs)
40 /* exec.library Alert() is inoperative without KernelBase,
41 * but SysBase should not be valid if KernelBase is
42 * not set up.
44 if (SysBase)
46 void (*trapHandler)(ULONG, void *) = SysBase->TaskTrapCode;
47 struct Task *t = GET_THIS_TASK;
49 if (t)
51 if (t->tc_TrapCode)
52 trapHandler = t->tc_TrapCode;
55 if (trapHandler)
57 trapHandler(code, regs);
58 return 1;
61 return 0;
63 #endif /* !KERNEL_INTR_H */