wined3d: Move texture2d_load_drawable() to texture.c.
[wine.git] / programs / winedbg / be_ppc.c
blobff6ece6df3aef3f8b167991be2b56bb71d76a4a1
1 /*
2 * Debugger Power PC specific functions
4 * Copyright 2000-2003 Marcus Meissner
5 * 2004 Eric Pouech
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library 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 GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "debugger.h"
24 #if defined(__powerpc__)
26 static BOOL be_ppc_get_addr(HANDLE hThread, const dbg_ctx_t *ctx,
27 enum be_cpu_addr bca, ADDRESS64* addr)
29 switch (bca)
31 case be_cpu_addr_pc:
32 return be_cpu_build_addr(hThread, ctx, addr, 0, ctx->ctx.Iar);
33 default:
34 case be_cpu_addr_stack:
35 case be_cpu_addr_frame:
36 dbg_printf("not done\n");
38 return FALSE;
41 static BOOL be_ppc_get_register_info(int regno, enum be_cpu_addr* kind)
43 dbg_printf("not done\n");
44 return FALSE;
47 static void be_ppc_single_step(dbg_ctx_t *ctx, BOOL enable)
49 #ifndef MSR_SE
50 # define MSR_SE (1<<10)
51 #endif
52 if (enable) ctx->ctx.Msr |= MSR_SE;
53 else ctx->ctx.Msr &= ~MSR_SE;
56 static void be_ppc_print_context(HANDLE hThread, const dbg_ctx_t *ctx, int all_regs)
58 dbg_printf("Context printing for PPC not done yet\n");
61 static void be_ppc_print_segment_info(HANDLE hThread, const dbg_ctx_t *ctx)
65 static struct dbg_internal_var be_ppc_ctx[] =
67 {0, NULL, 0, dbg_itype_none}
70 static BOOL be_ppc_is_step_over_insn(const void* insn)
72 dbg_printf("not done\n");
73 return FALSE;
76 static BOOL be_ppc_is_function_return(const void* insn)
78 dbg_printf("not done\n");
79 return FALSE;
82 static BOOL be_ppc_is_break_insn(const void* insn)
84 dbg_printf("not done\n");
85 return FALSE;
88 static BOOL be_ppc_is_func_call(const void* insn, ADDRESS64* callee)
90 return FALSE;
93 static BOOL be_ppc_is_jump(const void* insn, ADDRESS64* jumpee)
95 return FALSE;
98 static void be_ppc_disasm_one_insn(ADDRESS64* addr, int display)
101 dbg_printf("Disasm NIY\n");
104 static BOOL be_ppc_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
105 dbg_ctx_t *ctx, enum be_xpoint_type type,
106 void* addr, unsigned long* val, unsigned size)
108 unsigned long xbp;
109 SIZE_T sz;
111 switch (type)
113 case be_xpoint_break:
114 if (!size) return FALSE;
115 if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return FALSE;
116 xbp = 0x7d821008; /* 7d 82 10 08 ... in big endian */
117 if (!pio->write(hProcess, addr, &xbp, 4, &sz) || sz != 4) return FALSE;
118 break;
119 default:
120 dbg_printf("Unknown/unsupported bp type %c\n", type);
121 return FALSE;
123 return TRUE;
126 static BOOL be_ppc_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
127 dbg_ctx_t *ctx, enum be_xpoint_type type,
128 void* addr, unsigned long val, unsigned size)
130 SIZE_T sz;
132 switch (type)
134 case be_xpoint_break:
135 if (!size) return FALSE;
136 if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return FALSE;
137 break;
138 default:
139 dbg_printf("Unknown/unsupported bp type %c\n", type);
140 return FALSE;
142 return TRUE;
145 static BOOL be_ppc_is_watchpoint_set(const dbg_ctx_t *ctx, unsigned idx)
147 dbg_printf("not done\n");
148 return FALSE;
151 static void be_ppc_clear_watchpoint(dbg_ctx_t *ctx, unsigned idx)
153 dbg_printf("not done\n");
156 static int be_ppc_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way)
158 dbg_printf("not done\n");
159 return 0;
162 static BOOL be_ppc_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
163 BOOL is_signed, LONGLONG* ret)
165 dbg_printf("not done\n");
166 return FALSE;
169 static BOOL be_ppc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
170 long double* ret)
172 dbg_printf("not done\n");
173 return FALSE;
176 static BOOL be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
177 BOOL is_signed, LONGLONG val)
179 dbg_printf("be_ppc_store_integer: not done\n");
180 return FALSE;
183 static BOOL be_ppc_get_context(HANDLE thread, dbg_ctx_t *ctx)
185 ctx->ctx.ContextFlags = CONTEXT_ALL;
186 return GetThreadContext(thread, &ctx->ctx);
189 static BOOL be_ppc_set_context(HANDLE thread, const dbg_ctx_t *ctx)
191 return SetThreadContext(thread, &ctx->ctx);
194 #define REG(r,gs,m) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs, m}
196 static struct gdb_register be_ppc_gdb_register_map[] = {
197 REG(Gpr0, 4),
198 REG(Gpr1, 4),
199 REG(Gpr2, 4),
200 REG(Gpr3, 4),
201 REG(Gpr4, 4),
202 REG(Gpr5, 4),
203 REG(Gpr6, 4),
204 REG(Gpr7, 4),
205 REG(Gpr8, 4),
206 REG(Gpr9, 4),
207 REG(Gpr10, 4),
208 REG(Gpr11, 4),
209 REG(Gpr12, 4),
210 REG(Gpr13, 4),
211 REG(Gpr14, 4),
212 REG(Gpr15, 4),
213 REG(Gpr16, 4),
214 REG(Gpr17, 4),
215 REG(Gpr18, 4),
216 REG(Gpr19, 4),
217 REG(Gpr20, 4),
218 REG(Gpr21, 4),
219 REG(Gpr22, 4),
220 REG(Gpr23, 4),
221 REG(Gpr24, 4),
222 REG(Gpr25, 4),
223 REG(Gpr26, 4),
224 REG(Gpr27, 4),
225 REG(Gpr28, 4),
226 REG(Gpr29, 4),
227 REG(Gpr30, 4),
228 REG(Gpr31, 4),
229 REG(Fpr0, 4),
230 REG(Fpr1, 4),
231 REG(Fpr2, 4),
232 REG(Fpr3, 4),
233 REG(Fpr4, 4),
234 REG(Fpr5, 4),
235 REG(Fpr6, 4),
236 REG(Fpr7, 4),
237 REG(Fpr8, 4),
238 REG(Fpr9, 4),
239 REG(Fpr10, 4),
240 REG(Fpr11, 4),
241 REG(Fpr12, 4),
242 REG(Fpr13, 4),
243 REG(Fpr14, 4),
244 REG(Fpr15, 4),
245 REG(Fpr16, 4),
246 REG(Fpr17, 4),
247 REG(Fpr18, 4),
248 REG(Fpr19, 4),
249 REG(Fpr20, 4),
250 REG(Fpr21, 4),
251 REG(Fpr22, 4),
252 REG(Fpr23, 4),
253 REG(Fpr24, 4),
254 REG(Fpr25, 4),
255 REG(Fpr26, 4),
256 REG(Fpr27, 4),
257 REG(Fpr28, 4),
258 REG(Fpr29, 4),
259 REG(Fpr30, 4),
260 REG(Fpr31, 4),
262 REG(Iar, 4),
263 REG(Msr, 4),
264 REG(Cr, 4),
265 REG(Lr, 4),
266 REG(Ctr, 4),
267 REG(Xer, 4),
268 /* FIXME: MQ is missing? FIELD_OFFSET(CONTEXT, Mq), */
269 /* see gdb/nlm/ppc.c */
272 struct backend_cpu be_ppc =
274 IMAGE_FILE_MACHINE_POWERPC,
276 be_cpu_linearize,
277 be_cpu_build_addr,
278 be_ppc_get_addr,
279 be_ppc_get_register_info,
280 be_ppc_single_step,
281 be_ppc_print_context,
282 be_ppc_print_segment_info,
283 be_ppc_ctx,
284 be_ppc_is_step_over_insn,
285 be_ppc_is_function_return,
286 be_ppc_is_break_insn,
287 be_ppc_is_func_call,
288 be_ppc_is_jump,
289 be_ppc_disasm_one_insn,
290 be_ppc_insert_Xpoint,
291 be_ppc_remove_Xpoint,
292 be_ppc_is_watchpoint_set,
293 be_ppc_clear_watchpoint,
294 be_ppc_adjust_pc_for_break,
295 be_ppc_fetch_integer,
296 be_ppc_fetch_float,
297 be_ppc_store_integer,
298 be_ppc_get_context,
299 be_ppc_set_context,
300 be_ppc_gdb_register_map,
301 ARRAY_SIZE(be_ppc_gdb_register_map),
303 #endif