Ignore:
Timestamp:
2013-11-08T10:08:04+01:00 (10 months ago)
Author:
moo
Message:

update func prototype for relocate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/foot.m4

    r1452 r1453  
    137137dnl }}} 
    138138define(`DEFINE_RELOCATE_API', ` 
    139 EXPORTED_FUNCTION(`void xc_processor_relocate_$1($1 *old_src, $1 *old_start, $1 *new_src, $1 *new_start TSRMLS_DC)') dnl {{{ 
     139/* old_src = readable element, before memcpy if any 
     140 * new_src = writable element, after memcpy if any 
     141 * virtual_old_src = brother pointers relatived to this address, before relocation 
     142 * virtual_new_src = brother pointers relatived to this address, after  relocation 
     143 */ 
     144EXPORTED_FUNCTION(`void xc_processor_relocate_$1($1 *old_src, $1 *virtual_old_src, $1 *new_src, $1 *virtual_new_src TSRMLS_DC)') dnl {{{ 
    140145{ 
    141     ptrdiff_t offset_from_old_start = 0; /* unkown X used later */ 
    142     $1 *const old_address = ptradd($1 *, offset_from_old_start, (ptrdiff_t) old_start); 
    143     ptrdiff_t offset = ptrsub(old_address, old_src); 
    144     $1 *const new_address = ptradd($1 *, new_src, offset); 
     146    char *old_address = 0; /* unkown X used later */ 
     147    ptrdiff_t offset = ptrsub(old_address, (ptrdiff_t) virtual_old_src); 
    145148 
    146149    /* diff to new_ptr */ 
    147     ptrdiff_t ptrdiff = (ptrdiff_t) new_address; 
    148     ptrdiff_t relocatediff = (ptrdiff_t) ptradd($1 *, new_start, offset); 
    149     assert(new_src == ptradd($1 *, old_src, ptrdiff)); 
     150    ptrdiff_t ptrdiff = ptrsub(new_src, old_src); 
     151    ptrdiff_t relocatediff = (ptrdiff_t) ptradd($1 *, virtual_new_src, offset); 
     152    assert(ptradd($1 *, old_src, ptrdiff) == new_src); 
    150153 
    151154    xc_relocate_$1(new_src, ptrdiff, relocatediff TSRMLS_CC); 
Note: See TracChangeset for help on using the changeset viewer.