2002-04-20 David S. Miller <davem@redhat.com>
[platform/upstream/binutils.git] / gdb / sparc-tdep.h
1 /* Common target dependent code for GDB on SPARC systems.
2    Copyright 2002 Free Software Foundation, Inc.
3
4    This file is part of GDB.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 /*
22  * Some local macros that have multi-arch and non-multi-arch versions:
23  */
24
25 #if (GDB_MULTI_ARCH > 0)
26
27 /* Does the target have Floating Point registers?  */
28 #define SPARC_HAS_FPU     (gdbarch_tdep (current_gdbarch)->has_fpu)
29 /* Number of bytes devoted to Floating Point registers: */
30 #define FP_REGISTER_BYTES (gdbarch_tdep (current_gdbarch)->fp_register_bytes)
31 /* Highest numbered Floating Point register.  */
32 #define FP_MAX_REGNUM     (gdbarch_tdep (current_gdbarch)->fp_max_regnum)
33 /* Size of a general (integer) register: */
34 #define SPARC_INTREG_SIZE (gdbarch_tdep (current_gdbarch)->intreg_size)
35 /* Offset within the call dummy stack of the saved registers.  */
36 #define DUMMY_REG_SAVE_OFFSET (gdbarch_tdep (current_gdbarch)->reg_save_offset)
37
38 #else /* non-multi-arch */
39
40 /* Does the target have Floating Point registers?  */
41 #if defined(TARGET_SPARCLET) || defined(TARGET_SPARCLITE)
42 #define SPARC_HAS_FPU 0
43 #else
44 #define SPARC_HAS_FPU 1
45 #endif
46
47 /* Number of bytes devoted to Floating Point registers: */
48 #if (GDB_TARGET_IS_SPARC64)
49 #define FP_REGISTER_BYTES (64 * 4)
50 #else
51 #if (SPARC_HAS_FPU)
52 #define FP_REGISTER_BYTES (32 * 4)
53 #else
54 #define FP_REGISTER_BYTES 0
55 #endif
56 #endif
57
58 /* Highest numbered Floating Point register.  */
59 #if (GDB_TARGET_IS_SPARC64)
60 #define FP_MAX_REGNUM (FP0_REGNUM + 48)
61 #else
62 #define FP_MAX_REGNUM (FP0_REGNUM + 32)
63 #endif
64
65 /* Size of a general (integer) register: */
66 #define SPARC_INTREG_SIZE (REGISTER_RAW_SIZE (G0_REGNUM))
67
68 /* Offset within the call dummy stack of the saved registers.  */
69 #if (GDB_TARGET_IS_SPARC64)
70 #define DUMMY_REG_SAVE_OFFSET (128 + 16)
71 #else
72 #define DUMMY_REG_SAVE_OFFSET 0x60
73 #endif
74
75 #endif /* GDB_MULTI_ARCH */
76
77 #ifndef CALL_DUMMY_CALL_OFFSET
78 #define CALL_DUMMY_CALL_OFFSET \
79      (gdbarch_tdep (current_gdbarch)->call_dummy_call_offset)
80 #endif /* CALL_DUMMY_CALL_OFFSET */
81
82 struct gdbarch_tdep
83   {
84     int os_ident;
85     int has_fpu;
86     int fp_register_bytes;
87     int y_regnum;
88     int fp_max_regnum;
89     int intreg_size;
90     int reg_save_offset;
91     int call_dummy_call_offset;
92     int print_insn_mach;
93   };
94
95 /* How a OS variant tells the SPARC generic code that it can handle an ABI
96    type.  */
97 extern void sparc_gdbarch_register_os_abi (int os_ident,
98                                            void (*init_abi)(struct gdbarch_info,
99                                                             struct gdbarch *));