1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 .file "asm_subr.s" 28 29#include <SYS.h> 30 31 / This is where execution resumes when a thread created with 32 / thr_create() or pthread_create() returns (see setup_context()). 33 / We pass the (void *) return value to _thrp_terminate(). 34 ENTRY(_lwp_start) 35 addl $4, %esp 36 pushl %eax 37 call _thrp_terminate 38 addl $4, %esp / actually, never returns 39 SET_SIZE(_lwp_start) 40 41 / All we need to do now is (carefully) call lwp_exit(). 42 ENTRY(_lwp_terminate) 43 SYSTRAP_RVAL1(lwp_exit) 44 RET / if we return, it is very bad 45 SET_SIZE(_lwp_terminate) 46 47 ENTRY(set_curthread) 48 movl 4(%esp), %eax 49 movl %eax, %gs:0 50 ret 51 SET_SIZE(set_curthread) 52 53 ENTRY(__lwp_park) 54 popl %edx / add subcode; save return address 55 pushl $0 56 pushl %edx 57 SYSTRAP_RVAL1(lwp_park) 58 SYSLWPERR 59 popl %edx / restore return address 60 movl %edx, 0(%esp) 61 RET 62 SET_SIZE(__lwp_park) 63 64 ENTRY(__lwp_unpark) 65 popl %edx / add subcode; save return address 66 pushl $1 67 pushl %edx 68 SYSTRAP_RVAL1(lwp_park) 69 SYSLWPERR 70 popl %edx / restore return address 71 movl %edx, 0(%esp) 72 RET 73 SET_SIZE(__lwp_unpark) 74 75 ENTRY(__lwp_unpark_all) 76 popl %edx / add subcode; save return address 77 pushl $2 78 pushl %edx 79 SYSTRAP_RVAL1(lwp_park) 80 SYSLWPERR 81 popl %edx / restore return address 82 movl %edx, 0(%esp) 83 RET 84 SET_SIZE(__lwp_unpark_all) 85 86/* 87 * __sighndlr(int sig, siginfo_t *si, ucontext_t *uc, void (*hndlr)()) 88 * 89 * This is called from sigacthandler() for the entire purpose of 90 * communicating the ucontext to java's stack tracing functions. 91 */ 92 ENTRY(__sighndlr) 93 .globl __sighndlrend 94 pushl %ebp 95 movl %esp, %ebp 96 pushl 16(%ebp) 97 pushl 12(%ebp) 98 pushl 8(%ebp) 99 call *20(%ebp) 100 addl $12, %esp 101 leave 102 ret 103__sighndlrend: 104 SET_SIZE(__sighndlr) 105 106/* 107 * int _sigsetjmp(sigjmp_buf env, int savemask) 108 * 109 * This version is faster than the old non-threaded version because we 110 * don't normally have to call __getcontext() to get the signal mask. 111 * (We have a copy of it in the ulwp_t structure.) 112 */ 113 114#undef sigsetjmp 115 116 ENTRY2(sigsetjmp,_sigsetjmp) / EIP already pushed 117 pusha / EAX .. EDI 118 push %ds / segment registers 119 push %es 120 push %fs 121 push %gs 122 push %ss 123 push %cs 124 / args: cs, ss, gs, ..., eip, env, savemask 125 call __csigsetjmp 126 addl $56, %esp / pop 14 words 127 ret 128 SET_SIZE(sigsetjmp) 129 SET_SIZE(_sigsetjmp) 130