1
/* First stage loader bootstrap for both v0, v2 and SUNW,Ultra's IEEE 1275 PROM
3
Copyright (C) 1996,1997,1998,2000 Jakub Jelinek
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20
#define BLOCK_START 0x3dc
30
.global _start, letter_here, digit_here, number_here
36
sethi %hi(0x4000), buffer
37
or buffer, (BLOCK_START + 3 * 512), %i5
38
sethi %hi(0x10000), dest
41
add buffer, %lo(chosen), %o1
43
add buffer, %lo(finddevice), %o0
46
add buffer, %lo(stdout), %o0
47
lduw [dest + 256], stdouth
51
add buffer, %lo(bootpath), %o0
68
add buffer, %lo(open), %o0
71
or buffer, BLOCK_START, %l1
80
add buffer, %lo(seek), %o0
86
add buffer, %lo(read), %o0
102
add buffer, %lo(close), %o0
103
ldub [dest + 1024 + 0x08], %o0
106
add buffer, %lo(exit), %o0
112
jmpl dest + 1024, %g0
121
add buffer, %lo(write), %o0
123
add buffer, %lo(exit), %o0
133
add buffer, %lo(getprops), %o0
145
jmpl promvec + %g0, %g0
182
ld [promvec+4], promvers
183
sethi %hi(0x4000), buffer
184
sethi %hi(0x10000), dest
190
ld [promvec+136], %o0 ! pv_v2bootargs.bootpath
192
ld [promvec+128], %o0
193
ld [%o0], %o3 ! o3 = *pv_v0bootargs
194
lduh [%o3+132], %o1 ! 'sd', 'fd' or whatever
198
ld [%o3+136], %o0 ! controler id (hope it is less than 10)
203
ld [%o3+140], %o4 ! unit id (again, hope nobody uses wide on v0 prom)
210
std %o2, [buffer + 0x400] ! put the 'sd(i,j,k' somewhere...
213
sth %o2, [buffer + 0x408] ! put there the rest ')\0' as well...
215
ld [promvec+36], %o1 ! pv_v0devops.v0_devopen
217
ld [promvec+172], %o1
219
add buffer, 0x400, %o2
234
ldub [buffer + (letter_here - _start + 3)], %o4
239
add buffer, 0x400, %o0
242
or buffer, BLOCK_START, %l1
252
ld [promvec+44], %o4 ! pv_v0devops.v0_rdblkdev
262
ld [promvec+188], %o4 ! pv_v2devops.v2_dev_seek
269
ld [promvec+180], %o4 ! pv_v2devops.v2_dev_read
288
ldub [dest + 0x08], %o0
291
ldub [buffer + (number_here - _start + 3)], %l3
294
ld [promvec+176], %l1 ! pv_v2devops.v2_dev_close
298
ld [promvec+40], %l1 ! pv_v0devops.v0_dev_close
302
clr %o4 ! we are not an Ultra
306
ld [promvec+116], %g1
311
ld [promvec+92], %o1 ! pv_nbputchar
314
or buffer, (BLOCK_START + 3 * 512), %i5
317
ld [promvec+148], %o0 ! pv_v2bootargs.fd_stdout
318
ld [promvec+184], %o3 ! pv_v2devops.v2_dev_write
323
or buffer, (BLOCK_START + 3 * 512), %i5