5 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
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 */
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. */
35 #define HW_IRQ_COUNT (256 - INTB_KERNEL - HW_IRQ_BASE)
37 #define HW_IRQ_COUNT (256 - INTB_KERNEL)
39 #endif /* !HW_IRQ_COUNT */
41 #define KBL_INTERNAL 0
42 #endif /* !KBL_INTERNAL */
44 #ifdef KERNELIRQ_NEEDSPRIVATE
47 IPTR ki_Priv
; /* arch specific per-irq data */
50 #define KERNELIRQ_LIST(x) KernelBase->kb_Interrupts[x].ki_List
52 #define KernelInt List
53 #define KERNELIRQ_LIST(x) KernelBase->kb_Interrupts[x]
56 /* kernel.resource base. Nothing spectacular, really. */
60 #ifdef KERNELIRQ_NEEDSCONTROLLERS
61 struct List kb_ICList
; /* list of all controller types */
62 struct List kb_InterruptMappings
;
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 */
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>
100 #endif /* !KERNEL_BASE_H */