xref: /titanic_44/usr/src/lib/libc/amd64/unwind/unwind_frame.s (revision 4a6ec905b96eb96a398c346f59e034a90ce8ad37)
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29	.file	"%M%"
30
31#ifdef _LIBCRUN_
32#define ENTRY(x) \
33        .text; \
34        .align  8; \
35        .globl  x; \
36        .type   x, @function; \
37	x:
38#define SET_SIZE(x) \
39        .size   x, .-x
40#else
41#include "SYS.h"
42#endif
43
44/*
45 * ====================
46 * _Unw_capture_regs()
47 * --------------------
48 *
49 *	Given  foo()->ex_throw()->_Unwind_RaiseException()->_Unw_capture_regs()
50 *	fills in a register array with FP and the preserved registers
51 */
52	ENTRY(_Unw_capture_regs)
53	movq	%rbx,24(%rdi)		/* save preserved registers */
54	movq	%rbp,48(%rdi)
55	movq	%r12,96(%rdi)
56	movq	%r13,104(%rdi)
57	movq	%r14,112(%rdi)
58	movq	%r15,120(%rdi)
59	ret
60	SET_SIZE(_Unw_capture_regs)
61
62/*
63 * ====================
64 * _Unw_jmp
65 * --------------------
66 *
67 * _Unw_jmp is passed a pc and an array of register values.
68 */
69
70	ENTRY(_Unw_jmp)
71	movq	%rdi,%r8		/* save arguments to this func */
72	movq	%rsi,%rax
73	movq	40(%rax),%rdi		/* set handler parameters */
74	movq	32(%rax),%rsi
75	movq	8(%rax),%rdx
76	movq	16(%rax),%rcx
77	movq	24(%rax),%rbx		/* restore preserved registers */
78	movq	96(%rax),%r12
79	movq	104(%rax),%r13
80	movq	112(%rax),%r14
81	movq	120(%rax),%r15
82	movq	48(%rax),%rbp
83	movq	56(%rax),%rsp
84	jmp	*%r8			/* branch to handler */
85	SET_SIZE(_Unw_jmp)
86