mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 18:44:20 +08:00
af23364752
register numbers in comments. * x86-64-tdep.h: Update copyright year. (X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): Adjust for addition of %cs and %ss. * amd64fbsd-nat.c: Update copyright year. (reg_offset): Add register offsets for %cs and %ss. * amd64fbsd-tdep.c: Update copyright year. (amd64fbsd_r_reg_offset): Add register offsets for %cs and %ss. (amd64fbsd_sc_reg_offset): Likewise. * x86-64-linux-nat.c: Update copyright year. (x86_64_linux_gregset64_reg_offset): Add register offsets for %cs and %ss. * amd64nbsd-nat.c: Update copyright year. (amd64nbsd32_r_reg_offset): Add register offsets for %cs and %ss. * amd64nbsd-tdep.c: Update copyright year. (amd64nbsd_r_reg_offset): Add register offsets for %cs and %ss. * x86-64-linux-tdep.c: Update copyright year. (user_to_gdb_regmap): Add mapping for %cs and %ss. (x86_64_linux_sc_reg_offset): Adjust for addition of %cs and %ss. * regformats/reg-x86-64.dat: Add %cs and %ss.
151 lines
3.9 KiB
C
151 lines
3.9 KiB
C
/* Target-dependent code for FreeBSD/amd64.
|
||
|
||
Copyright 2003, 2004 Free Software Foundation, Inc.
|
||
|
||
This file is part of GDB.
|
||
|
||
This program is free software; you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation; either version 2 of the License, or
|
||
(at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program; if not, write to the Free Software
|
||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||
Boston, MA 02111-1307, USA. */
|
||
|
||
#include "defs.h"
|
||
#include "arch-utils.h"
|
||
#include "frame.h"
|
||
#include "gdbcore.h"
|
||
#include "regcache.h"
|
||
#include "osabi.h"
|
||
|
||
#include "gdb_string.h"
|
||
|
||
#include "x86-64-tdep.h"
|
||
|
||
/* Support for signal handlers. */
|
||
|
||
/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
|
||
routine, return the address of the associated sigcontext structure. */
|
||
|
||
static CORE_ADDR
|
||
amd64fbsd_sigcontext_addr (struct frame_info *next_frame)
|
||
{
|
||
CORE_ADDR sp;
|
||
|
||
/* The `struct sigcontext' (which really is an `ucontext_t' on
|
||
FreeBSD/amd64) lives at a fixed offset in the signal frame. See
|
||
<machine/sigframe.h>. */
|
||
sp = frame_unwind_register_unsigned (next_frame, X86_64_RSP_REGNUM);
|
||
return sp + 16;
|
||
}
|
||
|
||
/* FreeBSD 5.1-RELEASE or later. */
|
||
|
||
/* Mapping between the general-purpose registers in `struct reg'
|
||
format and GDB's register cache layout.
|
||
|
||
Note that some registers are 32-bit, but since we're little-endian
|
||
we get away with that. */
|
||
|
||
/* From <machine/reg.h>. */
|
||
static int amd64fbsd_r_reg_offset[] =
|
||
{
|
||
14 * 8, /* %rax */
|
||
11 * 8, /* %rbx */
|
||
13 * 8, /* %rcx */
|
||
12 * 8, /* %rdx */
|
||
9 * 8, /* %rsi */
|
||
8 * 8, /* %rdi */
|
||
10 * 8, /* %rbp */
|
||
20 * 8, /* %rsp */
|
||
7 * 8, /* %r8 ... */
|
||
6 * 8,
|
||
5 * 8,
|
||
4 * 8,
|
||
3 * 8,
|
||
2 * 8,
|
||
1 * 8,
|
||
0 * 8, /* ... %r15 */
|
||
17 * 8, /* %rip */
|
||
19 * 8, /* %eflags */
|
||
18 * 8, /* %cs */
|
||
21 * 8, /* %ss */
|
||
-1, /* %ds */
|
||
-1, /* %es */
|
||
-1, /* %fs */
|
||
-1 /* %gs */
|
||
};
|
||
|
||
/* Location of the signal trampoline. */
|
||
CORE_ADDR amd64fbsd_sigtramp_start = 0x7fffffffffc0;
|
||
CORE_ADDR amd64fbsd_sigtramp_end = 0x7fffffffffe0;
|
||
|
||
/* From <machine/signal.h>. */
|
||
int amd64fbsd_sc_reg_offset[] =
|
||
{
|
||
24 + 6 * 8, /* %rax */
|
||
24 + 7 * 8, /* %rbx */
|
||
24 + 3 * 8, /* %rcx */
|
||
24 + 2 * 8, /* %rdx */
|
||
24 + 1 * 8, /* %rsi */
|
||
24 + 0 * 8, /* %rdi */
|
||
24 + 8 * 8, /* %rbp */
|
||
24 + 22 * 8, /* %rsp */
|
||
24 + 4 * 8, /* %r8 ... */
|
||
24 + 5 * 8,
|
||
24 + 9 * 8,
|
||
24 + 10 * 8,
|
||
24 + 11 * 8,
|
||
24 + 12 * 8,
|
||
24 + 13 * 8,
|
||
24 + 14 * 8, /* ... %r15 */
|
||
24 + 19 * 8, /* %rip */
|
||
24 + 21 * 8, /* %eflags */
|
||
24 + 20 * 8, /* %cs */
|
||
24 + 23 * 8, /* %ss */
|
||
-1, /* %ds */
|
||
-1, /* %es */
|
||
-1, /* %fs */
|
||
-1 /* %gs */
|
||
};
|
||
|
||
void
|
||
amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||
{
|
||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||
|
||
/* Obviously FreeBSD is BSD-based. */
|
||
i386bsd_init_abi (info, gdbarch);
|
||
|
||
tdep->gregset_reg_offset = amd64fbsd_r_reg_offset;
|
||
tdep->gregset_num_regs = ARRAY_SIZE (amd64fbsd_r_reg_offset);
|
||
tdep->sizeof_gregset = 22 * 8;
|
||
|
||
x86_64_init_abi (info, gdbarch);
|
||
|
||
tdep->sigtramp_start = amd64fbsd_sigtramp_start;
|
||
tdep->sigtramp_end = amd64fbsd_sigtramp_end;
|
||
tdep->sigcontext_addr = amd64fbsd_sigcontext_addr;
|
||
tdep->sc_reg_offset = amd64fbsd_sc_reg_offset;
|
||
tdep->sc_num_regs = ARRAY_SIZE (amd64fbsd_sc_reg_offset);
|
||
}
|
||
|
||
|
||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||
void _initialize_amd64fbsd_tdep (void);
|
||
|
||
void
|
||
_initialize_amd64fbsd_tdep (void)
|
||
{
|
||
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
|
||
GDB_OSABI_FREEBSD_ELF, amd64fbsd_init_abi);
|
||
}
|