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
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.
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]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Public interface for AMD64 Unwind context
31 #ifndef _UNWIND_CONTEXT_H
32 #define _UNWIND_CONTEXT_H
34 #pragma ident "%Z%%M% %I% %E% SMI"
37 * implementation of context structure
39 * Register arrays are indexed as specified in reg_num.h
41 struct _Unwind_Context
{
42 uint64_t entry_regs
[16];
43 uint64_t current_regs
[16];
48 _Unwind_Personality_Fn pfn
;
56 same_value_rule
, /* target_reg = target_reg */
57 offset_rule
, /* target_reg = *(offset + CFA) */
58 is_offset_rule
, /* target_reg = offset + CFA */
59 register_rule
, /* target_reg = offset + source_reg */
60 constant_rule
, /* target_reg = offset */
61 indirect_rule
/* target_reg = *(offset + source_reg) */
64 struct register_state
{
66 enum register_rule rule
;
67 unsigned char source_reg
;
70 struct eh_frame_fields
{
83 _Unw_very_boring_personality(int version
, int actions
, uint64_t exclass
,
84 struct _Unwind_Exception
*exception_object
,
85 struct _Unwind_Context
*ctx
);
87 * Starting withe an initialized context (from a ucontext)
88 * the following routines are sufficient to implement a non-destructive
89 * stack walk if modified to access the target processes memory. These
90 * routines refer to the local address of an item using names containing
91 * `data' names containing `reloc' give the correction to get target
95 /* ================== find function ====================== */
98 * Computes the func and fde fields using pc as the lookup key.
99 * Return is 0 or address of fde
101 * This is the only function that look into .eh_frame_hdr
103 void *_Unw_EhfhLookup(struct _Unwind_Context
*ctx
);
105 /* =================== analyze function ================== */
108 * Fills in personality_fn and lsda fields of the context based
109 * the fde entry which must be valid and also partially unpacks
110 * fde and cie into *f
112 * This is one of two functions that look inside fde's
114 struct eh_frame_fields
*_Unw_Decode_FDE(struct eh_frame_fields
*f
,
115 struct _Unwind_Context
*ctx
);
118 * Computes register values at entry to function based on current
119 * register values, pc and fde values in a context
121 * This is the other function which looks inside fde's and
122 * the only one to look at CFA operations
124 * If 'f' is NULL (because no fde was found), a default calculation
125 * assuming an FP is done.
127 uint64_t _Unw_Rollback_Registers(struct eh_frame_fields
*f
,
128 struct _Unwind_Context
*ctx
);
130 /* ================= register propagation =============== */
133 * Fills in the current register context for the caller
134 * based on computed at-entry state of callee
137 _Unw_Propagate_Registers(struct _Unwind_Context
*old_ctx
,
138 struct _Unwind_Context
*new_ctx
);
140 /* ================================================= */
167 uint64_t _Unw_get_val(void **datap
, ptrdiff_t reloc
,
168 enum operand_desc opr
,
169 int daf
, int caf
, int enc
);
171 #endif /* _UNWIND_CONTEXT_H */