blob: bdad10b82d1529e777e89cfba31f8768e5cf506e [file] [log] [blame]
mostang.com!davidm51095502003-03-11 01:11:18 +00001/* libunwind - a platform-independent unwind library
2 Copyright (C) 2002 Hewlett-Packard Co
3 Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4
5This file is part of libunwind.
6
7Permission is hereby granted, free of charge, to any person obtaining
8a copy of this software and associated documentation files (the
9"Software"), to deal in the Software without restriction, including
10without limitation the rights to use, copy, modify, merge, publish,
11distribute, sublicense, and/or sell copies of the Software, and to
12permit persons to whom the Software is furnished to do so, subject to
13the following conditions:
14
15The above copyright notice and this permission notice shall be
16included in all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
25
26#ifndef TDEP_X86_H
27#define TDEP_X86_H
28
29/* Target-dependent definitions that are internal to libunwind but need
30 to be shared with target-independent code. */
31
32#include <stdlib.h>
33#include <libunwind.h>
34
hp.com!davidm497018e2003-11-27 06:52:54 +000035#include "elf32.h"
36
mostang.com!davidm51095502003-03-11 01:11:18 +000037enum x86_pregnum
38 {
39 X86_NUM_PREGS
40 };
41
42struct x86_loc
43 {
44 unw_word_t val;
45#ifndef UNW_LOCAL_ONLY
46 unw_word_t type; /* see X86_LOC_TYPE_* macros. */
47#endif
48 };
49
50struct unw_addr_space
51 {
52 struct unw_accessors acc;
53 unw_caching_policy_t caching_policy;
54 uint32_t cache_generation;
55 unw_word_t dyn_generation; /* see dyn-common.h */
56 unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
57 };
58
59struct cursor
60 {
61 unw_addr_space_t as;
62 void *as_arg;
63
64 /* IP & SP cache: */
65 unw_word_t eip;
66 unw_word_t esp;
67
68 struct x86_loc eip_loc;
69 struct x86_loc ebp_loc;
70 };
71
72/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
73 tdep_search_unwind_table. */
74#define tdep_search_unwind_table(a,b,c,d,e,f) \
75 UNW_ARCH_OBJ(search_unwind_table) (a,b,c,d,e,f)
76#define tdep_find_proc_info(as,ip,pi,n,a) \
77 UNW_ARCH_OBJ(find_proc_info) (as,ip,pi,n,a)
78#define tdep_put_unwind_info(a,b,c) UNW_ARCH_OBJ(put_unwind_info)(a,b,c)
79#define tdep_uc_addr(uc,reg) UNW_ARCH_OBJ(uc_addr)(uc,reg)
hp.com!davidmf9cc1e42003-03-29 07:32:50 +000080#define tdep_get_elf_image(a,b,c,d,e) UNW_ARCH_OBJ(get_elf_image) (a, b, c, \
81 d, e)
mostang.com!davidm51095502003-03-11 01:11:18 +000082#define tdep_debug_level UNW_ARCH_OBJ(debug_level)
83
84extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
85 unw_dyn_info_t *di, unw_proc_info_t *pi,
86 int need_unwind_info, void *arg);
87extern int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip,
88 unw_proc_info_t *pi, int need_unwind_info,
89 void *arg);
90extern void tdep_put_unwind_info (unw_addr_space_t as,
91 unw_proc_info_t *pi, void *arg);
92extern void *tdep_uc_addr (ucontext_t *uc, int reg);
hp.com!davidmf9cc1e42003-03-29 07:32:50 +000093extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
94 unsigned long *segbase, unsigned long *mapoff);
mostang.com!davidm51095502003-03-11 01:11:18 +000095extern int tdep_debug_level;
96
97#endif /* TDEP_X86_H */