1 #ifndef KERNEL_INTERN_H_
2 #define KERNEL_INTERN_H_
4 #include <aros/libcall.h>
6 #include <exec/lists.h>
7 #include <exec/execbase.h>
8 #include <exec/memory.h>
9 #include <utility/tagitem.h>
10 #include <asm/amcc440.h>
14 #if defined(DEBUG) && DEBUG
15 #include <aros/debug.h>
17 #include "kernel_debug.h"
19 /* Early definition of 'bug'
22 static inline void bug(const char *fmt
, ...)
26 krnBug(fmt
, args
, NULL
);
31 #define KERNEL_PHYS_BASE 0x00800000
32 #define KERNEL_VIRT_BASE 0xff800000
34 #define STACK_SIZE 4096
37 context_t
* pd_FPUOwner
;
46 uint32_t pd_PVR
; /* Cache of the PVR SPR */
48 struct MinList
*pd_DebugInfo
; /* List of struct Parthenope_DebugInfo */
51 static inline BOOL
krnIsPPC440(uint32_t pvr
)
53 return (pvr
== PVR_PPC440EP_B
|| pvr
== PVR_PPC440EP_C
);
56 static inline BOOL
krnIsPPC460(uint32_t pvr
)
58 return (pvr
== PVR_PPC460EX_B
);
62 struct MinNode m_node
;
67 struct MinList m_symbols
;
71 struct MinNode s_node
;
77 static inline uint64_t mftbu()
82 asm volatile("mftbu %0; mftb %1; mftbu %2":"=r"(hi
),"=r"(lo
),"=r"(tmp
));
85 return (((uint64_t)hi
) << 32) | ((uint64_t)lo
);
88 intptr_t krnGetTagData(Tag tagValue
, intptr_t defaultVal
, struct TagItem
*tagList
);
89 struct TagItem
*krnFindTagItem(Tag tagValue
, struct TagItem
*tagList
);
90 struct TagItem
*krnNextTagItem(struct TagItem
**tagListPtr
);
92 void core_ExitInterrupt(context_t
*ctx
);
93 void dumpregs(context_t
*ctx
, uint8_t exception
);
95 void mmu_init(struct TagItem
*tags
);
98 extern ULONG uic_er
[4];
101 void uic_enable(int irq
);
102 void uic_disable(int irq
);
104 static inline void ExitInterrupt(context_t
*ctx
)
106 /* As per the documentation of core_ExitInterrupt,
107 * only call this if we are returning to user mode!
109 if (ctx
->cpu
.srr1
& MSR_PR
)
110 core_ExitInterrupt(ctx
);
113 typedef void exception_handler(context_t
*ctx
, uint8_t exception
);
115 extern exception_handler generic_handler
;
116 extern exception_handler uic_handler
;
117 extern exception_handler alignment_handler
;
118 extern exception_handler syscall_handler
;
119 extern exception_handler decrementer_handler
;
120 extern exception_handler mmu_handler
;
121 extern exception_handler program_handler
;
124 uint32_t findNames(intptr_t addr
, char **module
, char **function
);
127 #endif /*KERNEL_INTERN_H_*/