Print this page
de-linting of .s files
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86xpv/ml/hyperevent.s
+++ new/usr/src/uts/i86xpv/ml/hyperevent.s
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 -#pragma ident "%Z%%M% %I% %E% SMI"
28 -
29 27 #include <sys/asm_linkage.h>
30 28 #include <sys/hypervisor.h>
31 29 #include <sys/privregs.h>
32 30 #include <sys/segments.h>
33 31 #include <sys/traptrace.h>
34 32 #include <sys/trap.h>
35 33 #include <sys/psw.h>
36 34 #include <sys/x86_archext.h>
37 35 #include <sys/asm_misc.h>
38 36
39 -#if !defined(__lint)
40 37 #include "assym.h"
41 -#endif
42 38
43 -#if defined(__lint)
44 -
45 -void
46 -xen_failsafe_callback(void)
47 -{}
48 -
49 -void
50 -xen_callback(void)
51 -{}
52 -
53 -#else /* __lint */
54 -
55 39 /*
56 40 * The stack frame for events is exactly that of an x86 hardware
57 41 * interrupt.
58 42 *
59 43 * The stack frame for a failsafe callback is augmented with saved
60 44 * values for segment registers:
61 45 *
62 46 * i386
63 47 * %ds, %es, %fs, %gs, %eip, %cs, %eflags [, %oldesp, %oldss ]
64 48 *
65 49 * On amd64 the stack frame for events is exactly that of an hardware
66 50 * interrupt with the addition of rcx and r11.
67 51 *
68 52 * The stack frame for a failsafe callback is augmented with saved
69 53 * values for segment registers:
70 54 *
71 55 * amd64
72 56 * %rcx, %r11, %ds, %es, %fs, %gs, %rip, %cs, %rflags,
73 57 * [, %oldrsp, %oldss ]
74 58 *
75 59 * The hypervisor does this to allow the guest OS to handle returns
76 60 * to processes which have bad segment registers.
77 61 *
78 62 * [See comments in xen/arch/x86/[x86_64,x86_32]/entry.S]
79 63 *
80 64 * We will construct a fully fledged 'struct regs' and call trap
81 65 * with a #gp fault.
82 66 */
83 67
84 68 #if defined(__amd64)
85 69
86 70 ENTRY(xen_failsafe_callback)
87 71
88 72 /*
89 73 * The saved values of rcx and r11 are on the top of the stack.
90 74 * pop them and let INTR_PUSH save them. We drop ds, es, fs and
91 75 * gs since the hypervisor will have already loaded these for us.
92 76 * If any were bad and faulted the hypervisor would have loaded
93 77 * them with the null selctor.
94 78 */
95 79 XPV_TRAP_POP /* rcx, r11 */
96 80
97 81 /*
98 82 * XXPV
99 83 * If the current segregs are provided for us on the stack by
100 84 * the hypervisor then we should simply move them into their proper
101 85 * location in the regs struct?
102 86 */
103 87 addq $_CONST(_MUL(4, CLONGSIZE)), %rsp
104 88
105 89 /*
106 90 * XXPV
107 91 * It would be nice to somehow figure out which selector caused
108 92 * #gp fault.
109 93 */
110 94
111 95 pushq $0 /* dummy error */
112 96 pushq $T_GPFLT
113 97
114 98 INTR_PUSH
115 99 INTGATE_INIT_KERNEL_FLAGS
116 100
117 101 /*
118 102 * We're here because HYPERVISOR_IRET to userland failed due to a
119 103 * bad %cs value. Rewrite %cs, %ss and %rip on the stack so trap
120 104 * will know to handle this with kern_gpfault and kill the currently
121 105 * running process.
122 106 */
123 107 movq $KCS_SEL, REGOFF_CS(%rsp)
124 108 movq $KDS_SEL, REGOFF_SS(%rsp)
125 109 leaq nopop_sys_rtt_syscall(%rip), %rdi
126 110 movq %rdi, REGOFF_RIP(%rsp)
127 111
128 112 TRACE_PTR(%rdi, %rbx, %ebx, %rcx, $TT_EVENT) /* Uses labels 8 and 9 */
129 113 TRACE_REGS(%rdi, %rsp, %rbx, %rcx) /* Uses label 9 */
130 114 TRACE_STAMP(%rdi) /* Clobbers %eax, %edx, uses 9 */
131 115
132 116 movq %rsp, %rbp
133 117
134 118 TRACE_STACK(%rdi)
135 119
136 120 movq %rbp, %rdi
137 121
138 122 ENABLE_INTR_FLAGS
139 123
140 124 movq %rbp, %rdi
141 125 xorl %esi, %esi
142 126 movl %gs:CPU_ID, %edx
143 127 call trap /* trap(rp, addr, cpuid) handles all trap */
144 128 jmp _sys_rtt
145 129 SET_SIZE(xen_failsafe_callback)
146 130
147 131 #elif defined(__i386)
148 132
149 133 ENTRY(xen_failsafe_callback)
150 134
151 135 /*
152 136 * drop ds, es, fs and gs
153 137 */
154 138 addl $_CONST(_MUL(4, CLONGSIZE)), %esp /* see comment for 64-bit */
155 139
156 140 pushl $0 /* dummy error (see comment for 64-bit) */
157 141 pushl $T_GPFLT
158 142
159 143 INTR_PUSH
160 144 INTGATE_INIT_KERNEL_FLAGS /* (set kernel flag values) */
161 145
162 146 /*
163 147 * The fact were here is because HYPERVISOR_IRET to userland
164 148 * failed due to a bad %cs value. Rewrite %cs, %ss and %eip
165 149 * on the stack so trap will know to handle this with
166 150 * kern_gpfault and kill the currently running process.
167 151 */
168 152 movl $KCS_SEL, REGOFF_CS(%esp)
169 153 movl $KDS_SEL, REGOFF_SS(%esp)
170 154 leal nopop_sys_rtt_syscall, %edi
171 155 movl %edi, REGOFF_EIP(%esp)
172 156
173 157 TRACE_PTR(%edi, %ebx, %ebx, %ecx, $TT_EVENT) /* Uses labels 8 and 9 */
174 158 TRACE_REGS(%edi, %esp, %ebx, %ecx) /* Uses label 9 */
175 159 TRACE_STAMP(%edi) /* Clobbers %eax, %edx, uses 9 */
176 160
177 161 movl %esp, %ebp
178 162
179 163 TRACE_STACK(%edi)
180 164
181 165 ENABLE_INTR_FLAGS
182 166
183 167 pushl %gs:CPU_ID
184 168 pushl $0
185 169 pushl %ebp
186 170 call trap /* trap(rp, addr, cpuid) handles all traps */
187 171 addl $12, %esp
188 172 jmp _sys_rtt
189 173 SET_SIZE(xen_failsafe_callback)
190 174
191 175 #endif /* __i386 */
192 176
193 177 #if defined(__amd64)
194 178
195 179 ENTRY(xen_callback)
196 180 XPV_TRAP_POP
197 181
198 182 pushq $0 /* dummy error */
199 183 pushq $T_AST
200 184
201 185 INTR_PUSH
202 186 INTGATE_INIT_KERNEL_FLAGS /* (set kernel flag values) */
203 187
204 188 TRACE_PTR(%rdi, %rbx, %ebx, %rcx, $TT_EVENT) /* Uses labels 8 and 9 */
205 189 TRACE_REGS(%rdi, %rsp, %rbx, %rcx) /* Uses label 9 */
206 190 TRACE_STAMP(%rdi) /* Clobbers %eax, %edx, uses 9 */
207 191
208 192 movq %rsp, %rbp
209 193
210 194 TRACE_STACK(%rdi)
211 195
212 196 movq %rdi, %rsi /* rsi = trap trace recode pointer */
213 197 movq %rbp, %rdi /* rdi = struct regs pointer */
214 198 call xen_callback_handler
215 199
216 200 jmp _sys_rtt_ints_disabled
217 201 /*NOTREACHED*/
218 202
219 203 SET_SIZE(xen_callback)
220 204
221 205 #elif defined(__i386)
222 206
223 207 ENTRY(xen_callback)
224 208 pushl $0 /* dummy error */
225 209 pushl $T_AST
226 210
227 211 INTR_PUSH
228 212 INTGATE_INIT_KERNEL_FLAGS /* (set kernel flag values) */
229 213
230 214 TRACE_PTR(%edi, %ebx, %ebx, %ecx, $TT_EVENT) /* Uses labels 8 and 9 */
231 215 TRACE_REGS(%edi, %esp, %ebx, %ecx) /* Uses label 9 */
232 216 TRACE_STAMP(%edi) /* Clobbers %eax, %edx, uses 9 */
233 217
234 218 movl %esp, %ebp
235 219
236 220 TRACE_STACK(%edi)
237 221
238 222 pushl %edi /* pass trap trace record pointer */
↓ open down ↓ |
174 lines elided |
↑ open up ↑ |
239 223 pushl %ebp /* pass struct regs pointer */
240 224 call xen_callback_handler
241 225 addl $8, %esp
242 226
243 227 jmp _sys_rtt_ints_disabled
244 228 /*NOTREACHED*/
245 229
246 230 SET_SIZE(xen_callback)
247 231
248 232 #endif /* __i386 */
249 -#endif /* __lint */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX