- Timestamp:
- 2013-11-08T09:30:06Z (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mod_cacher/xc_cacher.c
r1453 r1455 182 182 xc_entry_data_php_t *backup = malloc(stored_php->size); 183 183 fprintf(stderr, "%lu\n", stored_php->size); 184 memcpy(p, stored_php, stored_php->size);185 184 memcpy(backup, stored_php, stored_php->size); 186 xc_processor_relocate_xc_entry_data_php_t(stored_php, stored_php, p, 0 TSRMLS_CC); 187 assert(memcmp(stored_php, backup, stored_php->size) == 0); 188 189 memcpy(stored_php, p, p->size); 190 xc_processor_relocate_xc_entry_data_php_t(p, 0, stored_php, stored_php TSRMLS_CC); 185 186 { 187 memcpy(p, stored_php, stored_php->size); 188 xc_processor_relocate_xc_entry_data_php_t(p, p , stored_php, stored_php TSRMLS_CC); 189 assert(memcmp(stored_php, backup, stored_php->size) == 0); 190 191 memcpy(stored_php, p, p->size); 192 xc_processor_relocate_xc_entry_data_php_t(stored_php, stored_php, p, p TSRMLS_CC); 193 } 194 195 { 196 memcpy(p, stored_php, stored_php->size); 197 xc_processor_relocate_xc_entry_data_php_t(p, 0, stored_php, stored_php TSRMLS_CC); 198 assert(memcmp(stored_php, backup, stored_php->size) == 0); 199 200 memcpy(stored_php, p, p->size); 201 xc_processor_relocate_xc_entry_data_php_t(stored_php, stored_php, p, 0 TSRMLS_CC); 202 } 191 203 } 192 204 #endif -
trunk/processor/foot.m4
r1453 r1455 137 137 dnl }}} 138 138 define(`DEFINE_RELOCATE_API', ` 139 /* old_src = readable element, before memcpy if any140 * new_src= writable element, after memcpy if any141 * virtual_ old_src = brother pointers relatived to this address, before relocation142 * virtual_ new_src= brother pointers relatived to this address, after relocation139 /* 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 143 143 */ 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 {{{144 EXPORTED_FUNCTION(`void xc_processor_relocate_$1($1 *dst, $1 *virtual_dst, $1 *src, $1 *virtual_src TSRMLS_DC)') dnl {{{ 145 145 { 146 146 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); 148 148 149 149 /* 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); 153 153 154 xc_relocate_$1( new_src, ptrdiff, relocatediff TSRMLS_CC);154 xc_relocate_$1(dst, ptrdiff, relocatediff TSRMLS_CC); 155 155 } 156 156 dnl }}}
Note: See TracChangeset
for help on using the changeset viewer.