GDBserver

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