1*0Sstevel@tonic-gate/* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate/* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate .file "%M%" 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate#include "SYS.h" 32*0Sstevel@tonic-gate#include <../assym.h> 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate/* Cancellation/thr_exit() stuff */ 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate/* 37*0Sstevel@tonic-gate * _ex_unwind_local(void) 38*0Sstevel@tonic-gate * 39*0Sstevel@tonic-gate * Called only from _t_cancel(). 40*0Sstevel@tonic-gate * Unwind two frames and invoke _t_cancel(fp) again. 41*0Sstevel@tonic-gate * 42*0Sstevel@tonic-gate * Before this the call stack is: f4 f3 f2 f1 _t_cancel 43*0Sstevel@tonic-gate * After this the call stack is: f4 f3 f2 _t_cancel 44*0Sstevel@tonic-gate * (as if "call f1" is replaced by "call _t_cancel(fp)" in f2) 45*0Sstevel@tonic-gate */ 46*0Sstevel@tonic-gate ENTRY(_ex_unwind_local) 47*0Sstevel@tonic-gate restore 48*0Sstevel@tonic-gate restore 49*0Sstevel@tonic-gate ba _t_cancel ! tailcall _t_cancel(fp) 50*0Sstevel@tonic-gate mov %fp, %o0 ! passing the frame pointer 51*0Sstevel@tonic-gate SET_SIZE(_ex_unwind_local) 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate/* 54*0Sstevel@tonic-gate * _ex_clnup_handler(void *arg, void (*clnup)(void *)) 55*0Sstevel@tonic-gate * 56*0Sstevel@tonic-gate * Called only from _t_cancel(). 57*0Sstevel@tonic-gate * Unwind one frame, call the cleanup handler with argument arg from the 58*0Sstevel@tonic-gate * restored frame, then jump to _t_cancel(fp) again from the restored frame. 59*0Sstevel@tonic-gate */ 60*0Sstevel@tonic-gate ENTRY(_ex_clnup_handler) 61*0Sstevel@tonic-gate mov %o1, %i1 ! handler address -> %o1 after restore 62*0Sstevel@tonic-gate restore %o0, %g0, %o0 ! handler arg -> %o0 after restore 63*0Sstevel@tonic-gate stn %o7, [%g7 + UL_UNWIND_RET] ! save caller's return address 64*0Sstevel@tonic-gate jmpl %o1, %o7 ! invoke func with arg 65*0Sstevel@tonic-gate nop ! and return here 66*0Sstevel@tonic-gate ldn [%g7 + UL_UNWIND_RET], %o7 ! restore return address 67*0Sstevel@tonic-gate ba _t_cancel ! tailcall _t_cancel(fp) 68*0Sstevel@tonic-gate mov %fp, %o0 ! passing the frame pointer 69*0Sstevel@tonic-gate SET_SIZE(_ex_clnup_handler) 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate/* 72*0Sstevel@tonic-gate * _thrp_unwind(void *arg) 73*0Sstevel@tonic-gate * 74*0Sstevel@tonic-gate * Ignore the argument; jump to _t_cancel(fp) with caller's fp 75*0Sstevel@tonic-gate */ 76*0Sstevel@tonic-gate ENTRY(_thrp_unwind) 77*0Sstevel@tonic-gate ba _t_cancel ! tailcall _t_cancel(fp) 78*0Sstevel@tonic-gate mov %fp, %o0 ! passing the frame pointer 79*0Sstevel@tonic-gate SET_SIZE(_thrp_unwind) 80