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.
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.
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]
22 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 .file "unwind_frame.s"
30 /* Cancellation/thr_exit() stuff */
33 * _ex_unwind_local(void)
35 * Called only from _t_cancel().
36 * Unwind two frames and invoke _t_cancel(fp) again.
38 * Before this the call stack is: f4 f3 f2 f1 _t_cancel
39 * After this the call stack is: f4 f3 f2 _t_cancel
40 * (as if "call f1" is replaced by "call _t_cancel(fp)" in f2)
43 ENTRY
(_ex_unwind_local
)
44 movl
(%ebp
), %edx
/ pop first frame
[ back to
f1() ]
45 movl
(%edx
), %ebp
/ pop second frame
[ back to
f2() ]
46 movl
4(%edx
), %eax
/ save
f2's return pc
47 movl %eax, (%edx) / mov it up for one arg
48 movl %edx, %esp / stack pointer at ret addr
51 SET_SIZE(_ex_unwind_local)
54 * _ex_clnup_handler(void *arg, void (*clnup)(void *))
56 * Called only from _t_cancel().
57 * Unwind one frame, call the cleanup handler with argument arg from the
58 * restored frame, then jump to _t_cancel(fp) again from the restored frame.
61 ENTRY(_ex_clnup_handler)
62 pushl %ebp / save current frame pointer
63 pushl 8(%esp) / first argument [arg]
64 movl (%ebp), %ebp / pop out one frame
65 call *16(%esp) / call handler [clnup]
67 popl %eax / old frame pointer
68 lea 4(%eax), %esp / stk points to old frame
69 movl %ebp, 4(%esp) / _t_cancel() gets frame pointer arg
71 SET_SIZE(_ex_clnup_handler)
74 * _thrp_unwind(void *arg)
76 * Ignore the argument; jump to _t_cancel(fp) with caller's fp
81 SET_SIZE
(_thrp_unwind
)