1/*
2 * arch/alpha/boot/head.S
3 *
4 * initial bootloader stuff..
5 */
6
7
8	.set noreorder
9	.globl	__start
10	.ent	__start
11__start:
12	br	$29,2f
132:	ldgp	$29,0($29)
14	jsr	$26,start_kernel
15	call_pal PAL_halt
16	.end __start
17
18	.align 5
19	.globl	wrent
20	.ent	wrent
21wrent:
22	.prologue 0
23	call_pal PAL_wrent
24	ret ($26)
25	.end wrent
26
27	.align 5
28	.globl	wrkgp
29	.ent	wrkgp
30wrkgp:
31	.prologue 0
32	call_pal PAL_wrkgp
33	ret ($26)
34	.end wrkgp
35
36	.align 5
37	.globl	switch_to_osf_pal
38	.ent	switch_to_osf_pal
39switch_to_osf_pal:
40	subq	$30,128,$30
41	.frame	$30,128,$26
42	stq	$26,0($30)
43	stq	$1,8($30)
44	stq	$2,16($30)
45	stq	$3,24($30)
46	stq	$4,32($30)
47	stq	$5,40($30)
48	stq	$6,48($30)
49	stq	$7,56($30)
50	stq	$8,64($30)
51	stq	$9,72($30)
52	stq	$10,80($30)
53	stq	$11,88($30)
54	stq	$12,96($30)
55	stq	$13,104($30)
56	stq	$14,112($30)
57	stq	$15,120($30)
58	.prologue 0
59
60	stq	$30,0($17)	/* save KSP in PCB */
61
62	bis	$30,$30,$20	/* a4 = KSP */
63	br	$17,1f
64
65	ldq	$26,0($30)
66	ldq	$1,8($30)
67	ldq	$2,16($30)
68	ldq	$3,24($30)
69	ldq	$4,32($30)
70	ldq	$5,40($30)
71	ldq	$6,48($30)
72	ldq	$7,56($30)
73	ldq	$8,64($30)
74	ldq	$9,72($30)
75	ldq	$10,80($30)
76	ldq	$11,88($30)
77	ldq	$12,96($30)
78	ldq	$13,104($30)
79	ldq	$14,112($30)
80	ldq	$15,120($30)
81	addq	$30,128,$30
82	ret ($26)
831:	call_pal PAL_swppal
84	.end	switch_to_osf_pal
85
86	.align 3
87	.globl	tbi
88	.ent	tbi
89tbi:
90	.prologue 0
91	call_pal PAL_tbi
92	ret	($26)
93	.end tbi
94
95	.align 3
96	.globl	halt
97	.ent	halt
98halt:
99	.prologue 0
100	call_pal PAL_halt
101	.end halt
102
103/* $16 - new stack page */
104	.align 3
105	.globl	move_stack
106	.ent	move_stack
107move_stack:
108	.prologue 0
109	lda	$0, 0x1fff($31)
110	and	$0, $30, $1			/* Stack offset */
111	or	$1, $16, $16			/* New stack pointer */
112	mov	$30, $1
113	mov	$16, $2
1141:	ldq	$3, 0($1)			/* Move the stack */
115	addq	$1, 8, $1
116	stq	$3, 0($2)
117	and	$0, $1, $4
118	addq	$2, 8, $2
119	bne	$4, 1b
120	mov	$16, $30
121	ret	($26)
122	.end move_stack
123