xref: /openbmc/linux/arch/microblaze/kernel/head.S (revision b04b4f78)
1/*
2 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2007-2009 PetaLogix
4 * Copyright (C) 2006 Atmark Techno, Inc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/linkage.h>
12#include <asm/thread_info.h>
13#include <asm/page.h>
14
15	.text
16ENTRY(_start)
17	mfs	r1, rmsr
18	andi	r1, r1, ~2
19	mts	rmsr, r1
20
21/* save fdt to kernel location */
22/* r7 stores pointer to fdt blob */
23	beqi	r7, no_fdt_arg
24	or	r11, r0, r0 /* incremment */
25	ori	r4, r0, TOPHYS(_fdt_start) /* save bram context */
26	ori	r3, r0, (0x4000 - 4)
27_copy_fdt:
28	lw	r12, r7, r11 /* r12 = r7 + r11 */
29	sw	r12, r4, r11 /* addr[r4 + r11] = r12 */
30	addik	r11, r11, 4 /* increment counting */
31	bgtid	r3, _copy_fdt /* loop for all entries */
32	addik	r3, r3, -4 /* descrement loop */
33no_fdt_arg:
34
35	/* Initialize small data anchors */
36	la	r13, r0, _KERNEL_SDA_BASE_
37	la	r2, r0, _KERNEL_SDA2_BASE_
38
39	/* Initialize stack pointer */
40	la	r1, r0, init_thread_union + THREAD_SIZE - 4
41
42	/* Initialize r31 with current task address */
43	la	r31, r0, init_task
44
45	/*
46	 * Call platform dependent initialize function.
47	 * Please see $(ARCH)/mach-$(SUBARCH)/setup.c for
48	 * the function.
49	 */
50	la	r8, r0, machine_early_init
51	brald	r15, r8
52	nop
53
54	la	r15, r0, machine_halt
55	braid	start_kernel
56	nop
57