1 /* Native-dependent code for Solaris x86.
3 Copyright (C) 2004 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
25 #include <sys/procfs.h>
28 /* This file provids the (temporary) glue between the Solaris x86
29 target dependent code and the machine independent SVR4 /proc
32 /* Solaris 10 (Solaris 2.10, SunOS 5.10) and up support two process
33 data models, the traditional 32-bit data model (ILP32) and the
34 64-bit data model (LP64). The format of /proc depends on the data
35 model of the observer (the controlling process, GDB in our case).
36 The Solaris header files conveniently define PR_MODEL_NATIVE to the
37 data model of the controlling process. If its value is
38 PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit
41 Note that a 32-bit GDB won't be able to debug a 64-bit target
42 process using /proc on Solaris. */
44 #if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
46 #include "amd64-nat.h"
47 #include "amd64-tdep.h"
49 /* Mapping between the general-purpose registers in gregset_t format
50 and GDB's register cache layout. */
52 /* From <sys/regset.h>. */
53 static int amd64_sol2_gregset64_reg_offset
[] = {
80 /* 32-bit registers are provided by Solaris in 64-bit format, so just
81 give a subset of the list above. */
82 static int amd64_sol2_gregset32_reg_offset
[] = {
102 supply_gregset (prgregset_t
*gregs
)
104 amd64_supply_native_gregset (current_regcache
, gregs
, -1);
108 supply_fpregset (prfpregset_t
*fpregs
)
110 amd64_supply_fxsave (current_regcache
, -1, fpregs
);
114 fill_gregset (prgregset_t
*gregs
, int regnum
)
116 amd64_collect_native_gregset (current_regcache
, gregs
, regnum
);
120 fill_fpregset (prfpregset_t
*fpregs
, int regnum
)
122 amd64_collect_fxsave (current_regcache
, regnum
, fpregs
);
127 /* For 32-bit Solaris x86, we use the Unix SVR4 code in i386v4-nat.c. */
131 /* Provide a prototype to silence -Wmissing-prototypes. */
132 extern void _initialize_amd64_sol2_nat (void);
135 _initialize_amd64_sol2_nat (void)
137 #if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
138 amd64_native_gregset32_reg_offset
= amd64_sol2_gregset32_reg_offset
;
139 amd64_native_gregset32_num_regs
=
140 ARRAY_SIZE (amd64_sol2_gregset32_reg_offset
);
141 amd64_native_gregset64_reg_offset
= amd64_sol2_gregset64_reg_offset
;
142 amd64_native_gregset64_num_regs
=
143 ARRAY_SIZE (amd64_sol2_gregset64_reg_offset
);