Annotation of sys/arch/landisk/stand/boot/srt0.S, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: srt0.S,v 1.3 2006/10/29 14:47:59 drahn Exp $ */
2: /* $NetBSD: boot.S,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
3:
4: /*-
5: * Copyright (c) 2005 NONAKA Kimihiro
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27: * SUCH DAMAGE.
28: */
29:
30: #include <machine/asm.h>
31:
32: ENTRY(start)
33: bra boot_start1
34: nop
35: .balign 4
36: ENTRY(boot_magic)
37: .long 0x20041110
38: ENTRY(boot_params)
39: .long boot_start1 - boot_params
40:
41: . = start + 0x80
42: boot_start1:
43: mov r4, r0
44: add #-4, r0
45: mov.l @(0, r0), r0
46: mov.l .L.boot_magic1, r1
47: cmp/eq r0, r1
48: bf 2f
49: mov r4, r0
50: mov.l .L.boot_params_size, r3
51: mov.l @r0, r2
52: mov.l .L.boot_params, r1
53: cmp/hi r3, r2
54: bf 1f
55: mov r3, r2
56: 1: mov.b @r0+, r3
57: mov.b r3, @r1
58: dt r2
59: bf/s 1b
60: add #1, r1
61: 2:
62: mov.l .L._end, r0 /* zero bss */
63: mov.l .L.__bss_start, r1
64: sub r1, r0
65: shlr2 r0 /* _end and __bss_start are aligned */
66: mov #0, r2
67: 1: mov.l r2, @r1
68: dt r0
69: bf/s 1b
70: add #4, r1
71:
72: mov.l .L.boot, r0
73: jsr @r0
74: mov r5, r4
75:
76: boot_fail:
77: mov r0, r1
78: mova .L.errtxt, r0
79: mov r0, r4
80: mov #32, r0
81: trapa #0x3f
82: mov r1, r4
83: mov #32, r0
84: trapa #0x3f
85: mova .L.crlf, r0
86: mov r0, r4
87: mov #32, r0
88: trapa #0x3f
89: 99: bra 99b
90: nop
91:
92:
93: ENTRY(halt)
94: mova .L.pwrctl, r0
95: mov #1, r1
96: mov.b @r1, r0
97: rts
98: nop
99:
100: ENTRY(reboot)
101: ENTRY(_rtt)
102: mov #1, r4 /* reboot */
103: mov #11, r0
104: trapa #0x3f
105: mov.l .L.start, r0
106: jmp @r0
107: nop
108:
109: /*
110: * int raise(int sig);
111: */
112: ENTRY(raise)
113: rts
114: nop
115:
116: /*
117: *
118: */
119: ENTRY(cnset)
120: rts
121: nop
122:
123: /*
124: * int readsects(int dev, uint32_t lba, void *buf, size_t size);
125: */
126: ENTRY(readsects)
127: mov #2, r0
128: trapa #0x3f
129: rts
130: nop
131:
132: /*
133: * void cache_flush(void);
134: */
135: ENTRY(cache_flush)
136: /* flush cache */
137: mov #0, r4
138: mov #6, r0
139: trapa #0x3f
140: rts
141: nop
142:
143: /*
144: * void cache_disable(void);
145: */
146: ENTRY(cache_disable)
147: mov #1, r4
148: mov #6, r0
149: trapa #0x3f
150: rts
151: nop
152:
153: .align 2
154: .L.boot_magic1:
155: .long 0x20031125
156: .L.boot_params:
157: .long boot_params
158: .L.boot_params_size:
159: .long boot_start1 - boot_params
160: .L._end:
161: .long _end
162: .L.__bss_start:
163: .long __bss_start
164: .L.boot:
165: .long _C_LABEL(boot)
166: .L.start:
167: .long 0xc0000000
168: .L.pwrctl:
169: .long 0xb0000003
170:
171: .align 2
172: .L.errtxt: .asciz ">>BOOT FAILED: "
173: .align 2
174: .L.crlf: .asciz "\r\n"
CVSweb