Revision 5fafdf24 translate-all.c
b/translate-all.c | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* Host code generation |
3 |
*
|
|
3 |
* |
|
4 | 4 |
* Copyright (c) 2003 Fabrice Bellard |
5 | 5 |
* |
6 | 6 |
* This library is free software; you can redistribute it and/or |
... | ... | |
89 | 89 |
for(;;) { |
90 | 90 |
c = *opc_ptr++; |
91 | 91 |
n = op_nb_args[c]; |
92 |
fprintf(logfile, "0x%04x: %s",
|
|
92 |
fprintf(logfile, "0x%04x: %s", |
|
93 | 93 |
(int)(opc_ptr - opc_buf - 1), op_str[c]); |
94 | 94 |
for(i = 0; i < n; i++) { |
95 | 95 |
fprintf(logfile, " 0x%x", opparam_ptr[i]); |
... | ... | |
110 | 110 |
uint8_t *gen_code_ptr; |
111 | 111 |
int c, i; |
112 | 112 |
unsigned long gen_code_addr[OPC_BUF_SIZE]; |
113 |
|
|
113 |
|
|
114 | 114 |
if (nb_gen_labels == 0) |
115 | 115 |
return; |
116 | 116 |
/* compute the address of each op code */ |
117 |
|
|
117 |
|
|
118 | 118 |
gen_code_ptr = gen_code_buf; |
119 | 119 |
i = 0; |
120 | 120 |
for(;;) { |
... | ... | |
125 | 125 |
gen_code_ptr += opc_copy_size[c]; |
126 | 126 |
i++; |
127 | 127 |
} |
128 |
|
|
128 |
|
|
129 | 129 |
/* compute the address of each label */ |
130 | 130 |
for(i = 0; i < nb_gen_labels; i++) { |
131 | 131 |
gen_labels[i] = gen_code_addr[gen_labels[i]]; |
... | ... | |
133 | 133 |
} |
134 | 134 |
|
135 | 135 |
/* return non zero if the very first instruction is invalid so that |
136 |
the virtual CPU can trigger an exception.
|
|
136 |
the virtual CPU can trigger an exception. |
|
137 | 137 |
|
138 | 138 |
'*gen_code_size_ptr' contains the size of the generated code (host |
139 | 139 |
code). |
... | ... | |
185 | 185 |
return 0; |
186 | 186 |
} |
187 | 187 |
|
188 |
/* The cpu state corresponding to 'searched_pc' is restored.
|
|
188 |
/* The cpu state corresponding to 'searched_pc' is restored. |
|
189 | 189 |
*/ |
190 |
int cpu_restore_state(TranslationBlock *tb,
|
|
190 |
int cpu_restore_state(TranslationBlock *tb, |
|
191 | 191 |
CPUState *env, unsigned long searched_pc, |
192 | 192 |
void *puc) |
193 | 193 |
{ |
... | ... | |
202 | 202 |
#endif |
203 | 203 |
if (gen_intermediate_code_pc(env, tb) < 0) |
204 | 204 |
return -1; |
205 |
|
|
205 |
|
|
206 | 206 |
/* find opc index corresponding to search_pc */ |
207 | 207 |
tc_ptr = (unsigned long)tb->tc_ptr; |
208 | 208 |
if (searched_pc < tc_ptr) |
... | ... | |
234 | 234 |
fprintf(logfile, "0x%04x: " TARGET_FMT_lx "\n", i, gen_opc_pc[i]); |
235 | 235 |
} |
236 | 236 |
} |
237 |
fprintf(logfile, "spc=0x%08lx j=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n",
|
|
238 |
searched_pc, j, gen_opc_pc[j] - tb->cs_base,
|
|
237 |
fprintf(logfile, "spc=0x%08lx j=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n", |
|
238 |
searched_pc, j, gen_opc_pc[j] - tb->cs_base, |
|
239 | 239 |
(uint32_t)tb->cs_base); |
240 | 240 |
} |
241 | 241 |
#endif |
... | ... | |
256 | 256 |
} else if (npc == 2) { |
257 | 257 |
target_ulong t2 = (target_ulong)puc; |
258 | 258 |
/* jump PC: use T2 and the jump targets of the translation */ |
259 |
if (t2)
|
|
259 |
if (t2) |
|
260 | 260 |
env->npc = gen_opc_jump_pc[0]; |
261 | 261 |
else |
262 | 262 |
env->npc = gen_opc_jump_pc[1]; |
... | ... | |
279 | 279 |
case INDEX_op_ ## op ## _user:\ |
280 | 280 |
case INDEX_op_ ## op ## _kernel |
281 | 281 |
#endif |
282 |
|
|
282 |
|
|
283 | 283 |
CASE3(stfd): |
284 | 284 |
CASE3(stfs): |
285 | 285 |
CASE3(lfd): |
Also available in: Unified diff