1 /* Copyright (C) 2007-2013 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 #ifndef CONTEXT_FLOATING_POINT
22 #define CONTEXT_FLOATING_POINT 0
25 /* Defined in auto-generated file reg-arm.c. */
26 void init_registers_arm (void);
30 arm_get_thread_context (win32_thread_info
*th
, DEBUG_EVENT
* current_event
)
32 th
->context
.ContextFlags
= \
34 CONTEXT_FLOATING_POINT
;
36 GetThreadContext (th
->h
, &th
->context
);
40 arm_set_thread_context (win32_thread_info
*th
, DEBUG_EVENT
* current_event
)
42 SetThreadContext (th
->h
, &th
->context
);
45 #define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
46 static const int mappings
[] = {
76 /* Return a pointer into a CONTEXT field indexed by gdb register number.
77 Return a pointer to an dummy register holding zero if there is no
78 corresponding CONTEXT field for the given register number. */
80 regptr (CONTEXT
* c
, int r
)
85 /* Always force value to zero, in case the user tried to write
86 to this register before. */
88 return (char *) &zero
;
91 return (char *) c
+ mappings
[r
];
94 /* Fetch register from gdbserver regcache data. */
96 arm_fetch_inferior_register (struct regcache
*regcache
,
97 win32_thread_info
*th
, int r
)
99 char *context_offset
= regptr (&th
->context
, r
);
100 supply_register (regcache
, r
, context_offset
);
103 /* Store a new register value into the thread context of TH. */
105 arm_store_inferior_register (struct regcache
*regcache
,
106 win32_thread_info
*th
, int r
)
108 collect_register (regcache
, r
, regptr (&th
->context
, r
));
111 /* Correct in either endianness. We do not support Thumb yet. */
112 static const unsigned long arm_wince_breakpoint
= 0xe6000010;
113 #define arm_wince_breakpoint_len 4
115 struct win32_target_ops the_low_target
= {
117 sizeof (mappings
) / sizeof (mappings
[0]),
118 NULL
, /* initial_stuff */
119 arm_get_thread_context
,
120 arm_set_thread_context
,
121 NULL
, /* thread_added */
122 arm_fetch_inferior_register
,
123 arm_store_inferior_register
,
124 NULL
, /* single_step */
125 (const unsigned char *) &arm_wince_breakpoint
,
126 arm_wince_breakpoint_len
,
127 /* Watchpoint related functions. See target.h for comments. */
128 NULL
, /* insert_point */
129 NULL
, /* remove_point */
130 NULL
, /* stopped_by_watchpoint */
131 NULL
/* stopped_data_address */