summaryrefslogtreecommitdiff
path: root/backends/x86_64_cfi.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-06-24 17:41:40 -0700
committerRoland McGrath <roland@redhat.com>2009-07-08 15:15:52 -0700
commit3c84db3b4b610bf636c4363abb6d3dac5ae020f9 (patch)
treee0af0c5a7f27a3f06a66353a3da9bec0bd7bd32f /backends/x86_64_cfi.c
parentfe8b42e6131b74829fe31d15f31349cade566a59 (diff)
downloadelfutils-3c84db3b4b610bf636c4363abb6d3dac5ae020f9.tar.gz
CFI support: lookup by PC and translate into DWARF location per register
Diffstat (limited to 'backends/x86_64_cfi.c')
-rw-r--r--backends/x86_64_cfi.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/backends/x86_64_cfi.c b/backends/x86_64_cfi.c
new file mode 100644
index 00000000..caaee44e
--- /dev/null
+++ b/backends/x86_64_cfi.c
@@ -0,0 +1,60 @@
+/* x86-64 ABI-specified defaults for DWARF CFI.
+ Copyright (C) 2009 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by the
+ Free Software Foundation; version 2 of the License.
+
+ Red Hat elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <dwarf.h>
+
+#define BACKEND x86_64_
+#include "libebl_CPU.h"
+
+int
+x86_64_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
+{
+ static const uint8_t abi_cfi[] =
+ {
+ /* Call-saved regs. */
+ DW_CFA_same_value, ULEB128_7 (0), /* %rbx */
+ DW_CFA_same_value, ULEB128_7 (6), /* %rbp */
+ DW_CFA_same_value, ULEB128_7 (12), /* %r12 */
+ DW_CFA_same_value, ULEB128_7 (13), /* %r13 */
+ DW_CFA_same_value, ULEB128_7 (14), /* %r14 */
+ DW_CFA_same_value, ULEB128_7 (15), /* %r15 */
+ DW_CFA_same_value, ULEB128_7 (16), /* %r16 */
+
+ /* The CFA is the SP. */
+ DW_CFA_val_offset, ULEB128_7 (7), ULEB128_7 (0),
+ };
+
+ abi_info->initial_instructions = abi_cfi;
+ abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
+ abi_info->data_alignment_factor = 8;
+
+ abi_info->return_address_register = 16; /* %rip */
+
+ return 0;
+}