1	! Copyright 2005,2006,2007,2009 Imagination Technologies
2
3#include <linux/init.h>
4#include <asm/metag_mem.h>
5#include <generated/asm-offsets.h>
6#undef __exit
7
8	__HEAD
9	! Setup the stack and get going into _metag_start_kernel
10	.global	__start
11	.type   __start,function
12__start:
13	! D1Ar1 contains pTBI (ISTAT)
14	! D0Ar2 contains pTBI
15	! D1Ar3 contains __pTBISegs
16	! D0Ar4 contains kernel arglist pointer
17
18	MOVT    D0Re0,#HI(___pTBIs)
19	ADD     D0Re0,D0Re0,#LO(___pTBIs)
20	SETL    [D0Re0],D0Ar2,D1Ar1
21	MOVT    D0Re0,#HI(___pTBISegs)
22	ADD     D0Re0,D0Re0,#LO(___pTBISegs)
23	SETD    [D0Re0],D1Ar3
24	MOV	A0FrP,#0
25	MOV	D0Re0,#0
26	MOV	D1Re0,#0
27	MOV	D1Ar3,#0
28	MOV	D1Ar1,D0Ar4			!Store kernel boot params
29	MOV	D1Ar5,#0
30	MOV	D0Ar6,#0
31#ifdef CONFIG_METAG_DSP
32	MOV	D0.8,#0
33#endif
34	MOVT    A0StP,#HI(_init_thread_union)
35	ADD	A0StP,A0StP,#LO(_init_thread_union)
36	ADD     A0StP,A0StP,#THREAD_INFO_SIZE
37	MOVT	D1RtP,#HI(_metag_start_kernel)
38	CALL	D1RtP,#LO(_metag_start_kernel)
39	.size	__start,.-__start
40
41	!! Needed by TBX
42	.global	__exit
43	.type   __exit,function
44__exit:
45	XOR     TXENABLE,D0Re0,D0Re0
46	.size	__exit,.-__exit
47
48#ifdef CONFIG_SMP
49	.global _secondary_startup
50	.type _secondary_startup,function
51_secondary_startup:
52#if CONFIG_PAGE_OFFSET < LINGLOBAL_BASE
53	! In case GCOn has just been turned on we need to fence any writes that
54	! the boot thread might have performed prior to coherency taking effect.
55	MOVT	D0Re0,#HI(LINSYSEVENT_WR_ATOMIC_UNLOCK)
56	MOV	D1Re0,#0
57	SETD	[D0Re0], D1Re0
58#endif
59	MOVT	A0StP,#HI(_secondary_data_stack)
60	ADD	A0StP,A0StP,#LO(_secondary_data_stack)
61	GETD	A0StP,[A0StP]
62	ADD	A0StP,A0StP,#THREAD_INFO_SIZE
63	B	_secondary_start_kernel
64	.size	_secondary_startup,.-_secondary_startup
65#endif
66