xref: /minix3/minix/kernel/arch/earm/head.S (revision 41b870c89094742fac0d9000e2abce50c1723418)
1433d6423SLionel Sambuc#include "kernel/kernel.h" /* configures the kernel */
2433d6423SLionel Sambuc
3433d6423SLionel Sambuc/* sections */
4433d6423SLionel Sambuc
5433d6423SLionel Sambuc#include <machine/vm.h>
6433d6423SLionel Sambuc#include "kernel/kernel.h"
7433d6423SLionel Sambuc#include <minix/config.h>
8433d6423SLionel Sambuc#include <minix/const.h>
9433d6423SLionel Sambuc#include <minix/com.h>
10433d6423SLionel Sambuc#include <machine/asm.h>
11433d6423SLionel Sambuc#include <machine/interrupt.h>
12433d6423SLionel Sambuc#include "archconst.h"
13433d6423SLionel Sambuc#include "kernel/const.h"
14433d6423SLionel Sambuc#include "kernel/proc.h"
15433d6423SLionel Sambuc#include "sconst.h"
16433d6423SLionel Sambuc#include <machine/multiboot.h>
17433d6423SLionel Sambuc#include <machine/cpu.h>
18433d6423SLionel Sambuc
19433d6423SLionel Sambuc#include "arch_proto.h" /* K_STACK_SIZE */
20433d6423SLionel Sambuc
21*41b870c8SEmmanuel Blot.section .startup
22433d6423SLionel Sambuc/*===========================================================================*/
23433d6423SLionel Sambuc/*					MINIX				     */
24433d6423SLionel Sambuc/*===========================================================================*/
25433d6423SLionel Sambuc.global MINIX
26433d6423SLionel SambucMINIX:
27433d6423SLionel Sambuc/* this is the entry point for the MINIX kernel */
28433d6423SLionel Sambuc	b multiboot_init
29433d6423SLionel Sambuc
30*41b870c8SEmmanuel Blot.text
31433d6423SLionel Sambucmultiboot_init:
32433d6423SLionel Sambuc	ldr	sp, =load_stack_start	/* make usable stack */
33433d6423SLionel Sambuc	mov	fp, #0
34433d6423SLionel Sambuc	bl	_C_LABEL(pre_init)
35433d6423SLionel Sambuc
36433d6423SLionel Sambuc	/* Kernel is mapped high now and ready to go, with
37433d6423SLionel Sambuc	 * the boot info pointer returned by pre_init in r0.
38433d6423SLionel Sambuc	 * Set the highly mapped stack and initialize it.
39433d6423SLionel Sambuc	 *
40433d6423SLionel Sambuc	 * Afther that call kmain with r0 still pointing to boot info
41433d6423SLionel Sambuc	 */
42433d6423SLionel Sambuc	ldr	sp, =k_initial_stktop
43433d6423SLionel Sambuc	mov	r1, #0
44433d6423SLionel Sambuc	push	{r1}			/* Terminate stack */
45433d6423SLionel Sambuc	ldr	r2, =_C_LABEL(kmain)	/* r0 holds kinfo_t ptr */
46433d6423SLionel Sambuc	bx	r2
47433d6423SLionel Sambuc
48433d6423SLionel Sambuc	/* not reached */
49433d6423SLionel Sambuchang:
50433d6423SLionel Sambuc	b hang
51433d6423SLionel Sambuc
52433d6423SLionel Sambuc.data
53433d6423SLionel Sambucload_stack:
54433d6423SLionel Sambuc	.space 4096
55433d6423SLionel Sambucload_stack_start:
56