aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc-tdep.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2002-04-22 01:02:02 +0000
committerDavid S. Miller <davem@redhat.com>2002-04-22 01:02:02 +0000
commit99633aa4f81970ca618720b7a796acafd5ada195 (patch)
tree3acc759ea474978d0ab34cc42ebc6aaff3618bca /gdb/sparc-tdep.h
parent9319a2feca1b89d455884f911a662c09fcd05a8e (diff)
downloadgdb-99633aa4f81970ca618720b7a796acafd5ada195.zip
gdb-99633aa4f81970ca618720b7a796acafd5ada195.tar.gz
gdb-99633aa4f81970ca618720b7a796acafd5ada195.tar.bz2
2002-04-20 David S. Miller <davem@redhat.com>
* sparc-tdep.h: New file. * sparc-tdep.c (elf-bfd.h): Include. (SPARC_HAS_FPU, FP_REGISTER_BYTES, FP_MAX_REGNUM, SPARC_INTREG_SIZE, DUMMY_REG_SAVE_OFFSET, gdbarch_tdep, CALL_DUMMY_CALL_OFFSET): Move out to sparc-tdep.h (sparc_dump_tdep): New function. (_initialize_sparc_tdep): Use gdbarch_register instead of register_gdbarch_init which is deprecated. (process_note_abi_tag_sections, sparc_abi_handler, sparc_abi_handler_list, sparc_gdbarch_register_os_abi): New. (sparc_gdbarch_init): Determine elf os ident key based upon either the elf header or by using process_note_abi_tag_sections. Fix 'gdbarch already exists' test by comparing os_ident as well. As the last action, invoke OS abi_handler if installed.
Diffstat (limited to 'gdb/sparc-tdep.h')
-rw-r--r--gdb/sparc-tdep.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
new file mode 100644
index 0000000..88f6ee6
--- /dev/null
+++ b/gdb/sparc-tdep.h
@@ -0,0 +1,99 @@
+/* Common target dependent code for GDB on SPARC systems.
+ Copyright 2002 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * Some local macros that have multi-arch and non-multi-arch versions:
+ */
+
+#if (GDB_MULTI_ARCH > 0)
+
+/* Does the target have Floating Point registers? */
+#define SPARC_HAS_FPU (gdbarch_tdep (current_gdbarch)->has_fpu)
+/* Number of bytes devoted to Floating Point registers: */
+#define FP_REGISTER_BYTES (gdbarch_tdep (current_gdbarch)->fp_register_bytes)
+/* Highest numbered Floating Point register. */
+#define FP_MAX_REGNUM (gdbarch_tdep (current_gdbarch)->fp_max_regnum)
+/* Size of a general (integer) register: */
+#define SPARC_INTREG_SIZE (gdbarch_tdep (current_gdbarch)->intreg_size)
+/* Offset within the call dummy stack of the saved registers. */
+#define DUMMY_REG_SAVE_OFFSET (gdbarch_tdep (current_gdbarch)->reg_save_offset)
+
+#else /* non-multi-arch */
+
+/* Does the target have Floating Point registers? */
+#if defined(TARGET_SPARCLET) || defined(TARGET_SPARCLITE)
+#define SPARC_HAS_FPU 0
+#else
+#define SPARC_HAS_FPU 1
+#endif
+
+/* Number of bytes devoted to Floating Point registers: */
+#if (GDB_TARGET_IS_SPARC64)
+#define FP_REGISTER_BYTES (64 * 4)
+#else
+#if (SPARC_HAS_FPU)
+#define FP_REGISTER_BYTES (32 * 4)
+#else
+#define FP_REGISTER_BYTES 0
+#endif
+#endif
+
+/* Highest numbered Floating Point register. */
+#if (GDB_TARGET_IS_SPARC64)
+#define FP_MAX_REGNUM (FP0_REGNUM + 48)
+#else
+#define FP_MAX_REGNUM (FP0_REGNUM + 32)
+#endif
+
+/* Size of a general (integer) register: */
+#define SPARC_INTREG_SIZE (REGISTER_RAW_SIZE (G0_REGNUM))
+
+/* Offset within the call dummy stack of the saved registers. */
+#if (GDB_TARGET_IS_SPARC64)
+#define DUMMY_REG_SAVE_OFFSET (128 + 16)
+#else
+#define DUMMY_REG_SAVE_OFFSET 0x60
+#endif
+
+#endif /* GDB_MULTI_ARCH */
+
+#ifndef CALL_DUMMY_CALL_OFFSET
+#define CALL_DUMMY_CALL_OFFSET \
+ (gdbarch_tdep (current_gdbarch)->call_dummy_call_offset)
+#endif /* CALL_DUMMY_CALL_OFFSET */
+
+struct gdbarch_tdep
+ {
+ int os_ident;
+ int has_fpu;
+ int fp_register_bytes;
+ int y_regnum;
+ int fp_max_regnum;
+ int intreg_size;
+ int reg_save_offset;
+ int call_dummy_call_offset;
+ int print_insn_mach;
+ };
+
+/* How a OS variant tells the SPARC generic code that it can handle an ABI
+ type. */
+extern void sparc_gdbarch_register_os_abi (int os_ident,
+ void (*init_abi)(struct gdbarch_info,
+ struct gdbarch *));