OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [amd64nbsd-tdep.c] - Blame information for rev 24

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Target-dependent code for NetBSD/amd64.
2
 
3
   Copyright (C) 2003, 2004, 2007, 2008 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 3 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, see <http://www.gnu.org/licenses/>.  */
19
 
20
#include "defs.h"
21
#include "arch-utils.h"
22
#include "frame.h"
23
#include "gdbcore.h"
24
#include "osabi.h"
25
#include "symtab.h"
26
 
27
#include "gdb_assert.h"
28
 
29
#include "amd64-tdep.h"
30
#include "nbsd-tdep.h"
31
#include "solib-svr4.h"
32
 
33
/* Support for signal handlers.  */
34
 
35
/* Return whether the frame preceding NEXT_FRAME corresponds to a
36
   NetBSD sigtramp routine.  */
37
 
38
static int
39
amd64nbsd_sigtramp_p (struct frame_info *next_frame)
40
{
41
  CORE_ADDR pc = frame_pc_unwind (next_frame);
42
  char *name;
43
 
44
  find_pc_partial_function (pc, &name, NULL, NULL);
45
  return nbsd_pc_in_sigtramp (pc, name);
46
}
47
 
48
/* Assuming NEXT_FRAME is preceded by a frame corresponding to a
49
   NetBSD sigtramp routine, return the address of the associated
50
   mcontext structure.  */
51
 
52
static CORE_ADDR
53
amd64nbsd_mcontext_addr (struct frame_info *next_frame)
54
{
55
  CORE_ADDR addr;
56
 
57
  /* The register %r15 points at `struct ucontext' upon entry of a
58
     signal trampoline.  */
59
  addr = frame_unwind_register_unsigned (next_frame, AMD64_R15_REGNUM);
60
 
61
  /* The mcontext structure lives as offset 56 in `struct ucontext'.  */
62
  return addr + 56;
63
}
64
 
65
/* NetBSD 2.0 or later.  */
66
 
67
/* Mapping between the general-purpose registers in `struct reg'
68
   format and GDB's register cache layout.  */
69
 
70
/* From <machine/reg.h>.  */
71
int amd64nbsd_r_reg_offset[] =
72
{
73
  14 * 8,                       /* %rax */
74
  13 * 8,                       /* %rbx */
75
  3 * 8,                        /* %rcx */
76
  2 * 8,                        /* %rdx */
77
  1 * 8,                        /* %rsi */
78
 
79
  12 * 8,                       /* %rbp */
80
  24 * 8,                       /* %rsp */
81
  4 * 8,                        /* %r8 .. */
82
  5 * 8,
83
  6 * 8,
84
  7 * 8,
85
  8 * 8,
86
  9 * 8,
87
  10 * 8,
88
  11 * 8,                       /* ... %r15 */
89
  21 * 8,                       /* %rip */
90
  23 * 8,                       /* %eflags */
91
  22 * 8,                       /* %cs */
92
  25 * 8,                       /* %ss */
93
  18 * 8,                       /* %ds */
94
  17 * 8,                       /* %es */
95
  16 * 8,                       /* %fs */
96
  15 * 8                        /* %gs */
97
};
98
 
99
static void
100
amd64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
101
{
102
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
103
 
104
  /* Initialize general-purpose register set details first.  */
105
  tdep->gregset_reg_offset = amd64nbsd_r_reg_offset;
106
  tdep->gregset_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset);
107
  tdep->sizeof_gregset = 26 * 8;
108
 
109
  amd64_init_abi (info, gdbarch);
110
 
111
  tdep->jb_pc_offset = 7 * 8;
112
 
113
  /* NetBSD has its own convention for signal trampolines.  */
114
  tdep->sigtramp_p = amd64nbsd_sigtramp_p;
115
  tdep->sigcontext_addr = amd64nbsd_mcontext_addr;
116
  tdep->sc_reg_offset = amd64nbsd_r_reg_offset;
117
  tdep->sc_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset);
118
 
119
  /* NetBSD uses SVR4-style shared libraries.  */
120
  set_solib_svr4_fetch_link_map_offsets
121
    (gdbarch, svr4_lp64_fetch_link_map_offsets);
122
}
123
 
124
 
125
/* Provide a prototype to silence -Wmissing-prototypes.  */
126
void _initialize_amd64nbsd_tdep (void);
127
 
128
void
129
_initialize_amd64nbsd_ndep (void)
130
{
131
  /* The NetBSD/amd64 native dependent code makes this assumption.  */
132
  gdb_assert (ARRAY_SIZE (amd64nbsd_r_reg_offset) == AMD64_NUM_GREGS);
133
 
134
  gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
135
                          GDB_OSABI_NETBSD_ELF, amd64nbsd_init_abi);
136
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.