]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdbserver/nto-x86-low.cc
[PATCH] fix windmc typedef bug
[thirdparty/binutils-gdb.git] / gdbserver / nto-x86-low.cc
CommitLineData
ac8c974e
AR
1/* QNX Neutrino specific low level interface, for the remote server
2 for GDB.
b811d2c2 3 Copyright (C) 2009-2020 Free Software Foundation, Inc.
ac8c974e
AR
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
a8ae7dc0 20#include "server.h"
ac8c974e
AR
21#include "nto-low.h"
22#include "regdef.h"
23#include "regcache.h"
24
25#include <x86/context.h>
268a13a5 26#include "gdbsupport/x86-xstate.h"
22916b07 27#include "arch/i386.h"
190852c8 28#include "x86-tdesc.h"
ac8c974e
AR
29
30const unsigned char x86_breakpoint[] = { 0xCC };
31#define x86_breakpoint_len 1
32
33/* Returns offset in appropriate Neutrino's context structure.
34 Defined in x86/context.h.
35 GDBREGNO is index into regs_i386 array. It is autogenerated and
36 hopefully doesn't change. */
37static int
38nto_x86_register_offset (int gdbregno)
39{
40 if (gdbregno >= 0 && gdbregno < 16)
41 {
42 X86_CPU_REGISTERS *dummy = (void*)0;
43 /* GPRs */
44 switch (gdbregno)
45 {
46 case 0:
47 return (int)&(dummy->eax);
48 case 1:
49 return (int)&(dummy->ecx);
50 case 2:
51 return (int)&(dummy->edx);
52 case 3:
53 return (int)&(dummy->ebx);
54 case 4:
55 return (int)&(dummy->esp);
56 case 5:
57 return (int)&(dummy->ebp);
58 case 6:
59 return (int)&(dummy->esi);
60 case 7:
61 return (int)&(dummy->edi);
62 case 8:
63 return (int)&(dummy->eip);
64 case 9:
65 return (int)&(dummy->efl);
66 case 10:
67 return (int)&(dummy->cs);
68 case 11:
69 return (int)&(dummy->ss);
70#ifdef __SEGMENTS__
71 case 12:
72 return (int)&(dummy->ds);
73 case 13:
74 return (int)&(dummy->es);
75 case 14:
76 return (int)&(dummy->fs);
77 case 15:
78 return (int)&(dummy->gs);
79#endif
80 default:
81 return -1;
82 }
83 }
84 return -1;
85}
86
87static void
88nto_x86_arch_setup (void)
89{
ac8c974e 90 the_low_target.num_regs = 16;
289a6840 91 struct target_desc *tdesc
1163a4b7 92 = i386_create_target_description (X86_XSTATE_SSE_MASK, false, false);
289a6840 93
190852c8 94 init_target_desc (tdesc, i386_expedite_regs);
289a6840
SM
95
96 nto_tdesc = tdesc;
ac8c974e
AR
97}
98
99struct nto_target_ops the_low_target =
100{
101 nto_x86_arch_setup,
102 0, /* num_regs */
103 nto_x86_register_offset,
104 x86_breakpoint,
105 x86_breakpoint_len
106};
107
108
109