diff options
author | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-02-10 14:09:09 +0000 |
---|---|---|
committer | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-02-10 14:09:09 +0000 |
commit | 623e265c6b1ad09fccecaa53f8c8a1fd572c54c7 (patch) | |
tree | b9bd715c57787f5c40bd45fd7c18bec42cda86ee /tcg/tcg.c | |
parent | b2a5160c9f11cc5fe64230a6ec8f95e3aecfeacf (diff) |
Simplify TCG relocation bugfix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3974 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r-- | tcg/tcg.c | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -97,9 +97,9 @@ void tcg_out_reloc(TCGContext *s, uint8_t *code_ptr, int type, l = &s->labels[label_index]; if (l->has_value) { - /* FIXME: This is wrong. We can not resolve the relocation - immediately because the caller has not yet written the - initial value. */ + /* FIXME: This may break relocations on RISC targets that + modify instruction fields in place. The caller may not have + written the initial value. */ patch_reloc(code_ptr, type, l->u.value + addend); } else { /* add a new relocation entry */ @@ -1810,16 +1810,11 @@ int dyngen_code(TCGContext *s, uint8_t *gen_code_buf) return s->code_ptr - gen_code_buf; } -static uint8_t *dummy_code_buf; - /* Return the index of the micro operation such as the pc after is < - offset bytes from the start of the TB. - We have to use a dummy code buffer here to avoid clobbering the - oringinal code. Because we terminate code generation part way through - we can end up with unresolved relocations. Return -1 if not found. */ -int dyngen_code_search_pc(TCGContext *s, long offset) + offset bytes from the start of the TB. The contents of gen_code_buf must + not be changed, though writing the same values is ok. + Return -1 if not found. */ +int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset) { - if (!dummy_code_buf) - dummy_code_buf = qemu_malloc(code_gen_max_block_size()); - return tcg_gen_code_common(s, dummy_code_buf, offset); + return tcg_gen_code_common(s, gen_code_buf, offset); } |