dwrite: Implement GetWeight() for IDWriteFont.
[wine] / programs / winedbg / be_ppc.c
1 /*
2  * Debugger Power PC specific functions
3  *
4  * Copyright 2000-2003 Marcus Meissner
5  *                2004 Eric Pouech
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #include "debugger.h"
23
24 #if defined(__powerpc__)
25
26 static unsigned be_ppc_get_addr(HANDLE hThread, const CONTEXT* ctx, 
27                                 enum be_cpu_addr bca, ADDRESS64* addr)
28 {
29     switch (bca)
30     {
31     case be_cpu_addr_pc:
32         return be_cpu_build_addr(hThread, ctx, addr, 0, ctx->Iar);
33     default:
34     case be_cpu_addr_stack:
35     case be_cpu_addr_frame:
36         dbg_printf("not done\n");
37     }
38     return FALSE;
39 }
40
41 static unsigned be_ppc_get_register_info(int regno, enum be_cpu_addr* kind)
42 {
43     dbg_printf("not done\n");
44     return FALSE;
45 }
46
47 static void be_ppc_single_step(CONTEXT* ctx, unsigned enable)
48 {
49 #ifndef MSR_SE
50 # define MSR_SE (1<<10)
51 #endif 
52     if (enable) ctx->Msr |= MSR_SE;
53     else ctx->Msr &= ~MSR_SE;
54 }
55
56 static void be_ppc_print_context(HANDLE hThread, const CONTEXT* ctx, int all_regs)
57 {
58     dbg_printf("Context printing for PPC not done yet\n");
59 }
60
61 static void be_ppc_print_segment_info(HANDLE hThread, const CONTEXT* ctx)
62 {
63 }
64
65 static struct dbg_internal_var be_ppc_ctx[] =
66 {
67     {0,                 NULL,           0,                                      dbg_itype_none}
68 };
69
70 static unsigned be_ppc_is_step_over_insn(const void* insn)
71 {
72     dbg_printf("not done\n");
73     return FALSE;
74 }
75
76 static unsigned be_ppc_is_function_return(const void* insn)
77 {
78     dbg_printf("not done\n");
79     return FALSE;
80 }
81
82 static unsigned be_ppc_is_break_insn(const void* insn)
83 {
84     dbg_printf("not done\n");
85     return FALSE;
86 }
87
88 static unsigned be_ppc_is_func_call(const void* insn, ADDRESS64* callee)
89 {
90     return FALSE;
91 }
92
93 static unsigned be_ppc_is_jump(const void* insn, ADDRESS64* jumpee)
94 {
95     return FALSE;
96 }
97
98 static void be_ppc_disasm_one_insn(ADDRESS64* addr, int display)
99
100 {
101     dbg_printf("Disasm NIY\n");
102 }
103
104 static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
105                                      CONTEXT* ctx, enum be_xpoint_type type,
106                                      void* addr, unsigned long* val, unsigned size)
107 {
108     unsigned long       xbp;
109     SIZE_T              sz;
110
111     switch (type)
112     {
113     case be_xpoint_break:
114         if (!size) return 0;
115         if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return 0;
116         xbp = 0x7d821008; /* 7d 82 10 08 ... in big endian */
117         if (!pio->write(hProcess, addr, &xbp, 4, &sz) || sz != 4) return 0;
118         break;
119     default:
120         dbg_printf("Unknown/unsupported bp type %c\n", type);
121         return 0;
122     }
123     return 1;
124 }
125
126 static unsigned be_ppc_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
127                                      CONTEXT* ctx, enum be_xpoint_type type,
128                                      void* addr, unsigned long val, unsigned size)
129 {
130     SIZE_T              sz;
131
132     switch (type)
133     {
134     case be_xpoint_break:
135         if (!size) return 0;
136         if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return 0;
137         break;
138     default:
139         dbg_printf("Unknown/unsupported bp type %c\n", type);
140         return 0;
141     }
142     return 1;
143 }
144
145 static unsigned be_ppc_is_watchpoint_set(const CONTEXT* ctx, unsigned idx)
146 {
147     dbg_printf("not done\n");
148     return FALSE;
149 }
150
151 static void be_ppc_clear_watchpoint(CONTEXT* ctx, unsigned idx)
152 {
153     dbg_printf("not done\n");
154 }
155
156 static int be_ppc_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
157 {
158     dbg_printf("not done\n");
159     return 0;
160 }
161
162 static int be_ppc_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
163                                 unsigned ext_sign, LONGLONG* ret)
164 {
165     dbg_printf("not done\n");
166     return FALSE;
167 }
168
169 static int be_ppc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, 
170                               long double* ret)
171 {
172     dbg_printf("not done\n");
173     return FALSE;
174 }
175
176 static int be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
177                                 unsigned is_signed, LONGLONG val)
178 {
179     dbg_printf("be_ppc_store_integer: not done\n");
180     return FALSE;
181 }
182
183 struct backend_cpu be_ppc =
184 {
185     IMAGE_FILE_MACHINE_POWERPC,
186     4,
187     be_cpu_linearize,
188     be_cpu_build_addr,
189     be_ppc_get_addr,
190     be_ppc_get_register_info,
191     be_ppc_single_step,
192     be_ppc_print_context,
193     be_ppc_print_segment_info,
194     be_ppc_ctx,
195     be_ppc_is_step_over_insn,
196     be_ppc_is_function_return,
197     be_ppc_is_break_insn,
198     be_ppc_is_func_call,
199     be_ppc_is_jump,
200     be_ppc_disasm_one_insn,
201     be_ppc_insert_Xpoint,
202     be_ppc_remove_Xpoint,
203     be_ppc_is_watchpoint_set,
204     be_ppc_clear_watchpoint,
205     be_ppc_adjust_pc_for_break,
206     be_ppc_fetch_integer,
207     be_ppc_fetch_float,
208     be_ppc_store_integer,
209 };
210 #endif