gdb: add our changes
[dragonfly.git] / contrib / gdb-7 / gdb / i386dfly-tdep.c
1 /* Target-dependent code for DragonFly/i386.
2
3    Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009
4    Free Software Foundation, Inc.
5
6    This file is part of GDB.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
21 #include "defs.h"
22 #include "arch-utils.h"
23 #include "gdbcore.h"
24 #include "osabi.h"
25 #include "regcache.h"
26
27 #include "gdb_assert.h"
28
29 #include "i386-tdep.h"
30 #include "i387-tdep.h"
31 #include "bsd-uthread.h"
32 #include "solib-svr4.h"
33
34 static int i386dfly_r_reg_offset[] =
35 {
36   44, /* %eax */
37   40, /* %ecx */
38   36, /* %edx */
39   32, /* %ebx */
40   72, /* %esp */
41   24, /* %ebp */
42   20, /* %esi */
43   16, /* %edi */
44   60, /* %eip */
45   68, /* %eflags */
46   64, /* %cs */
47   76, /* %ss */
48   12, /* %ds */
49   8, /* %es */
50   4, /* %fs */
51   0  /* %gs */
52 };
53
54 /* Sigtramp routine location.  */
55 CORE_ADDR i386dfly_sigtramp_start_addr = 0xbfbfdf20;
56 CORE_ADDR i386dfly_sigtramp_end_addr = 0xbfbfdff0;
57
58 int i386dfly_sc_reg_offset[] =
59 {
60   64, /* %eax */
61   60, /* %ecx */
62   56, /* %edx */
63   52, /* %ebx */
64   92, /* %esp */
65   44, /* %ebp */
66   40, /* %esi */
67   36, /* %edi */
68   80, /* %eip */
69   88, /* %eflags */
70   84, /* %cs */
71   96, /* %ss */
72   32, /* %ds */
73   28, /* %es */
74   24, /* %fs */
75   20  /* %gs */
76 };
77
78 static void
79 i386dfly_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
80 {
81   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
82
83   i386fbsd4_init_abi(info, gdbarch);
84
85   tdep->gregset_reg_offset = i386dfly_r_reg_offset;
86   tdep->gregset_num_regs = ARRAY_SIZE (i386dfly_r_reg_offset);
87   tdep->sizeof_gregset = 80;
88
89   tdep->sc_reg_offset = i386dfly_sc_reg_offset;
90   tdep->sc_num_regs = ARRAY_SIZE (i386dfly_sc_reg_offset);
91 }
92
93 \f
94 /* Provide a prototype to silence -Wmissing-prototypes.  */
95 void _initialize_i386dfly_tdep (void);
96
97 void
98 _initialize_i386dfly_tdep (void)
99 {
100   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_DRAGONFLY,
101                           i386dfly_init_abi);
102 }