mark scripts as executable
[AROS.git] / rom / kernel / kernel_base.h
blob42c275fcb8a9aded15607d7c1d13af68b995758d
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 #ifndef __KERNEL_NOLIBBASE__
12 #define __KERNEL_NOLIBBASE__
13 #endif /* __KERNEL_NOLIBBASE__ */
15 #include <exec/execbase.h>
16 #include <exec/memory.h>
17 #include <exec/semaphores.h>
18 #include <aros/kernel.h>
20 /* Early declaration for ictl functions */
21 struct KernelBase;
23 /* These two specify IRQ_COUNT and EXCEPTIONS_COUNT */
24 #include <kernel_arch.h>
25 #include <kernel_cpu.h>
27 /* Declare global variable at absolute address */
28 #define IMPORT_GLOBAL(var, addr) \
29 asm(".globl " # var "\n" \
30 ".set " # var ", " # addr )
32 /* Platform-specific stuff. Black box here. */
33 struct PlatformData;
35 #ifndef HW_IRQ_COUNT
36 #ifdef HW_IRQ_BASE
37 #define HW_IRQ_COUNT (256 - INTB_KERNEL - HW_IRQ_BASE)
38 #else
39 #define HW_IRQ_COUNT (256 - INTB_KERNEL)
40 #endif
41 #endif /* !HW_IRQ_COUNT */
42 #ifndef KBL_INTERNAL
43 #define KBL_INTERNAL 0
44 #endif /* !KBL_INTERNAL */
46 #ifdef KERNELIRQ_NEEDSPRIVATE
47 struct KernelInt
49 IPTR ki_Priv; /* arch specific per-irq data */
50 struct List ki_List;
52 #define KERNELIRQ_LIST(x) KernelBase->kb_Interrupts[x].ki_List
53 #else
54 #define KernelInt List
55 #define KERNELIRQ_LIST(x) KernelBase->kb_Interrupts[x]
56 #endif
58 /* kernel.resource base. Nothing spectacular, really. */
59 struct KernelBase
61 struct Node kb_Node;
62 #ifdef KERNELIRQ_NEEDSCONTROLLERS
63 struct List kb_ICList; /* list of all controller types */
64 struct List kb_InterruptMappings;
65 #endif
66 struct MinList kb_Exceptions[EXCEPTIONS_COUNT];
67 struct KernelInt kb_Interrupts[HW_IRQ_COUNT];
68 ULONG kb_ContextFlags; /* Hints for KrnCreateContext() */
69 ULONG kb_ContextSize; /* Total length of CPU context */
70 ULONG kb_PageSize; /* Physical memory page size */
71 struct PlatformData *kb_PlatformData;
72 #ifdef KERNELIRQ_NEEDSCONTROLLERS
73 UBYTE kb_ICTypeBase; /* used to set IC controller ID's */
74 #endif
78 * Some useful global variables. They are global because:
79 * - BootMsg needs to be stored before KernelBase is allocated;
80 * - KernelBase is needed by interrupt handling code
82 extern struct TagItem *BootMsg;
83 extern struct KernelBase *KernelBase;
85 /* Allocation function */
86 struct KernelBase *AllocKernelBase(struct ExecBase *SysBase);
88 /* Utility function to clear BSS segments. Call it before storing any globals!!! */
89 void __clear_bss(const struct KernelBSS *bss);
91 /* Memory header initialization functions */
92 void krnCreateMemHeader(CONST_STRPTR name, BYTE pri, APTR start, IPTR size, ULONG flags);
93 struct MemHeader *krnCreateROMHeader(CONST_STRPTR name, APTR start, APTR end);
94 /* Memhry header - TLSF support functions */
95 void krnCreateTLSFMemHeader(CONST_STRPTR name, BYTE pri, APTR start, IPTR size, ULONG flags);
96 struct MemHeader * krnConvertMemHeaderToTLSF(struct MemHeader * source);
98 #ifdef KERNELIRQ_NEEDSCONTROLLERS
99 #include <kernel_interruptcontrollers.h>
100 #endif
102 #endif /* !KERNEL_BASE_H */