1
/* Linux SPARC/UltraSPARC Loader Bootstrap
3
Copyright (C) 1996,1997,1998,2000 Jakub Jelinek
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
24
#define COPY jmpl %o7 + (copy - _start), %l7
27
#define STACK_BASE 0x400000
29
#define STACK_BASE 0x500000
41
.skip 64 /* struct ImageInfo image_table[4] */
44
/* Move ourselves up */ ! %l0 = original start
45
set __bss_start + 16, %i1 ! %i1 = original end
46
set _start, %l1 ! %i0 = %l1 = relocated start
47
mov %l1, %i0 ! %l2 = code length
51
/* Jump to relocated code */
53
jmpl %i0 + (jumphere - _start), %g0
54
or %l0, %lo(_end), %l0 ! %l0 = _end
62
sub %l0, %i1, %i2 ! %i2 = BSS length
77
tst %o4 ! if not Ultra,
78
be 1f ! skip %pstate modification
91
! Call my_main() to start the whole thingie up
94
mov %i6, %o2 ! Cif sp on sun4u
95
mov %i4, %o1 ! Cif handler on sun4u
97
mov %i0, %o0 ! Prom vector or cifh on sun4m
100
jmpl %o0 + %g0, %g0 ! Jump to return address from my_main()
103
/* l0 from, l1 to, l2 len, l7 ret. Returns from + len in l0 */
122
tst %i4 /* quit unless it's Sun4u */
126
srlx %l0, (32 + 16), %l1
130
srlx %l0, (32 + 16), %l1
132
bgeu,pt %xcc, 0f /* quit if Ultra-III or derivative */
137
sethi %hi(0x40003), %l1
138
or %l1, %lo(0x40003), %l1
140
be 0f /* quit if HAL SPARC64-III */
142
sethi %hi(0x40004), %l1
143
or %l1, %lo(0x40004), %l1
145
be 0f /* quit if HAL SPARC64-IV */
148
sethi %hi(16384), %l1
149
stxa %g0, [%l0] 0x67 /* ASI_IC_TAG */
154
stxa %g0, [%l0] 0x67 /* ASI_IC_TAG */