Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / arm-native / kernel / kernel_intern.h
blobf1a310d5d04ba6d7200df590832de0d4475b4134
1 /*
2 Copyright © 2013-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef KERNEL_INTERN_H_
7 #define KERNEL_INTERN_H_
9 #include <aros/libcall.h>
10 #include <inttypes.h>
11 #include <exec/lists.h>
12 #include <exec/execbase.h>
13 #include <exec/memory.h>
14 #include <utility/tagitem.h>
15 #include <stdio.h>
16 #include <stdarg.h>
18 #include "kernel_arm.h"
20 #undef KernelBase
21 struct KernelBase;
23 #define KERNEL_PHYS_BASE 0x07800000
24 #define KERNEL_VIRT_BASE 0xff800000
26 #define VFPEnable (1 << 30)
27 #define VFPSingle (3 << 20)
28 #define VFPDouble (3 << 22)
30 void cpu_Probe(struct ARM_Implementation *);
31 void cpu_Init(struct ARM_Implementation *, struct TagItem *);
33 void platform_Init(struct ARM_Implementation *, struct TagItem *);
35 void core_SetupMMU(struct TagItem *msg);
36 void core_SetupIntr(void);
38 void *KrnAddSysTimerHandler(struct KernelBase *);
40 intptr_t krnGetTagData(Tag tagValue, intptr_t defaultVal, const struct TagItem *tagList);
41 struct TagItem *krnFindTagItem(Tag tagValue, const struct TagItem *tagList);
42 struct TagItem *krnNextTagItem(const struct TagItem **tagListPtr);
44 struct KernelBase *getKernelBase();
46 #ifdef bug
47 #undef bug
48 #endif
49 #ifdef D
50 #undef D
51 #endif
52 #if DEBUG
53 #define D(x) x
54 #define DALLOCMEM(x)
55 #else
56 #define D(x)
57 #define DALLOCMEM(x)
58 #endif
60 #define __STR(x) #x
61 #define STR(x) __STR(x)
63 AROS_LD2(int, KrnBug,
64 AROS_LDA(const char *, format, A0),
65 AROS_LDA(va_list, args, A1),
66 struct KernelBase *, KernelBase, 12, Kernel);
68 static inline void bug(const char *format, ...)
70 struct KernelBase *kbase = getKernelBase();
71 va_list args;
72 va_start(args, format);
73 AROS_SLIB_ENTRY(KrnBug, Kernel, 12)(format, args, kbase);
74 va_end(args);
77 #define VECTCOMMON_START \
78 " srsfd sp!, #0x13 \n" \
79 " cpsid i, #0x13 \n" \
80 " sub sp, sp, #2*4 \n" \
81 " stmfd sp!, {r0-r12} \n" \
82 " sub r0, sp, #4 \n" \
83 " strex r1, r2, [r0] \n" \
84 " mov r0, sp \n" \
85 " ldr ip, [r0, #16*4] \n" \
86 " and ip, ip, #0x1f \n" \
87 " cmp ip, #0x10 \n" \
88 " cmpne ip, #0x1f \n" \
89 " addeq r1, r0, #13*4 \n" \
90 " stmeq r1, {sp, lr}^ \n" \
91 " strne lr, [r0, #14*4] \n"
93 #define VECTCOMMON_END \
94 " sub r0, sp, #4 \n" \
95 " strex r1, r2, [r0] \n" \
96 " ldr ip, [sp, #16*4] \n" \
97 " and ip, ip, #0x1f \n" \
98 " cmp ip, #0x10 \n" \
99 " cmpne ip, #0x1f \n" \
100 " addeq r1, sp, #13*4 \n" \
101 " ldmeq r1, {sp, lr}^ \n" \
102 " ldrne lr, [sp, #14*4] \n" \
103 " ldmfd sp!, {r0-r12} \n" \
104 " add sp, sp, #2*4 \n" \
105 " rfefd sp! \n"
107 #define STORE_TASKSTATE(task, regs) \
108 struct ExceptionContext *ctx = task->tc_UnionETask.tc_ETask->et_RegFrame; \
109 int __task_reg_no; \
110 for (__task_reg_no = 0; __task_reg_no < 12; __task_reg_no++) \
112 ctx->r[__task_reg_no] = ((uint32_t *)regs)[__task_reg_no]; \
114 ctx->ip = ((uint32_t *)regs)[12]; \
115 ctx->sp = task->tc_SPReg = ((uint32_t *)regs)[13]; \
116 ctx->lr = ((uint32_t *)regs)[14]; \
117 ctx->pc = ((uint32_t *)regs)[15]; \
118 ctx->cpsr = ((uint32_t *)regs)[16]; \
119 if (__arm_arosintern.ARMI_Save_VFP_State) __arm_arosintern.ARMI_Save_VFP_State(ctx->fpuContext);
121 #define RESTORE_TASKSTATE(task, regs) \
122 struct ExceptionContext *ctx = task->tc_UnionETask.tc_ETask->et_RegFrame; \
123 int __task_reg_no; \
124 for (__task_reg_no = 0; __task_reg_no < 12; __task_reg_no++) \
126 ((uint32_t *)regs)[__task_reg_no] = ctx->r[__task_reg_no]; \
128 ((uint32_t *)regs)[12] = ctx->ip; \
129 ((uint32_t *)regs)[13] = ctx->sp = task->tc_SPReg; \
130 ((uint32_t *)regs)[14] = ctx->lr; \
131 ((uint32_t *)regs)[15] = ctx->pc; \
132 ((uint32_t *)regs)[16] = ctx->cpsr; \
133 if (__arm_arosintern.ARMI_Restore_VFP_State) __arm_arosintern.ARMI_Restore_VFP_State(ctx->fpuContext);
135 #endif /*KERNEL_INTERN_H_*/