the kernel needs to accept uint32_t IRQ numbers, like exec, so that we can provide...
[AROS.git] / rom / kernel / kernel_base.h
blobde233fe0c7482858a3599e3346ea71ba12017ee4
1 #ifndef KERNEL_BASE_H
2 #define KERNEL_BASE_H
4 /*
5 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc:
9 */
11 #define __KERNEL_NOLIBBASE__
13 #include <exec/execbase.h>
14 #include <exec/memory.h>
15 #include <exec/semaphores.h>
16 #include <aros/kernel.h>
18 /* Early declaration for ictl functions */
19 struct KernelBase;
21 /* These two specify IRQ_COUNT and EXCEPTIONS_COUNT */
22 #include <kernel_arch.h>
23 #include <kernel_cpu.h>
25 /* Declare global variable at absolute address */
26 #define IMPORT_GLOBAL(var, addr) \
27 asm(".globl " # var "\n" \
28 ".set " # var ", " # addr )
30 /* Platform-specific stuff. Black box here. */
31 struct PlatformData;
33 #ifndef HW_IRQ_COUNT
34 #ifdef HW_IRQ_BASE
35 #define HW_IRQ_COUNT (256 - INTB_KERNEL - HW_IRQ_BASE)
36 #else
37 #define HW_IRQ_COUNT (256 - INTB_KERNEL)
38 #endif
39 #endif /* !HW_IRQ_COUNT */
40 #ifndef KBL_INTERNAL
41 #define KBL_INTERNAL 0
42 #endif /* !KBL_INTERNAL */
44 #ifdef KERNELIRQ_NEEDSPRIVATE
45 struct KernelInt
47 IPTR ki_Priv; /* arch specific per-irq data */
48 struct List ki_List;
50 #define KERNELIRQ_LIST(x) KernelBase->kb_Interrupts[x].ki_List
51 #else
52 #define KernelInt List
53 #define KERNELIRQ_LIST(x) KernelBase->kb_Interrupts[x]
54 #endif
56 /* kernel.resource base. Nothing spectacular, really. */
57 struct KernelBase
59 struct Node kb_Node;
60 #ifdef KERNELIRQ_NEEDSCONTROLLERS
61 struct List kb_ICList; /* list of all controller types */
62 struct List kb_InterruptMappings;
63 #endif
64 struct MinList kb_Exceptions[EXCEPTIONS_COUNT];
65 struct KernelInt kb_Interrupts[HW_IRQ_COUNT];
66 ULONG kb_ContextFlags; /* Hints for KrnCreateContext() */
67 ULONG kb_ContextSize; /* Total length of CPU context */
68 ULONG kb_PageSize; /* Physical memory page size */
69 struct PlatformData *kb_PlatformData;
70 #ifdef KERNELIRQ_NEEDSCONTROLLERS
71 UBYTE kb_ICTypeBase; /* used to set IC controller ID's */
72 #endif
76 * Some useful global variables. They are global because:
77 * - BootMsg needs to be stored before KernelBase is allocated;
78 * - KernelBase is needed by interrupt handling code
80 extern struct TagItem *BootMsg;
81 extern struct KernelBase *KernelBase;
83 /* Allocation function */
84 struct KernelBase *AllocKernelBase(struct ExecBase *SysBase);
86 /* Utility function to clear BSS segments. Call it before storing any globals!!! */
87 void __clear_bss(const struct KernelBSS *bss);
89 /* Memory header initialization functions */
90 void krnCreateMemHeader(CONST_STRPTR name, BYTE pri, APTR start, IPTR size, ULONG flags);
91 struct MemHeader *krnCreateROMHeader(CONST_STRPTR name, APTR start, APTR end);
92 /* Memhry header - TLSF support functions */
93 void krnCreateTLSFMemHeader(CONST_STRPTR name, BYTE pri, APTR start, IPTR size, ULONG flags);
94 struct MemHeader * krnConvertMemHeaderToTLSF(struct MemHeader * source);
96 #ifdef KERNELIRQ_NEEDSCONTROLLERS
97 #include <kernel_interruptcontrollers.h>
98 #endif
100 #endif /* !KERNEL_BASE_H */