Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * Hypervisor Software File: srt0.s | |
5 | * | |
6 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
7 | * | |
8 | * - Do no alter or remove copyright notices | |
9 | * | |
10 | * - Redistribution and use of this software in source and binary forms, with | |
11 | * or without modification, are permitted provided that the following | |
12 | * conditions are met: | |
13 | * | |
14 | * - Redistribution of source code must retain the above copyright notice, | |
15 | * this list of conditions and the following disclaimer. | |
16 | * | |
17 | * - Redistribution in binary form must reproduce the above copyright notice, | |
18 | * this list of conditions and the following disclaimer in the | |
19 | * documentation and/or other materials provided with the distribution. | |
20 | * | |
21 | * Neither the name of Sun Microsystems, Inc. or the names of contributors | |
22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | |
24 | * | |
25 | * This software is provided "AS IS," without a warranty of any kind. | |
26 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
27 | * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
28 | * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
29 | * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
30 | * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
31 | * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
32 | * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
33 | * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
34 | * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
35 | * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
36 | * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
37 | * | |
38 | * You acknowledge that this software is not designed, licensed or | |
39 | * intended for use in the design, construction, operation or maintenance of | |
40 | * any nuclear facility. | |
41 | * | |
42 | * ========== Copyright Header End ============================================ | |
43 | */ | |
44 | /* | |
45 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. | |
46 | * Use is subject to license terms. | |
47 | */ | |
48 | ||
49 | .ident "@(#)srt0.s 1.7 06/04/28 SMI" | |
50 | ||
51 | .file "srt0.s" | |
52 | ||
53 | #include <sys/asm_linkage.h> | |
54 | #include <sys/privregs.h> | |
55 | #include <sys/stack.h> | |
56 | ||
57 | #include <hypervisor.h> | |
58 | ||
59 | #if defined(lint) | |
60 | ||
61 | /*ARGSUSED*/ | |
62 | void | |
63 | start(void) | |
64 | {} | |
65 | #else | |
66 | .seg ".text" | |
67 | .align 8 | |
68 | .global end | |
69 | .global edata | |
70 | .global main | |
71 | ||
72 | .seg ".bss" | |
73 | .align 8 | |
74 | ! | |
75 | ! Create a stack just below start. | |
76 | ! | |
77 | #define STACK_SIZE 0x14000 | |
78 | ||
79 | .skip STACK_SIZE | |
80 | .ebootstack: ! end --top-- of boot stack | |
81 | ||
82 | .seg ".text" | |
83 | ||
84 | ENTRY(start) | |
85 | ||
86 | save %sp, -SA(MINFRAME), %sp | |
87 | ||
88 | mov %g1, %i0 ! Save RA BASE in %i0 | |
89 | ||
90 | ! | |
91 | ! Zero the bss [edata to end] | |
92 | ! | |
93 | setn edata, %g1, %o0 | |
94 | setn end, %g1, %i2 | |
95 | mov %g0, %o1 | |
96 | ! call memset | |
97 | sub %i2, %o0, %o2 ! size | |
98 | ||
99 | restore %g0, %g0, %g0 ! Trivial restore | |
100 | ||
101 | ! | |
102 | ! Switch to our new stack. | |
103 | ! | |
104 | setn (.ebootstack - STACK_BIAS), %g1, %o1 | |
105 | mov %g0, %i6 | |
106 | mov %g0, %i7 | |
107 | mov %g0, %o6 | |
108 | mov %g0, %o7 | |
109 | add %o1, -SA(MINFRAME), %sp | |
110 | ||
111 | ! | |
112 | ! Set supervisor mode, interrupt level >= 13, traps enabled | |
113 | ! We don't set PSTATE_AM even though all our addresses are under 4G. | |
114 | ! | |
115 | wrpr %g0, 0xf, %pil | |
116 | wrpr %g0, PSTATE_PEF+PSTATE_PRIV+PSTATE_IE, %pstate | |
117 | ||
118 | mov %g0, %o1 | |
119 | call main ! main(rabase) | |
120 | mov %g0, %o2 | |
121 | ||
122 | mov %g0, %o0 | |
123 | mov MACH_EXIT, %o5 | |
124 | ta FAST_TRAP | |
125 | ! print stupid error message here! | |
126 | ta %xcc, 0x72 | |
127 | ba . | |
128 | nop | |
129 | SET_SIZE(start) | |
130 | #endif /* lint */ |