import less(1)
[unleashed/tickless.git] / usr / src / lib / libc / amd64 / unwind / unwind_frame.s
blobb4cf3c16d7febd1fc63d856fa502395abe1ff6bf
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 .file "unwind_frame.s"
28 #ifdef _LIBCRUN_
29 #define ENTRY(x) \
30 .text; \
31 .align 8; \
32 .globl x; \
33 .type x, @function; \
34 x:
35 #define SET_SIZE(x) \
36 .size x, .-x
37 #else
38 #include "SYS.h"
39 #endif
42 * ====================
43 * _Unw_capture_regs()
44 * --------------------
46 * Given foo()->ex_throw()->_Unwind_RaiseException()->_Unw_capture_regs()
47 * fills in a register array with FP and the preserved registers
49 ENTRY(_Unw_capture_regs)
50 movq %rbx,24(%rdi) /* save preserved registers */
51 movq %rbp,48(%rdi)
52 movq %r12,96(%rdi)
53 movq %r13,104(%rdi)
54 movq %r14,112(%rdi)
55 movq %r15,120(%rdi)
56 ret
57 SET_SIZE(_Unw_capture_regs)
60 * ====================
61 * _Unw_jmp
62 * --------------------
64 * _Unw_jmp is passed a pc and an array of register values.
67 ENTRY(_Unw_jmp)
68 movq %rdi,%r8 /* save arguments to this func */
69 movq %rsi,%rax
70 movq 40(%rax),%rdi /* set handler parameters */
71 movq 32(%rax),%rsi
72 movq 8(%rax),%rdx
73 movq 16(%rax),%rcx
74 movq 24(%rax),%rbx /* restore preserved registers */
75 movq 96(%rax),%r12
76 movq 104(%rax),%r13
77 movq 112(%rax),%r14
78 movq 120(%rax),%r15
79 movq 48(%rax),%rbp
80 movq 56(%rax),%rsp
81 movq (%rax),%rax
82 jmp *%r8 /* branch to handler */
83 SET_SIZE(_Unw_jmp)