1 /* Copyright (C) 2007-2020 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include "win32-low.h"
21 using namespace windows_nat
;
23 #ifndef CONTEXT_FLOATING_POINT
24 #define CONTEXT_FLOATING_POINT 0
27 /* Defined in auto-generated file reg-arm.c. */
28 void init_registers_arm (void);
29 extern const struct target_desc
*tdesc_arm
;
32 arm_get_thread_context (windows_thread_info
*th
)
34 th
->context
.ContextFlags
= \
36 CONTEXT_FLOATING_POINT
;
38 GetThreadContext (th
->h
, &th
->context
);
41 #define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
42 static const int mappings
[] = {
72 /* Return a pointer into a CONTEXT field indexed by gdb register number.
73 Return a pointer to an dummy register holding zero if there is no
74 corresponding CONTEXT field for the given register number. */
76 regptr (CONTEXT
* c
, int r
)
81 /* Always force value to zero, in case the user tried to write
82 to this register before. */
84 return (char *) &zero
;
87 return (char *) c
+ mappings
[r
];
90 /* Fetch register from gdbserver regcache data. */
92 arm_fetch_inferior_register (struct regcache
*regcache
,
93 windows_thread_info
*th
, int r
)
95 char *context_offset
= regptr (&th
->context
, r
);
96 supply_register (regcache
, r
, context_offset
);
99 /* Store a new register value into the thread context of TH. */
101 arm_store_inferior_register (struct regcache
*regcache
,
102 windows_thread_info
*th
, int r
)
104 collect_register (regcache
, r
, regptr (&th
->context
, r
));
108 arm_arch_setup (void)
110 init_registers_arm ();
111 win32_tdesc
= tdesc_arm
;
114 /* Correct in either endianness. We do not support Thumb yet. */
115 static const unsigned long arm_wince_breakpoint
= 0xe6000010;
116 #define arm_wince_breakpoint_len 4
118 struct win32_target_ops the_low_target
= {
120 sizeof (mappings
) / sizeof (mappings
[0]),
121 NULL
, /* initial_stuff */
122 arm_get_thread_context
,
123 NULL
, /* prepare_to_resume */
124 NULL
, /* thread_added */
125 arm_fetch_inferior_register
,
126 arm_store_inferior_register
,
127 NULL
, /* single_step */
128 (const unsigned char *) &arm_wince_breakpoint
,
129 arm_wince_breakpoint_len
,
130 /* Watchpoint related functions. See target.h for comments. */
131 NULL
, /* supports_z_point_type */
132 NULL
, /* insert_point */
133 NULL
, /* remove_point */
134 NULL
, /* stopped_by_watchpoint */
135 NULL
/* stopped_data_address */