* i386-sol2-nat.c: New file.
[external/binutils.git] / gdb / i386-sol2-nat.c
1 /* Native-dependent code for Solaris x86.
2
3    Copyright 2004 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
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.
11
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.
16
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., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21
22 #include "defs.h"
23 #include "regcache.h"
24
25 #include <sys/procfs.h>
26 #include "gregset.h"
27
28 /* This file provids the (temporary) glue between the Solaris x86
29    target dependent code and the machine independent SVR4 /proc
30    support.  */
31
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
39    program.
40
41    Note that a 32-bit GDB won't be able to debug a 64-bit target
42    process using /proc on Solaris.  */
43
44 #if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
45
46 #include "amd64-nat.h"
47 #include "amd64-tdep.h"
48
49 void
50 supply_gregset (prgregset_t *gregs)
51 {
52   amd64_supply_native_gregset (current_regcache, -1, gregs);
53 }
54
55 void
56 supply_fpregset (prfpregset_t *fpregs)
57 {
58   amd64_supply_fxsave (current_regcache, -1, fpregs);
59 }
60
61 void
62 fill_gregset (prgregset_t *gregs, int regnum)
63 {
64   amd64_collect_native_gregset (current_regcache, regnum, gregs);
65 }
66
67 void
68 fill_fpregset (prfpregset_t *fpregs, int regnum)
69 {
70   amd64_collect_fxsave (current_regcache, regnum, fpregs);
71 }
72
73 #else
74
75 /* 32-bit Solaris x86 is very similar to SVR4.  */
76 #include "i386v4-nat.c"
77
78 #endif