2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 #include <aros/config.h>
11 #include <exec/types.h>
12 #include <exec/nodes.h>
13 #include <exec/memory.h>
14 #include <exec/resident.h>
15 #include <exec/libraries.h>
16 #include <exec/execbase.h>
17 #include <proto/oop.h>
18 #include <proto/exec.h>
20 #include <devices/keyboard.h>
23 #include <aros/debug.h>
24 #include <aros/core.h>
25 #include <asm/registers.h>
31 #include "exec_intern.h"
34 extern struct ExecBase
* PrepareExecBase(struct MemHeader
*);
35 extern void switch_to_user_mode(void *, ULONG
*);
36 extern void main_init_cont(void);
37 extern struct MemHeader
* detect_memory(void);
41 * Just to be sure all of these modules get linked into the
42 * final module, this structure should stay here, because
43 * otherwise the linker might not take it if there is no
44 * reference to a certain module at all.
46 extern const struct Resident
53 Mathieeesingbas_resident
,
65 hiddgraphics_resident
,
81 /* This list MUST be in the correct order (priority). */
82 static const struct Resident
*romtagList
[] =
88 &Mathieeesingbas_resident
,
102 &hiddgraphics_resident
,
103 &displayHidd_resident
,
104 &hiddserial_resident
,
111 &con_handler_resident
114 /************************************************************************************/
116 void processor_init(void)
118 /************ CPU setup *******************/
119 __asm__
__volatile__("oriw #0x0700,%%sr" :: );
121 /************ LCD Controller **************/
123 * Turn the LCD controller on
125 WREG_B(PFDATA
) = 0x010;
127 WREG_L(LSSA
) = 0x90000;
128 WREG_B(LVPW
) = 160/16;
129 WREG_W(LXMAX
) = 160-1;
130 WREG_W(LYMAX
) = 160-1;
133 WREG_W(LCWCH
) = (10 << 8) | 10;
134 WREG_B(LBLKC
) = 0x80 | 0x10;
138 // DO NOT ACTIVATE THESE! IT STOPS OUTPUT ON XCOPILOT!!
146 WREG_B(LOTCR
) = 0x4e; // 0xfffffa2b
148 /************* Interrupt Controller **********/
149 WREG_L(IMR
) = ~((1 << 1) | (1 << 5));
153 /************************************************************************************/
154 extern ULONG initial_ssp
;
158 struct ExecBase
*SysBase
= NULL
;
160 UWORD
* rom_ranges
[] = {(UWORD
*)0x10c00000 , (UWORD
*)0x10c00000 + (1024 * 1024),
162 #define MAX_MEM_HEADERS 10
163 struct MemHeader
* mh
= NULL
;
168 * detect memory of the system
170 mh
= detect_memory();
173 We have to put somewhere in this function checking for ColdStart,
174 CoolStart and many other Exec vectors!
178 It is OK to place ExecBase here. Remember that interrupt table starts
179 at 0x0100UL address, so 4UL is quite safe.
180 Even with MP this addr is OK for ExecBase. We may write an int handler
181 which detects "read from 4UL" commands.
184 SysBase
= (struct ExecBase
*)PrepareExecBase(mh
);
185 *(APTR
*)0x4 = SysBase
;
188 Setup ChkBase (checksum for base ptr), ChkSum (for library)
189 SysBase+ChkBase should be -1 otherwise somebody has destroyed ExecBase!
191 SysBase
->ChkBase
=~(ULONG
)SysBase
;
192 #warning TODO: SysBase->ChkSum=.....
194 if (NULL
== (m68k_USP
=(ULONG
*)AllocMem(AROS_STACKSIZE
,MEMF_PUBLIC
))) {
197 m68k_USP
= (ULONG
*)(((ULONG
)m68k_USP
) + AROS_STACKSIZE
);
200 * Allocate memory for the SSP. The SSP is already set
201 * but I need to AllocAbs() it so nobody else will step on this
204 if (NULL
== AllocAbs(AROS_STACKSIZE
,
205 (APTR
)(initial_ssp
+sizeof(ULONG
)-AROS_STACKSIZE
))) {
206 D(bug("Alloc for SSP failed!\n"));
208 D(bug("SSP: %x\n",initial_ssp
));
210 SysBase
->ResModules
=Exec_RomTagScanner(SysBase
, rom_ranges
);
218 * This is the last place where I am in supervisor mode.
219 * so let me switch into user mode and continue there.
220 * The user mode function will then call main_init_cont.
222 switch_to_user_mode(main_init_cont
, m68k_USP
);
226 * The following function will be executed whan AROS is in user mode
228 void main_init_cont(void)
230 InitCode(RTF_SINGLETASK
, 0);
233 All done. In normal cases CPU should never reach this point
236 *(ULONG
*)0xc0debad0 = 0;