1
/* First stage loader bootstrap for both v0, v2 and SUNW,Ultra's IEEE 1275 PROM
2
designed for the romfs.
4
Copyright (C) 1996,1997,1998,2000 Jakub Jelinek
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21
#define BLOCK_START 0x3dc
31
.global _start, letter_here, digit_here
37
sethi %hi(0x4000), buffer
38
or buffer, (BLOCK_START + 3 * 512), %i5
39
sethi %hi(0x10000), dest
42
add buffer, %lo(chosen), %o1
44
add buffer, %lo(finddevice), %o0
47
add buffer, %lo(stdout), %o0
48
lduw [dest + 256], stdouth
52
add buffer, %lo(bootpath), %o0
69
add buffer, %lo(open), %o0
72
or buffer, BLOCK_START, %l2
79
add buffer, %lo(seek), %o0
91
add buffer, %lo(read), %o0
98
add buffer, %lo(close), %o0
99
ldub [dest + 1024 + 0x08], %o0
102
add buffer, %lo(exit), %o0
108
jmpl dest + 1024, %g0
116
add buffer, %lo(write), %o0
118
add buffer, %lo(exit), %o0
128
add buffer, %lo(getprops), %o0
140
jmpl promvec + %g0, %g0
177
ld [promvec+4], promvers
178
sethi %hi(0x4000), buffer
179
sethi %hi(0x10000), dest
185
ld [promvec+136], %o0 ! pv_v2bootargs.bootpath
187
ld [promvec+128], %o0
188
ld [%o0], %o3 ! o3 = *pv_v0bootargs
189
lduh [%o3+132], %o1 ! 'sd', 'fd' or whatever
193
ld [%o3+136], %o0 ! controler id (hope it is less than 10)
198
ld [%o3+140], %o4 ! unit id (again, hope nobody uses wide on v0 prom)
205
std %o2, [buffer + 0x400] ! put the 'sd(i,j,k' somewhere...
208
sth %o2, [buffer + 0x408] ! put there the rest ')\0' as well...
210
ld [promvec+36], %o1 ! pv_v0devops.v0_devopen
212
ld [promvec+172], %o1
214
add buffer, 0x400, %o2
229
ldub [buffer + (letter_here - _start + 3)], %o4
234
add buffer, 0x400, %o0
237
or buffer, BLOCK_START, %l2
243
ld [promvec+44], %o4 ! pv_v0devops.v0_rdblkdev
260
ld [promvec+188], %o4 ! pv_v2devops.v2_dev_seek
271
ld [promvec+180], %o4 ! pv_v2devops.v2_dev_read
280
ldub [dest + 0x08], %o0
286
ld [promvec+176], %l1 ! pv_v2devops.v2_dev_close
290
ld [promvec+40], %l1 ! pv_v0devops.v0_dev_close
294
clr %o4 ! we are not an Ultra
298
ld [promvec+116], %g1
303
ld [promvec+92], %o1 ! pv_nbputchar
306
or buffer, (BLOCK_START + 3 * 512), %i5
309
ld [promvec+148], %o0 ! pv_v2bootargs.fd_stdout
310
ld [promvec+184], %o3 ! pv_v2devops.v2_dev_write
315
or buffer, (BLOCK_START + 3 * 512), %i5