revert previous incorrect version of commit and recommit correct version to allow...
[AROS.git] / rom / kernel / kernel_intr.h
blob68954e545c19087b6081575e465d8317fc22f603
1 #ifndef KERNEL_INTR_H
2 #define KERNEL_INTR_H
4 /*
5 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc:
9 */
11 #include <proto/exec.h>
13 #include "exec_platform.h"
15 /* Main scheduler entry points */
16 void core_ExitInterrupt(regs_t *regs);
17 void core_SysCall(int sc, regs_t *regs);
19 /* CPU-specific wrappers. Need to be implemented in CPU-specific parts */
20 void cpu_Switch(regs_t *regs);
21 void cpu_Dispatch(regs_t *regs);
23 /* This constant can be redefined in arch-specific includes */
24 #ifndef _CUSTOM
25 #define _CUSTOM NULL
26 #endif
28 /* Call exec interrupt vector, if present */
29 static inline void core_Cause(unsigned char n, unsigned int mask)
31 struct IntVector *iv = &SysBase->IntVects[n];
33 /* If the SoftInt vector in SysBase is set, call it. It will do the rest for us */
34 if (iv->iv_Code)
35 AROS_INTC3(iv->iv_Code, iv->iv_Data, mask, _CUSTOM);
38 /* Call exec trap handler, if possible */
39 static inline int core_Trap(ULONG code, void *regs)
41 /* exec.library Alert() is inoperative without KernelBase,
42 * but SysBase should not be valid if KernelBase is
43 * not set up.
45 if (SysBase)
47 void (*trapHandler)(ULONG, void *) = SysBase->TaskTrapCode;
48 struct Task *t = GET_THIS_TASK;
50 if (t)
52 if (t->tc_TrapCode)
53 trapHandler = t->tc_TrapCode;
56 if (trapHandler)
58 trapHandler(code, regs);
59 return 1;
62 return 0;
64 #endif /* !KERNEL_INTR_H */