Print this page
de-linting of .s files
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/sparc/v9/ml/syscall_trap.s
+++ new/usr/src/uts/sparc/v9/ml/syscall_trap.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
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /*
27 27 * System call trap handler.
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
28 28 */
29 29 #include <sys/asm_linkage.h>
30 30 #include <sys/machpcb.h>
31 31 #include <sys/machthread.h>
32 32 #include <sys/syscall.h>
33 33 #include <sys/trap.h>
34 34 #include <sys/machtrap.h>
35 35 #include <sys/pcb.h>
36 36 #include <sys/machparam.h>
37 37
38 -#if !defined(lint) && !defined(__lint)
39 38 #include "assym.h"
40 -#endif
41 39
42 40 #ifdef TRAPTRACE
43 41 #include <sys/traptrace.h>
44 42 #endif /* TRAPTRACE */
45 43
46 -#if defined(lint) || defined(__lint)
47 -
48 -/*ARGSUSED*/
49 -void
50 -syscall_trap(struct regs *rp) /* for tags only; not called from C */
51 -{}
52 -
53 -#else /* lint */
54 -
55 44 #if (1 << SYSENT_SHIFT) != SYSENT_SIZE
56 45 #error "SYSENT_SHIFT does not correspond to size of sysent structure"
57 46 #endif
58 47
59 48 /*
60 49 * Native System call trap handler.
61 50 *
62 51 * We branch here from sys_trap when a 64-bit system call occurs.
63 52 *
64 53 * Entry:
65 54 * %o0 = regs
66 55 *
67 56 * Usage:
68 57 * %l0 = saved return address
69 58 * %l1 = saved regs
70 59 * %l2 = lwp
71 60 */
72 61 ENTRY_NP(syscall_trap)
73 62 ldn [THREAD_REG + T_CPU], %g1 ! get cpu pointer
74 63 mov %o7, %l0 ! save return addr
75 64 !
76 65 ! If the trapping thread has the address mask bit set, then it's
77 66 ! a 32-bit process, and has no business calling 64-bit syscalls.
78 67 !
79 68 ldx [%o0 + TSTATE_OFF], %l1 ! saved %tstate.am is that
80 69 andcc %l1, TSTATE_AM, %l1 ! of the trapping proc
81 70 bne,pn %xcc, _syscall_ill !
82 71 mov %o0, %l1 ! save reg pointer
83 72 mov %i0, %o0 ! copy 1st arg
84 73 mov %i1, %o1 ! copy 2nd arg
85 74 ldx [%g1 + CPU_STATS_SYS_SYSCALL], %g2
86 75 inc %g2 ! cpu_stats.sys.syscall++
87 76 stx %g2, [%g1 + CPU_STATS_SYS_SYSCALL]
88 77
89 78 !
90 79 ! Set new state for LWP
91 80 !
92 81 ldn [THREAD_REG + T_LWP], %l2
93 82 mov LWP_SYS, %g3
94 83 mov %i2, %o2 ! copy 3rd arg
95 84 stb %g3, [%l2 + LWP_STATE]
96 85 mov %i3, %o3 ! copy 4th arg
97 86 ldx [%l2 + LWP_RU_SYSC], %g2 ! pesky statistics
98 87 mov %i4, %o4 ! copy 5th arg
99 88 addx %g2, 1, %g2
100 89 stx %g2, [%l2 + LWP_RU_SYSC]
101 90 mov %i5, %o5 ! copy 6th arg
102 91 ! args for direct syscalls now set up
103 92
104 93 #ifdef TRAPTRACE
105 94 !
106 95 ! make trap trace entry - helps in debugging
107 96 !
108 97 rdpr %pstate, %l3
109 98 andn %l3, PSTATE_IE | PSTATE_AM, %g3
110 99 wrpr %g0, %g3, %pstate ! disable interrupt
111 100 TRACE_PTR(%g3, %g2) ! get trace pointer
112 101 GET_TRACE_TICK(%g1, %g2)
113 102 stxa %g1, [%g3 + TRAP_ENT_TICK]%asi
114 103 ldx [%l1 + G1_OFF], %g1 ! get syscall code
115 104 TRACE_SAVE_TL_VAL(%g3, %g1)
116 105 TRACE_SAVE_GL_VAL(%g3, %g0)
117 106 set TT_SC_ENTR, %g2
118 107 stha %g2, [%g3 + TRAP_ENT_TT]%asi
119 108 stxa %g7, [%g3 + TRAP_ENT_TSTATE]%asi ! save thread in tstate space
120 109 stna %sp, [%g3 + TRAP_ENT_SP]%asi
121 110 stna %o0, [%g3 + TRAP_ENT_F1]%asi
122 111 stna %o1, [%g3 + TRAP_ENT_F2]%asi
123 112 stna %o2, [%g3 + TRAP_ENT_F3]%asi
124 113 stna %o3, [%g3 + TRAP_ENT_F4]%asi
125 114 stna %o4, [%g3 + TRAP_ENT_TPC]%asi
126 115 stna %o5, [%g3 + TRAP_ENT_TR]%asi
127 116 TRACE_NEXT(%g3, %g2, %g1) ! set new trace pointer
128 117 wrpr %g0, %l3, %pstate ! enable interrupt
129 118 #endif /* TRAPTRACE */
130 119
131 120 !
132 121 ! Test for pre-system-call handling
133 122 !
134 123 ldub [THREAD_REG + T_PRE_SYS], %g3 ! pre-syscall proc?
135 124 #ifdef SYSCALLTRACE
136 125 sethi %hi(syscalltrace), %g4
137 126 ld [%g4 + %lo(syscalltrace)], %g4
138 127 orcc %g3, %g4, %g0 ! pre_syscall OR syscalltrace?
139 128 #else
140 129 tst %g3 ! is pre_syscall flag set?
141 130 #endif /* SYSCALLTRACE */
142 131
143 132 bnz,pn %icc, _syscall_pre
144 133 nop
145 134
146 135 ! Fast path invocation of new_mstate
147 136
148 137 mov LMS_USER, %o0
149 138 call syscall_mstate
150 139 mov LMS_SYSTEM, %o1
151 140
152 141 ldx [%l1 + O0_OFF], %o0 ! restore %o0
153 142 ldx [%l1 + O1_OFF], %o1 ! restore %o1
154 143 ldx [%l1 + O2_OFF], %o2
155 144 ldx [%l1 + O3_OFF], %o3
156 145 ldx [%l1 + O4_OFF], %o4
157 146 ldx [%l1 + O5_OFF], %o5
158 147
159 148 ! lwp_arg now set up
160 149 3:
161 150 !
162 151 ! Call the handler. The %o's and lwp_arg have been set up.
163 152 !
164 153 ldx [%l1 + G1_OFF], %g1 ! get code
165 154 set sysent, %g3 ! load address of vector table
166 155 cmp %g1, NSYSCALL ! check range
167 156 sth %g1, [THREAD_REG + T_SYSNUM] ! save syscall code
168 157 bgeu,pn %ncc, _syscall_ill
169 158 sll %g1, SYSENT_SHIFT, %g4 ! delay - get index
170 159 add %g3, %g4, %l4
171 160 ldn [%l4 + SY_CALLC], %g3 ! load system call handler
172 161
173 162 call %g3 ! call system call handler
174 163 nop
175 164 !
176 165 ! If handler returns two ints, then we need to split the 64-bit
177 166 ! return value in %o0 into %o0 and %o1
178 167 !
179 168 lduh [%l4 + SY_FLAGS], %l4 ! load sy_flags
180 169 andcc %l4, SE_32RVAL2, %g0 ! check for 2 x 32-bit
181 170 bz,pt %xcc, 5f
182 171 nop
183 172 srl %o0, 0, %o1 ! lower 32-bits into %o1
184 173 srlx %o0, 32, %o0 ! upper 32-bits into %o0
185 174 5:
186 175
187 176 #ifdef TRAPTRACE
188 177 !
189 178 ! make trap trace entry for return - helps in debugging
190 179 !
191 180 rdpr %pstate, %g5
192 181 andn %g5, PSTATE_IE | PSTATE_AM, %g4
193 182 wrpr %g0, %g4, %pstate ! disable interrupt
194 183 TRACE_PTR(%g4, %g2) ! get trace pointer
195 184 GET_TRACE_TICK(%g2, %g3)
196 185 stxa %g2, [%g4 + TRAP_ENT_TICK]%asi
197 186 lduh [THREAD_REG + T_SYSNUM], %g2
198 187 TRACE_SAVE_TL_VAL(%g4, %g2)
199 188 TRACE_SAVE_GL_VAL(%g4, %g0)
200 189 mov TT_SC_RET, %g2 ! system call return code
201 190 stha %g2, [%g4 + TRAP_ENT_TT]%asi
202 191 ldn [%l1 + nPC_OFF], %g2 ! get saved npc (new pc)
203 192 stna %g2, [%g4 + TRAP_ENT_TPC]%asi
204 193 ldx [%l1 + TSTATE_OFF], %g2 ! get saved tstate
205 194 stxa %g2, [%g4 + TRAP_ENT_TSTATE]%asi
206 195 stna %sp, [%g4 + TRAP_ENT_SP]%asi
207 196 stna THREAD_REG, [%g4 + TRAP_ENT_TR]%asi
208 197 stna %o0, [%g4 + TRAP_ENT_F1]%asi
209 198 stna %o1, [%g4 + TRAP_ENT_F2]%asi
210 199 stna %g0, [%g4 + TRAP_ENT_F3]%asi
211 200 stna %g0, [%g4 + TRAP_ENT_F4]%asi
212 201 TRACE_NEXT(%g4, %g2, %g3) ! set new trace pointer
213 202 wrpr %g0, %g5, %pstate ! enable interrupt
214 203 #endif /* TRAPTRACE */
215 204 !
216 205 ! Check for post-syscall processing.
217 206 ! This tests all members of the union containing t_astflag, t_post_sys,
218 207 ! and t_sig_check with one test.
219 208 !
220 209 ld [THREAD_REG + T_POST_SYS_AST], %g1
221 210 #ifdef SYSCALLTRACE
222 211 sethi %hi(syscalltrace), %g4
223 212 ld [%g4 + %lo(syscalltrace)], %g4
224 213 orcc %g4, %g1, %g0 ! OR in syscalltrace
225 214 #else
226 215 tst %g1 ! need post-processing?
227 216 #endif /* SYSCALLTRACE */
228 217 bnz,pn %icc, _syscall_post ! yes - post_syscall or AST set
229 218 mov LWP_USER, %g1
230 219 stb %g1, [%l2 + LWP_STATE] ! set lwp_state
231 220 stx %o0, [%l1 + O0_OFF] ! set rp->r_o0
232 221 stx %o1, [%l1 + O1_OFF] ! set rp->r_o1
233 222 clrh [THREAD_REG + T_SYSNUM] ! clear syscall code
234 223 ldx [%l1 + TSTATE_OFF], %g1 ! get saved tstate
235 224 ldn [%l1 + nPC_OFF], %g2 ! get saved npc (new pc)
236 225 mov CCR_IC, %g3
237 226 sllx %g3, TSTATE_CCR_SHIFT, %g3
238 227 add %g2, 4, %g4 ! calc new npc
239 228 andn %g1, %g3, %g1 ! clear carry bit for no error
240 229 stn %g2, [%l1 + PC_OFF]
241 230 stn %g4, [%l1 + nPC_OFF]
242 231 stx %g1, [%l1 + TSTATE_OFF]
243 232
244 233 ! Switch mstate back on the way out
245 234
246 235 mov LMS_SYSTEM, %o0
247 236 call syscall_mstate
248 237 mov LMS_USER, %o1
249 238 jmp %l0 + 8
250 239 nop
251 240
252 241 _syscall_pre:
253 242 ldx [%l1 + G1_OFF], %g1
254 243 call pre_syscall ! abort = pre_syscall(arg0)
255 244 sth %g1, [THREAD_REG + T_SYSNUM]
256 245
257 246 brnz,pn %o0, _syscall_post ! did it abort?
258 247 nop
259 248 ldx [%l1 + O0_OFF], %o0 ! reload args
260 249 ldx [%l1 + O1_OFF], %o1
261 250 ldx [%l1 + O2_OFF], %o2
262 251 ldx [%l1 + O3_OFF], %o3
263 252 ldx [%l1 + O4_OFF], %o4
264 253 ba,pt %xcc, 3b
265 254 ldx [%l1 + O5_OFF], %o5
266 255
267 256 !
268 257 ! Floating-point trap was pending at start of system call.
269 258 ! Here with:
270 259 ! %l3 = mpcb_flags
271 260 !
272 261 _syscall_fp:
273 262 andn %l3, FP_TRAPPED, %l3
274 263 st %l3, [%sp + STACK_BIAS + MPCB_FLAGS] ! clear FP_TRAPPED
275 264 jmp %l0 + 8 ! return to user_rtt
276 265 clrh [THREAD_REG + T_SYSNUM] ! clear syscall code
277 266
278 267 !
279 268 ! illegal system call - syscall number out of range
280 269 !
281 270 _syscall_ill:
282 271 call nosys
↓ open down ↓ |
218 lines elided |
↑ open up ↑ |
283 272 nop
284 273 !
285 274 ! Post-syscall with special processing needed.
286 275 !
287 276 _syscall_post:
288 277 call post_syscall ! post_syscall(rvals)
289 278 nop
290 279 jmp %l0 + 8 ! return to user_rtt
291 280 nop
292 281 SET_SIZE(syscall_trap)
293 -#endif /* lint */
294 282
295 -#if defined(lint) || defined(__lint)
296 -
297 -void
298 -syscall_trap32(void) /* for tags only - trap handler - not called from C */
299 -{}
300 -
301 -#else /* lint */
302 -
303 283 /*
304 284 * System call trap handler for ILP32 processes.
305 285 *
306 286 * We branch here from sys_trap when a system call occurs.
307 287 *
308 288 * Entry:
309 289 * %o0 = regs
310 290 *
311 291 * Usage:
312 292 * %l0 = saved return address
313 293 * %l1 = saved regs
314 294 * %l2 = lwp
315 295 */
316 296 ENTRY_NP(syscall_trap32)
317 297 ldx [THREAD_REG + T_CPU], %g1 ! get cpu pointer
318 298 mov %o7, %l0 ! save return addr
319 299
320 300 !
321 301 ! If the trapping thread has the address mask bit clear, then it's
322 302 ! a 64-bit process, and has no business calling 32-bit syscalls.
323 303 !
324 304 ldx [%o0 + TSTATE_OFF], %l1 ! saved %tstate.am is that
325 305 andcc %l1, TSTATE_AM, %l1 ! of the trapping proc
326 306 be,pn %xcc, _syscall_ill32 !
327 307 mov %o0, %l1 ! save reg pointer
328 308 srl %i0, 0, %o0 ! copy 1st arg, clear high bits
329 309 srl %i1, 0, %o1 ! copy 2nd arg, clear high bits
330 310 ldx [%g1 + CPU_STATS_SYS_SYSCALL], %g2
331 311 inc %g2 ! cpu_stats.sys.syscall++
332 312 stx %g2, [%g1 + CPU_STATS_SYS_SYSCALL]
333 313
334 314 !
335 315 ! Set new state for LWP
336 316 !
337 317 ldx [THREAD_REG + T_LWP], %l2
338 318 mov LWP_SYS, %g3
339 319 srl %i2, 0, %o2 ! copy 3rd arg, clear high bits
340 320 stb %g3, [%l2 + LWP_STATE]
341 321 srl %i3, 0, %o3 ! copy 4th arg, clear high bits
342 322 ldx [%l2 + LWP_RU_SYSC], %g2 ! pesky statistics
343 323 srl %i4, 0, %o4 ! copy 5th arg, clear high bits
344 324 addx %g2, 1, %g2
345 325 stx %g2, [%l2 + LWP_RU_SYSC]
346 326 srl %i5, 0, %o5 ! copy 6th arg, clear high bits
347 327 ! args for direct syscalls now set up
348 328
349 329 #ifdef TRAPTRACE
350 330 !
351 331 ! make trap trace entry - helps in debugging
352 332 !
353 333 rdpr %pstate, %l3
354 334 andn %l3, PSTATE_IE | PSTATE_AM, %g3
355 335 wrpr %g0, %g3, %pstate ! disable interrupt
356 336 TRACE_PTR(%g3, %g2) ! get trace pointer
357 337 GET_TRACE_TICK(%g1, %g2)
358 338 stxa %g1, [%g3 + TRAP_ENT_TICK]%asi
359 339 ldx [%l1 + G1_OFF], %g1 ! get syscall code
360 340 TRACE_SAVE_TL_VAL(%g3, %g1)
361 341 TRACE_SAVE_GL_VAL(%g3, %g0)
362 342 set TT_SC_ENTR, %g2
363 343 stha %g2, [%g3 + TRAP_ENT_TT]%asi
364 344 stxa %g7, [%g3 + TRAP_ENT_TSTATE]%asi ! save thread in tstate space
365 345 stna %sp, [%g3 + TRAP_ENT_SP]%asi
366 346 stna %o0, [%g3 + TRAP_ENT_F1]%asi
367 347 stna %o1, [%g3 + TRAP_ENT_F2]%asi
368 348 stna %o2, [%g3 + TRAP_ENT_F3]%asi
369 349 stna %o3, [%g3 + TRAP_ENT_F4]%asi
370 350 stna %o4, [%g3 + TRAP_ENT_TPC]%asi
371 351 stna %o5, [%g3 + TRAP_ENT_TR]%asi
372 352 TRACE_NEXT(%g3, %g2, %g1) ! set new trace pointer
373 353 wrpr %g0, %l3, %pstate ! enable interrupt
374 354 #endif /* TRAPTRACE */
375 355
376 356 !
377 357 ! Test for pre-system-call handling
378 358 !
379 359 ldub [THREAD_REG + T_PRE_SYS], %g3 ! pre-syscall proc?
380 360 #ifdef SYSCALLTRACE
381 361 sethi %hi(syscalltrace), %g4
382 362 ld [%g4 + %lo(syscalltrace)], %g4
383 363 orcc %g3, %g4, %g0 ! pre_syscall OR syscalltrace?
384 364 #else
385 365 tst %g3 ! is pre_syscall flag set?
386 366 #endif /* SYSCALLTRACE */
387 367 bnz,pn %icc, _syscall_pre32 ! yes - pre_syscall needed
388 368 nop
389 369
390 370 ! Fast path invocation of new_mstate
391 371 mov LMS_USER, %o0
392 372 call syscall_mstate
393 373 mov LMS_SYSTEM, %o1
394 374
395 375 lduw [%l1 + O0_OFF + 4], %o0 ! reload 32-bit args
396 376 lduw [%l1 + O1_OFF + 4], %o1
397 377 lduw [%l1 + O2_OFF + 4], %o2
398 378 lduw [%l1 + O3_OFF + 4], %o3
399 379 lduw [%l1 + O4_OFF + 4], %o4
400 380 lduw [%l1 + O5_OFF + 4], %o5
401 381
402 382 ! lwp_arg now set up
403 383 3:
404 384 !
405 385 ! Call the handler. The %o's have been set up.
406 386 !
407 387 lduw [%l1 + G1_OFF + 4], %g1 ! get 32-bit code
408 388 set sysent32, %g3 ! load address of vector table
409 389 cmp %g1, NSYSCALL ! check range
410 390 sth %g1, [THREAD_REG + T_SYSNUM] ! save syscall code
411 391 bgeu,pn %ncc, _syscall_ill32
412 392 sll %g1, SYSENT_SHIFT, %g4 ! delay - get index
413 393 add %g3, %g4, %g5 ! g5 = addr of sysentry
414 394 ldx [%g5 + SY_CALLC], %g3 ! load system call handler
415 395
416 396 brnz,a,pt %g1, 4f ! check for indir()
417 397 mov %g5, %l4 ! save addr of sysentry
418 398 !
419 399 ! Yuck. If %g1 is zero, that means we're doing a syscall() via the
420 400 ! indirect system call. That means we have to check the
421 401 ! flags of the targetted system call, not the indirect system call
422 402 ! itself. See return value handling code below.
423 403 !
424 404 set sysent32, %l4 ! load address of vector table
425 405 cmp %o0, NSYSCALL ! check range
426 406 bgeu,pn %ncc, 4f ! out of range, let C handle it
427 407 sll %o0, SYSENT_SHIFT, %g4 ! delay - get index
428 408 add %g4, %l4, %l4 ! compute & save addr of sysent
429 409 4:
430 410 call %g3 ! call system call handler
431 411 nop
432 412
433 413 !
434 414 ! If handler returns long long then we need to split the 64 bit
435 415 ! return value in %o0 into %o0 and %o1 for ILP32 clients.
436 416 !
437 417 lduh [%l4 + SY_FLAGS], %g4 ! load sy_flags
438 418 andcc %g4, SE_64RVAL | SE_32RVAL2, %g0 ! check for 64-bit return
439 419 bz,a,pt %xcc, 5f
440 420 srl %o0, 0, %o0 ! 32-bit only
441 421 srl %o0, 0, %o1 ! lower 32 bits into %o1
442 422 srlx %o0, 32, %o0 ! upper 32 bits into %o0
443 423 5:
444 424
445 425 #ifdef TRAPTRACE
446 426 !
447 427 ! make trap trace entry for return - helps in debugging
448 428 !
449 429 rdpr %pstate, %g5
450 430 andn %g5, PSTATE_IE | PSTATE_AM, %g4
451 431 wrpr %g0, %g4, %pstate ! disable interrupt
452 432 TRACE_PTR(%g4, %g2) ! get trace pointer
453 433 GET_TRACE_TICK(%g2, %g3)
454 434 stxa %g2, [%g4 + TRAP_ENT_TICK]%asi
455 435 lduh [THREAD_REG + T_SYSNUM], %g2
456 436 TRACE_SAVE_TL_VAL(%g4, %g2)
457 437 TRACE_SAVE_GL_VAL(%g4, %g0)
458 438 mov TT_SC_RET, %g2 ! system call return code
459 439 stha %g2, [%g4 + TRAP_ENT_TT]%asi
460 440 ldx [%l1 + nPC_OFF], %g2 ! get saved npc (new pc)
461 441 stna %g2, [%g4 + TRAP_ENT_TPC]%asi
462 442 ldx [%l1 + TSTATE_OFF], %g2 ! get saved tstate
463 443 stxa %g2, [%g4 + TRAP_ENT_TSTATE]%asi
464 444 stna %sp, [%g4 + TRAP_ENT_SP]%asi
465 445 stna THREAD_REG, [%g4 + TRAP_ENT_TR]%asi
466 446 stna %o0, [%g4 + TRAP_ENT_F1]%asi
467 447 stna %o1, [%g4 + TRAP_ENT_F2]%asi
468 448 stna %g0, [%g4 + TRAP_ENT_F3]%asi
469 449 stna %g0, [%g4 + TRAP_ENT_F4]%asi
470 450 TRACE_NEXT(%g4, %g2, %g3) ! set new trace pointer
471 451 wrpr %g0, %g5, %pstate ! enable interrupt
472 452 #endif /* TRAPTRACE */
473 453 !
474 454 ! Check for post-syscall processing.
475 455 ! This tests all members of the union containing t_astflag, t_post_sys,
476 456 ! and t_sig_check with one test.
477 457 !
478 458 ld [THREAD_REG + T_POST_SYS_AST], %g1
479 459 #ifdef SYSCALLTRACE
480 460 sethi %hi(syscalltrace), %g4
481 461 ld [%g4 + %lo(syscalltrace)], %g4
482 462 orcc %g4, %g1, %g0 ! OR in syscalltrace
483 463 #else
484 464 tst %g1 ! need post-processing?
485 465 #endif /* SYSCALLTRACE */
486 466 bnz,pn %icc, _syscall_post32 ! yes - post_syscall or AST set
487 467 mov LWP_USER, %g1
488 468 stb %g1, [%l2 + LWP_STATE] ! set lwp_state
489 469 stx %o0, [%l1 + O0_OFF] ! set rp->r_o0
490 470 stx %o1, [%l1 + O1_OFF] ! set rp->r_o1
491 471 clrh [THREAD_REG + T_SYSNUM] ! clear syscall code
492 472 ldx [%l1 + TSTATE_OFF], %g1 ! get saved tstate
493 473 ldx [%l1 + nPC_OFF], %g2 ! get saved npc (new pc)
494 474 mov CCR_IC, %g3
495 475 sllx %g3, TSTATE_CCR_SHIFT, %g3
496 476 add %g2, 4, %g4 ! calc new npc
497 477 andn %g1, %g3, %g1 ! clear carry bit for no error
498 478 stx %g2, [%l1 + PC_OFF]
499 479 stx %g4, [%l1 + nPC_OFF]
500 480 stx %g1, [%l1 + TSTATE_OFF]
501 481
502 482 ! fast path outbound microstate accounting call
503 483 mov LMS_SYSTEM, %o0
504 484 call syscall_mstate
505 485 mov LMS_USER, %o1
506 486
507 487 jmp %l0 + 8
508 488 nop
509 489
510 490
511 491 _syscall_pre32:
512 492 ldx [%l1 + G1_OFF], %g1
513 493 call pre_syscall ! abort = pre_syscall(arg0)
514 494 sth %g1, [THREAD_REG + T_SYSNUM]
515 495
516 496 brnz,pn %o0, _syscall_post32 ! did it abort?
517 497 nop
518 498 lduw [%l1 + O0_OFF + 4], %o0 ! reload 32-bit args
519 499 lduw [%l1 + O1_OFF + 4], %o1
520 500 lduw [%l1 + O2_OFF + 4], %o2
521 501 lduw [%l1 + O3_OFF + 4], %o3
522 502 lduw [%l1 + O4_OFF + 4], %o4
523 503 ba,pt %xcc, 3b
524 504 lduw [%l1 + O5_OFF + 4], %o5
525 505
526 506 !
527 507 ! Floating-point trap was pending at start of system call.
528 508 ! Here with:
529 509 ! %l3 = mpcb_flags
530 510 !
531 511 _syscall_fp32:
532 512 andn %l3, FP_TRAPPED, %l3
533 513 st %l3, [%sp + STACK_BIAS + MPCB_FLAGS] ! clear FP_TRAPPED
534 514 jmp %l0 + 8 ! return to user_rtt
535 515 clrh [THREAD_REG + T_SYSNUM] ! clear syscall code
536 516
537 517 !
538 518 ! illegal system call - syscall number out of range
539 519 !
540 520 _syscall_ill32:
541 521 call nosys
542 522 nop
↓ open down ↓ |
230 lines elided |
↑ open up ↑ |
543 523 !
544 524 ! Post-syscall with special processing needed.
545 525 !
546 526 _syscall_post32:
547 527 call post_syscall ! post_syscall(rvals)
548 528 nop
549 529 jmp %l0 + 8 ! return to user_rtt
550 530 nop
551 531 SET_SIZE(syscall_trap32)
552 532
553 -#endif /* lint */
554 533
555 -
556 534 /*
557 535 * lwp_rtt - start execution in newly created LWP.
558 536 * Here with t_post_sys set by lwp_create, and lwp_eosys == JUSTRETURN,
559 537 * so that post_syscall() will run and the registers will
560 538 * simply be restored.
561 539 * This must go out through sys_rtt instead of syscall_rtt.
562 540 */
563 -#if defined(lint) || defined(__lint)
564 -
565 -void
566 -lwp_rtt_initial(void)
567 -{}
568 -
569 -void
570 -lwp_rtt(void)
571 -{}
572 -
573 -#else /* lint */
574 541 ENTRY_NP(lwp_rtt_initial)
575 542 ldn [THREAD_REG + T_STACK], %l7
576 543 call __dtrace_probe___proc_start
577 544 sub %l7, STACK_BIAS, %sp
578 545 ba,a,pt %xcc, 0f
579 546
580 547 ENTRY_NP(lwp_rtt)
581 548 ldn [THREAD_REG + T_STACK], %l7
582 549 sub %l7, STACK_BIAS, %sp
583 550 0:
584 551 call __dtrace_probe___proc_lwp__start
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
585 552 nop
586 553 call dtrace_systrace_rtt
587 554 add %sp, REGOFF + STACK_BIAS, %l7
588 555 ldx [%l7 + O0_OFF], %o0
589 556 call post_syscall
590 557 ldx [%l7 + O1_OFF], %o1
591 558 ba,a,pt %xcc, user_rtt
592 559 SET_SIZE(lwp_rtt)
593 560 SET_SIZE(lwp_rtt_initial)
594 561
595 -#endif /* lint */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX