Commit a208e54a2f97494ccb5f7ba0b852cc1e308ab668
1 parent
663715fb
TCG op size estimation fix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4154 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
10 additions
and
0 deletions
exec-all.h
... | ... | @@ -36,6 +36,12 @@ struct TranslationBlock; |
36 | 36 | #define OPC_BUF_SIZE 512 |
37 | 37 | #define OPC_MAX_SIZE (OPC_BUF_SIZE - MAX_OP_PER_INSTR) |
38 | 38 | |
39 | +/* Maximum size a TCG op can expand to. This is complicated because a | |
40 | + single op may require several host instructions and regirster reloads. | |
41 | + For now take a wild guess at 128 bytes, which should allow at least | |
42 | + a couple of fixup instructions per argument. */ | |
43 | +#define TCG_MAX_OP_SIZE 128 | |
44 | + | |
39 | 45 | #define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM) |
40 | 46 | |
41 | 47 | extern target_ulong gen_opc_pc[OPC_BUF_SIZE]; | ... | ... |
exec.c
... | ... | @@ -367,6 +367,9 @@ void tb_flush(CPUState *env1) |
367 | 367 | nb_tbs, nb_tbs > 0 ? |
368 | 368 | ((unsigned long)(code_gen_ptr - code_gen_buffer)) / nb_tbs : 0); |
369 | 369 | #endif |
370 | + if ((unsigned long)(code_gen_ptr - code_gen_buffer) > CODE_GEN_BUFFER_SIZE) | |
371 | + cpu_abort(env1, "Internal error: code buffer overflow\n"); | |
372 | + | |
370 | 373 | nb_tbs = 0; |
371 | 374 | |
372 | 375 | for(env = first_cpu; env != NULL; env = env->next_cpu) { | ... | ... |
translate-all.c