Changeset 1455 in svn for trunk/processor/foot.m4


Ignore:
Timestamp:
2013-11-08T10:30:06+01:00 (20 months ago)
Author:
Xuefer
Message:

relocate: update proto to like memcpy/store/restore, update test code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/foot.m4

    r1453 r1455  
    137137dnl }}}
    138138define(`DEFINE_RELOCATE_API', `
    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
     139/* src = readable element, before memcpy if any
     140 * dst = writable element, after memcpy if any
     141 * virtual_src = brother pointers relatived to this address, before relocation
     142 * virtual_dst = brother pointers relatived to this address, after  relocation
    143143 */
    144 EXPORTED_FUNCTION(`void xc_processor_relocate_$1($1 *old_src, $1 *virtual_old_src, $1 *new_src, $1 *virtual_new_src TSRMLS_DC)') dnl {{{
     144EXPORTED_FUNCTION(`void xc_processor_relocate_$1($1 *dst, $1 *virtual_dst, $1 *src, $1 *virtual_src TSRMLS_DC)') dnl {{{
    145145{
    146146    char *old_address = 0; /* unkown X used later */
    147     ptrdiff_t offset = ptrsub(old_address, (ptrdiff_t) virtual_old_src);
     147    ptrdiff_t offset = ptrsub(old_address, (ptrdiff_t) virtual_src);
    148148
    149149    /* diff to new_ptr */
    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);
     150    ptrdiff_t ptrdiff = ptrsub(dst, src);
     151    ptrdiff_t relocatediff = (ptrdiff_t) ptradd($1 *, virtual_dst, offset);
     152    assert(ptradd($1 *, src, ptrdiff) == dst);
    153153
    154     xc_relocate_$1(new_src, ptrdiff, relocatediff TSRMLS_CC);
     154    xc_relocate_$1(dst, ptrdiff, relocatediff TSRMLS_CC);
    155155}
    156156dnl }}}
Note: See TracChangeset for help on using the changeset viewer.