Revision 623e265c tcg/tcg.c

b/tcg/tcg.c
97 97

  
98 98
    l = &s->labels[label_index];
99 99
    if (l->has_value) {
100
        /* FIXME: This is wrong.  We can not resolve the relocation
101
           immediately because the caller has not yet written the
102
           initial value.  */
100
        /* FIXME: This may break relocations on RISC targets that
101
           modify instruction fields in place.  The caller may not have 
102
           written the initial value.  */
103 103
        patch_reloc(code_ptr, type, l->u.value + addend);
104 104
    } else {
105 105
        /* add a new relocation entry */
......
1810 1810
    return s->code_ptr -  gen_code_buf;
1811 1811
}
1812 1812

  
1813
static uint8_t *dummy_code_buf;
1814

  
1815 1813
/* Return the index of the micro operation such as the pc after is <
1816
   offset bytes from the start of the TB.
1817
   We have to use a dummy code buffer here to avoid clobbering the
1818
   oringinal code.  Because we terminate code generation part way through
1819
   we can end up with unresolved relocations.  Return -1 if not found. */
1820
int dyngen_code_search_pc(TCGContext *s, long offset)
1814
   offset bytes from the start of the TB.  The contents of gen_code_buf must
1815
   not be changed, though writing the same values is ok.
1816
   Return -1 if not found. */
1817
int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
1821 1818
{
1822
    if (!dummy_code_buf)
1823
        dummy_code_buf = qemu_malloc(code_gen_max_block_size());
1824
    return tcg_gen_code_common(s, dummy_code_buf, offset);
1819
    return tcg_gen_code_common(s, gen_code_buf, offset);
1825 1820
}

Also available in: Unified diff