2 * Debugger Power PC specific functions
4 * Copyright 2000-2003 Marcus Meissner
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
24 #if defined(__powerpc__)
26 static unsigned be_ppc_get_addr(HANDLE hThread
, const CONTEXT
* ctx
,
27 enum be_cpu_addr bca
, ADDRESS64
* addr
)
32 return be_cpu_build_addr(hThread
, ctx
, addr
, 0, ctx
->Iar
);
34 case be_cpu_addr_stack
:
35 case be_cpu_addr_frame
:
36 dbg_printf("not done\n");
41 static unsigned be_ppc_get_register_info(int regno
, enum be_cpu_addr
* kind
)
43 dbg_printf("not done\n");
47 static void be_ppc_single_step(CONTEXT
* ctx
, unsigned enable
)
50 # define MSR_SE (1<<10)
52 if (enable
) ctx
->Msr
|= MSR_SE
;
53 else ctx
->Msr
&= ~MSR_SE
;
56 static void be_ppc_print_context(HANDLE hThread
, const CONTEXT
* 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 CONTEXT
* ctx
)
65 static struct dbg_internal_var be_ppc_ctx
[] =
67 {0, NULL
, 0, dbg_itype_none
}
70 static unsigned be_ppc_is_step_over_insn(const void* insn
)
72 dbg_printf("not done\n");
76 static unsigned be_ppc_is_function_return(const void* insn
)
78 dbg_printf("not done\n");
82 static unsigned be_ppc_is_break_insn(const void* insn
)
84 dbg_printf("not done\n");
88 static unsigned be_ppc_is_func_call(const void* insn
, ADDRESS64
* callee
)
93 static void be_ppc_disasm_one_insn(ADDRESS64
* addr
, int display
)
95 dbg_printf("Disasm NIY\n");
98 static unsigned be_ppc_insert_Xpoint(HANDLE hProcess
, const struct be_process_io
* pio
,
99 CONTEXT
* ctx
, enum be_xpoint_type type
,
100 void* addr
, unsigned long* val
, unsigned size
)
107 case be_xpoint_break
:
109 if (!pio
->read(hProcess
, addr
, val
, 4, &sz
) || sz
!= 4) return 0;
110 xbp
= 0x7d821008; /* 7d 82 10 08 ... in big endian */
111 if (!pio
->write(hProcess
, addr
, &xbp
, 4, &sz
) || sz
!= 4) return 0;
114 dbg_printf("Unknown/unsupported bp type %c\n", type
);
120 static unsigned be_ppc_remove_Xpoint(HANDLE hProcess
, const struct be_process_io
* pio
,
121 CONTEXT
* ctx
, enum be_xpoint_type type
,
122 void* addr
, unsigned long val
, unsigned size
)
128 case be_xpoint_break
:
130 if (!pio
->write(hProcess
, addr
, &val
, 4, &sz
) || sz
== 4) return 0;
133 dbg_printf("Unknown/unsupported bp type %c\n", type
);
139 static unsigned be_ppc_is_watchpoint_set(const CONTEXT
* ctx
, unsigned idx
)
141 dbg_printf("not done\n");
145 static void be_ppc_clear_watchpoint(CONTEXT
* ctx
, unsigned idx
)
147 dbg_printf("not done\n");
150 static int be_ppc_adjust_pc_for_break(CONTEXT
* ctx
, BOOL way
)
152 dbg_printf("not done\n");
156 static int be_ppc_fetch_integer(const struct dbg_lvalue
* lvalue
, unsigned size
,
157 unsigned ext_sign
, LONGLONG
* ret
)
159 dbg_printf("not done\n");
163 static int be_ppc_fetch_float(const struct dbg_lvalue
* lvalue
, unsigned size
,
166 dbg_printf("not done\n");
170 struct backend_cpu be_ppc
=
172 IMAGE_FILE_MACHINE_POWERPC
,
177 be_ppc_get_register_info
,
179 be_ppc_print_context
,
180 be_ppc_print_segment_info
,
182 be_ppc_is_step_over_insn
,
183 be_ppc_is_function_return
,
184 be_ppc_is_break_insn
,
186 be_ppc_disasm_one_insn
,
187 be_ppc_insert_Xpoint
,
188 be_ppc_remove_Xpoint
,
189 be_ppc_is_watchpoint_set
,
190 be_ppc_clear_watchpoint
,
191 be_ppc_adjust_pc_for_break
,
192 be_ppc_fetch_integer
,