• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * arch/score/kernel/head.S
3 *
4 * Score Processor version.
5 *
6 * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
7 *  Chen Liqin <liqin.chen@sunplusct.com>
8 *  Lennox Wu <lennox.wu@sunplusct.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see the file COPYING, or write
22 * to the Free Software Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 */
25#include <linux/init.h>
26#include <linux/linkage.h>
27
28#include <asm/asm-offsets.h>
29
30	.extern start_kernel
31	.global init_thread_union
32	.global	kernelsp
33
34__INIT
35ENTRY(_stext)
36	la	r30, __bss_start	/* initialize BSS segment. */
37	la	r31, _end
38	xor	r8, r8, r8
39
401:	cmp.c	r31, r30
41	beq	2f
42
43	sw	r8, [r30]		/* clean memory. */
44	addi	r30, 4
45	b	1b
46
472:	la	r28, init_thread_union	/* set kernel stack. */
48	mv	r0, r28
49	addi	r0, KERNEL_STACK_SIZE - 32
50	la	r30, kernelsp
51	sw	r0, [r30]
52	subi	r0, 4*4
53	xor	r30, r30, r30
54	ori	r30, 0x02		/* enable MMU. */
55	mtcr	r30, cr4
56	nop
57	nop
58	nop
59	nop
60	nop
61	nop
62	nop
63
64	/* there is no parameter */
65	xor	r4, r4, r4
66	xor	r5, r5, r5
67	xor	r6, r6, r6
68	xor	r7, r7, r7
69	la	r30, start_kernel	/* jump to init_arch */
70	br	r30
71