1181834Sroberto/* Native-dependent code for NetBSD/amd64.
2285612Sdelphij
3285612Sdelphij   Copyright 2003, 2004 Free Software Foundation, Inc.
4181834Sroberto
5181834Sroberto   This file is part of GDB.
6181834Sroberto
7181834Sroberto   This program is free software; you can redistribute it and/or modify
8181834Sroberto   it under the terms of the GNU General Public License as published by
9181834Sroberto   the Free Software Foundation; either version 2 of the License, or
10181834Sroberto   (at your option) any later version.
11285612Sdelphij
12285612Sdelphij   This program is distributed in the hope that it will be useful,
13285612Sdelphij   but WITHOUT ANY WARRANTY; without even the implied warranty of
14181834Sroberto   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15181834Sroberto   GNU General Public License for more details.
16285612Sdelphij
17285612Sdelphij   You should have received a copy of the GNU General Public License
18285612Sdelphij   along with this program; if not, write to the Free Software
19181834Sroberto   Foundation, Inc., 59 Temple Place - Suite 330,
20285612Sdelphij   Boston, MA 02111-1307, USA.  */
21285612Sdelphij
22285612Sdelphij#include "defs.h"
23181834Sroberto#include "target.h"
24285612Sdelphij
25285612Sdelphij#include "gdb_assert.h"
26181834Sroberto
27285612Sdelphij#include "amd64-tdep.h"
28285612Sdelphij#include "amd64-nat.h"
29181834Sroberto
30285612Sdelphij/* Mapping between the general-purpose registers in NetBSD/amd64
31181834Sroberto   `struct reg' format and GDB's register cache layout for
32285612Sdelphij   NetBSD/i386.
33285612Sdelphij
34285612Sdelphij   Note that most (if not all) NetBSD/amd64 registers are 64-bit,
35181834Sroberto   while the NetBSD/i386 registers are all 32-bit, but since we're
36181834Sroberto   little-endian we get away with that.  */
37181834Sroberto
38181834Sroberto/* From <machine/reg.h>.  */
39181834Srobertostatic int amd64nbsd32_r_reg_offset[] =
40181834Sroberto{
41285612Sdelphij  14 * 8,			/* %eax */
42285612Sdelphij  3 * 8,			/* %ecx */
43181834Sroberto  2 * 8,			/* %edx */
44181834Sroberto  13 * 8,			/* %ebx */
45181834Sroberto  24 * 8,			/* %esp */
46181834Sroberto  12 * 8,			/* %ebp */
47181834Sroberto  1 * 8,			/* %esi */
48181834Sroberto  0 * 8,			/* %edi */
49181834Sroberto  21 * 8,			/* %eip */
50181834Sroberto  23 * 8,			/* %eflags */
51181834Sroberto  22 * 8,			/* %cs */
52181834Sroberto  25 * 8,			/* %ss */
53181834Sroberto  18 * 8,			/* %ds */
54181834Sroberto  17 * 8,			/* %es */
55181834Sroberto  16 * 8,			/* %fs */
56181834Sroberto  15 * 8			/* %gs */
57181834Sroberto};
58181834Sroberto
59181834Sroberto
60181834Sroberto/* Provide a prototype to silence -Wmissing-prototypes.  */
61181834Srobertovoid _initialize_amd64nbsd_nat (void);
62181834Sroberto
63181834Srobertovoid
64181834Sroberto_initialize_amd64nbsd_nat (void)
65181834Sroberto{
66181834Sroberto  amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
67181834Sroberto  amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
68181834Sroberto  amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
69181834Sroberto
70181834Sroberto  /* We've got nothing to add to the common *BSD/amd64 target.  */
71181834Sroberto  add_target (amd64bsd_target ());
72181834Sroberto}
73181834Sroberto