dec-multia: make netboot possible, add aboot bootloader
[openadk.git] / package / aboot / src / head.S
blob0e624e0dad2b781a2cc0801fe04189cfa3b5d152
1 /*
2  * arch/alpha/boot/head.S
3  *
4  * initial bootloader stuff..
5  */
7 #include "pal.h"
9 #include <config.h>
11         .set noreorder
12         .globl  __start
13         .ent    __start
14 __start:
15         .prologue 0
16         bis     $31,$31,$31
17         br      1f
18         /* room for the initial PCB, which comes here */
19         .quad   0,0,0,0,0,0,0,0
20 1:      br      $27,2f
21 2:      ldgp    $29,0($27)
22         lda     $27,main_
23         jsr     $26,($27),main_
24         call_pal PAL_halt
25         .end __start
27         /* these must appear within first 512 bytes: */
28         .align 3
29         .quad   ABOOT_MAGIC
30 config_file_partition:
31         .globl  config_file_partition
32         .quad   CONFIG_FILE_PARTITION
33 raw_initrd_size:
34         .globl  raw_initrd_size
35         .quad   0
37         .align 3
38         .globl wrent
39         .ent wrent
40 wrent:
41         .prologue 0
42         call_pal PAL_wrent
43         ret ($26)
44         .end wrent
46         .align 3
47         .globl wrkgp
48         .ent wrkgp
49 wrkgp:  
50         .prologue 0
51         call_pal PAL_wrkgp
52         ret ($26)
53         .end wrkgp
55         .align 3
56         .globl tbi
57         .ent tbi
58 tbi:    
59         .prologue 0
60         call_pal PAL_tbi
61         ret     ($26)
62         .end tbi
64         .align 3
65         .globl switch_to_osf_pal
66         .ent switch_to_osf_pal
67 switch_to_osf_pal:
68         .prologue 0
69         subq    $30,128,$30
70         stq     $26,0($30)
71         stq     $1,8($30)       # regs clobbered by swppal
72         stq     $2,16($30)
73         stq     $3,24($30)
74         stq     $4,32($30)
75         stq     $5,40($30)
76         stq     $6,48($30)
77         stq     $7,56($30)
78         stq     $8,64($30)
79         stq     $9,72($30)
80         stq     $10,80($30)
81         stq     $11,88($30)
82         stq     $12,96($30)
83         stq     $13,104($30)
84         stq     $14,112($30)
85         stq     $15,120($30)
87         stq     $30,0($17)      /* save KSP in PCB (a1) */
89         bis     $30,$30,$20     /* a4 = KSP */
90         br      $17,__do_swppal
92         ldq     $26,0($30)
93         ldq     $1,8($30)
94         ldq     $2,16($30)
95         ldq     $3,24($30)
96         ldq     $4,32($30)
97         ldq     $5,40($30)
98         ldq     $6,48($30)
99         ldq     $7,56($30)
100         ldq     $8,64($30)
101         ldq     $9,72($30)
102         ldq     $10,80($30)
103         ldq     $11,88($30)
104         ldq     $12,96($30)
105         ldq     $13,104($30)
106         ldq     $14,112($30)
107         ldq     $15,120($30)
108         addq    $30,128,$30
109         ret ($26)
111 __do_swppal:
112         call_pal PAL_swppal
113         .end    switch_to_osf_pal
115         .align 3
116         .globl dispatch
117         .ent dispatch
118 dispatch:       
119         .prologue 0
120         subq    $30,80,$30
121         stq     $26,0($30)
122         stq     $29,8($30)
124         stq     $8,16($30)      /* OpenVMS save regs */
125         stq     $9,24($30)
126         stq     $10,32($30)
127         stq     $11,40($30)
128         stq     $12,48($30)
129         stq     $13,56($30)
130         stq     $14,64($30)
131         stq     $15,72($30)
133         lda     $1,0x10000000           /* hwrpb */
134         ldq     $2,0xc0($1)             /* crb offset */
135         addq    $2,$1,$2                /* crb */
136         ldq     $27,0($2)               /* dispatch procedure value */
138         ldq     $2,8($27)               /* dispatch call address */
139         jsr     $26,($2)                /* call it (weird VMS call seq) */
141         ldq     $26,0($30)
142         ldq     $29,8($30)
144         ldq     $8,16($30)
145         ldq     $9,24($30)
146         ldq     $10,32($30)
147         ldq     $11,40($30)
148         ldq     $12,48($30)
149         ldq     $13,56($30)
150         ldq     $14,64($30)
151         ldq     $15,72($30)
153         addq    $30,80,$30
154         ret     $31,($26)
155 .end    dispatch
158         .align 3
159         .globl halt
160         .ent halt
161 halt:   
162         .prologue 0
163         call_pal PAL_halt
164         .end halt
166         .ent run_kernel
167         .globl run_kernel
168 run_kernel:
169         .prologue 0
170         mov     $16,$27
171         mov     $17,$30
172         jmp     $31,($27)
173         .end run_kernel