wip.. store the idletask in TLS. move the execsmp bootstrap code into its own file...
[AROS.git] / arch / arm-native / exec / platform_init.c
bloba8cdd3751a1d766eb0514d0b695051e40f2dea35
1 /*
2 Copyright © 2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 1
8 #include <aros/debug.h>
9 #include <aros/cpu.h>
10 #include <aros/kernel.h>
11 #include <aros/symbolsets.h>
12 #include <exec/memory.h>
13 #include <exec/tasks.h>
14 #include <exec/alerts.h>
15 #include <exec/execbase.h>
16 #include <asm/io.h>
17 #include <proto/exec.h>
18 #include <proto/kernel.h>
19 #include <strings.h>
21 #include "exec_intern.h"
23 /* Linked from kernel.resource,
24 * need to retrieve in a cleaner fashion .. */
25 extern IPTR stack[];
27 extern void IdleTask(struct ExecBase *);
29 int Exec_ARMCPUInit(struct ExecBase *SysBase)
31 struct Task *BootTask, *CPUIdleTask;
32 int cpunum = KrnGetCPUNumber();
34 D(bug("[Exec] Exec_ARMCPUInit(%02d)\n", cpunum));
36 BootTask = GET_THIS_TASK;
38 D(bug("[Exec] Exec_ARMCPUInit[%02d]: %s @ 0x%p\n", cpunum, BootTask->tc_Node.ln_Name, BootTask));
40 if (cpunum == 0)
42 /* for our sanity we will tell exec about the correct stack for the boot task */
43 BootTask->tc_SPLower = stack;
44 BootTask->tc_SPUpper = stack + AROS_STACKSIZE;
47 CPUIdleTask = NewCreateTask(TASKTAG_NAME , "System Idle",
48 #if defined(__AROSEXEC_SMP__)
49 TASKTAG_AFFINITY , KrnGetCPUMask(cpunum),
50 #endif
51 TASKTAG_PRI , -127,
52 TASKTAG_PC , IdleTask,
53 TASKTAG_ARG1 , SysBase,
54 TAG_DONE);
56 if (CPUIdleTask)
58 CPUIdleTask->tc_State = TS_WAIT;
59 TLS_SET(IdleTask, CPUIdleTask);
60 D(bug("[Exec] Exec_ARMCPUInit[%02d]: %s Task @ 0x%p\n", cpunum, CPUIdleTask->tc_Node.ln_Name, CPUIdleTask));
63 return TRUE;
66 ADD2INITLIB(Exec_ARMCPUInit, 0)