169e0f06dSSimon Schubert /* Target-dependent code for DragonFly/i386.
269e0f06dSSimon Schubert
38a286ab3SJohn Marino Copyright (C) 2003-2013 Free Software Foundation, Inc.
469e0f06dSSimon Schubert
569e0f06dSSimon Schubert This file is part of GDB.
669e0f06dSSimon Schubert
769e0f06dSSimon Schubert This program is free software; you can redistribute it and/or modify
869e0f06dSSimon Schubert it under the terms of the GNU General Public License as published by
969e0f06dSSimon Schubert the Free Software Foundation; either version 3 of the License, or
1069e0f06dSSimon Schubert (at your option) any later version.
1169e0f06dSSimon Schubert
1269e0f06dSSimon Schubert This program is distributed in the hope that it will be useful,
1369e0f06dSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of
1469e0f06dSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1569e0f06dSSimon Schubert GNU General Public License for more details.
1669e0f06dSSimon Schubert
1769e0f06dSSimon Schubert You should have received a copy of the GNU General Public License
1869e0f06dSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */
1969e0f06dSSimon Schubert
2069e0f06dSSimon Schubert #include "defs.h"
2169e0f06dSSimon Schubert #include "arch-utils.h"
2269e0f06dSSimon Schubert #include "gdbcore.h"
2369e0f06dSSimon Schubert #include "osabi.h"
2469e0f06dSSimon Schubert #include "regcache.h"
2569e0f06dSSimon Schubert
2669e0f06dSSimon Schubert #include "gdb_assert.h"
2769e0f06dSSimon Schubert
2869e0f06dSSimon Schubert #include "i386-tdep.h"
2969e0f06dSSimon Schubert #include "i387-tdep.h"
3069e0f06dSSimon Schubert #include "solib-svr4.h"
3169e0f06dSSimon Schubert
3269e0f06dSSimon Schubert static int i386dfly_r_reg_offset[] =
3369e0f06dSSimon Schubert {
3469e0f06dSSimon Schubert 44, /* %eax */
3569e0f06dSSimon Schubert 40, /* %ecx */
3669e0f06dSSimon Schubert 36, /* %edx */
3769e0f06dSSimon Schubert 32, /* %ebx */
3869e0f06dSSimon Schubert 72, /* %esp */
3969e0f06dSSimon Schubert 24, /* %ebp */
4069e0f06dSSimon Schubert 20, /* %esi */
4169e0f06dSSimon Schubert 16, /* %edi */
4269e0f06dSSimon Schubert 60, /* %eip */
4369e0f06dSSimon Schubert 68, /* %eflags */
4469e0f06dSSimon Schubert 64, /* %cs */
4569e0f06dSSimon Schubert 76, /* %ss */
4669e0f06dSSimon Schubert 12, /* %ds */
4769e0f06dSSimon Schubert 8, /* %es */
4869e0f06dSSimon Schubert 4, /* %fs */
4969e0f06dSSimon Schubert 0 /* %gs */
5069e0f06dSSimon Schubert };
5169e0f06dSSimon Schubert
5269e0f06dSSimon Schubert /* Sigtramp routine location. */
5369e0f06dSSimon Schubert CORE_ADDR i386dfly_sigtramp_start_addr = 0xbfbfdf20;
5469e0f06dSSimon Schubert CORE_ADDR i386dfly_sigtramp_end_addr = 0xbfbfdff0;
5569e0f06dSSimon Schubert
5669e0f06dSSimon Schubert int i386dfly_sc_reg_offset[] =
5769e0f06dSSimon Schubert {
5869e0f06dSSimon Schubert 64, /* %eax */
5969e0f06dSSimon Schubert 60, /* %ecx */
6069e0f06dSSimon Schubert 56, /* %edx */
6169e0f06dSSimon Schubert 52, /* %ebx */
6269e0f06dSSimon Schubert 92, /* %esp */
6369e0f06dSSimon Schubert 44, /* %ebp */
6469e0f06dSSimon Schubert 40, /* %esi */
6569e0f06dSSimon Schubert 36, /* %edi */
6669e0f06dSSimon Schubert 80, /* %eip */
6769e0f06dSSimon Schubert 88, /* %eflags */
6869e0f06dSSimon Schubert 84, /* %cs */
6969e0f06dSSimon Schubert 96, /* %ss */
7069e0f06dSSimon Schubert 32, /* %ds */
7169e0f06dSSimon Schubert 28, /* %es */
7269e0f06dSSimon Schubert 24, /* %fs */
7369e0f06dSSimon Schubert 20 /* %gs */
7469e0f06dSSimon Schubert };
7569e0f06dSSimon Schubert
7669e0f06dSSimon Schubert static void
i386dfly_init_abi(struct gdbarch_info info,struct gdbarch * gdbarch)7769e0f06dSSimon Schubert i386dfly_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
7869e0f06dSSimon Schubert {
7969e0f06dSSimon Schubert struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
8069e0f06dSSimon Schubert
818a286ab3SJohn Marino i386_elf_init_abi(info, gdbarch);
8269e0f06dSSimon Schubert
8369e0f06dSSimon Schubert tdep->gregset_reg_offset = i386dfly_r_reg_offset;
8469e0f06dSSimon Schubert tdep->gregset_num_regs = ARRAY_SIZE (i386dfly_r_reg_offset);
8569e0f06dSSimon Schubert tdep->sizeof_gregset = 80;
8669e0f06dSSimon Schubert
8769e0f06dSSimon Schubert tdep->sc_reg_offset = i386dfly_sc_reg_offset;
8869e0f06dSSimon Schubert tdep->sc_num_regs = ARRAY_SIZE (i386dfly_sc_reg_offset);
898a286ab3SJohn Marino
908a286ab3SJohn Marino set_solib_svr4_fetch_link_map_offsets
918a286ab3SJohn Marino (gdbarch, svr4_ilp32_fetch_link_map_offsets);
9269e0f06dSSimon Schubert }
9369e0f06dSSimon Schubert
94*e0cb4e00SSascha Wildner
9569e0f06dSSimon Schubert /* Provide a prototype to silence -Wmissing-prototypes. */
9669e0f06dSSimon Schubert void _initialize_i386dfly_tdep (void);
9769e0f06dSSimon Schubert
9869e0f06dSSimon Schubert void
_initialize_i386dfly_tdep(void)9969e0f06dSSimon Schubert _initialize_i386dfly_tdep (void)
10069e0f06dSSimon Schubert {
10169e0f06dSSimon Schubert gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_DRAGONFLY,
10269e0f06dSSimon Schubert i386dfly_init_abi);
10369e0f06dSSimon Schubert }
104