2 * This file is intended to make generic kernel.resource compiling.
3 * This code should NEVER be executed. This file MUST be overriden in
4 * architecture-specific code for the scheduler to work!
7 #include <aros/kernel.h>
8 #include <aros/libcall.h>
9 #include <exec/execbase.h>
10 #include <hardware/intbits.h>
12 #include <proto/kernel.h>
16 #include "kernel_intern.h"
17 #include "kernel_debug.h"
18 #include "kernel_cpu.h"
19 #include "kernel_syscall.h"
20 #include "kernel_scheduler.h"
21 #include "kernel_intr.h"
26 extern struct Task
*sysIdleTask
;
28 void cpu_Switch(regs_t
*regs
)
32 D(bug("[Kernel] cpu_Switch()\n"));
34 task
= SysBase
->ThisTask
;
36 /* Copy current task's context into the ETask structure */
37 /* Restore the task's state */
38 STORE_TASKSTATE(task
, regs
)
40 /* Update the taks CPU time .. */
41 GetIntETask(task
)->iet_CpuTime
+= *((volatile unsigned int *)(SYSTIMER_CLO
)) - GetIntETask(task
)->iet_private1
;
46 void cpu_Dispatch(regs_t
*regs
)
50 D(bug("[Kernel] cpu_Dispatch()\n"));
52 /* Break Disable() if needed */
53 if (SysBase
->IDNestCnt
>= 0) {
54 SysBase
->IDNestCnt
= -1;
55 ((uint32_t *)regs
)[13] &= ~0x80;
58 if (!(task
= core_Dispatch()))
61 D(bug("[Kernel] cpu_Dispatch: Letting '%s' run for a bit..\n", task
->tc_Node
.ln_Name
));
63 /* Restore the task's state */
64 RESTORE_TASKSTATE(task
, regs
)
66 DREGS(cpu_DumpRegs(regs
));
68 /* Handle tasks's flags */
69 if (task
->tc_Flags
& TF_EXCEPT
)
72 /* Store the launch time */
73 GetIntETask(task
)->iet_private1
= *((volatile unsigned int *)(SYSTIMER_CLO
));
75 if (task
->tc_Flags
& TF_LAUNCH
)
77 AROS_UFC1(void, task
->tc_Launch
,
78 AROS_UFCA(struct ExecBase
*, SysBase
, A6
));
82 void cpu_DumpRegs(regs_t
*regs
)
86 bug("[KRN] Register Dump:\n");
87 for (i
= 0; i
< 12; i
++)
89 bug("[KRN] r%02d: 0x%08x\n", i
, ((uint32_t *)regs
)[i
]);
91 bug("[KRN] (ip) r12: 0x%08x\n", ((uint32_t *)regs
)[12]);
92 bug("[KRN] (sp) r13: 0x%08x\n", ((uint32_t *)regs
)[13]);
93 bug("[KRN] (lr) r14: 0x%08x\n", ((uint32_t *)regs
)[14]);
94 bug("[KRN] (pc) r15: 0x%08x\n", ((uint32_t *)regs
)[15]);
95 bug("[KRN] cpsr: 0x%08x\n", ((uint32_t *)regs
)[16]);