$OpenBSD: patch-loader_wrapper_S,v 1.2 2003/02/16 07:25:18 brad Exp $ --- loader/wrapper.S.orig Mon Nov 25 21:37:12 2002 +++ loader/wrapper.S Tue Jan 21 23:02:18 2003 @@ -1,27 +1,36 @@ +#include "../mangle.h" +#if defined(__OpenBSD__) && !defined(__ELF__) +.data +#else .section .data -.globl caller_return -caller_return: +#endif +.globl MANGLEA(caller_return) +MANGLEA(caller_return): .long 0 -.globl report_entry -report_entry: - .long null_call -.globl report_ret -report_ret: - .long null_call -.global wrapper_target -wrapper_target: - .long null_call - +.globl MANGLEA(report_entry) +MANGLEA(report_entry): + .long MANGLEA(null_call) +.globl MANGLEA(report_ret) +MANGLEA(report_ret): + .long MANGLEA(null_call) +.global MANGLEA(wrapper_target) +MANGLEA(wrapper_target): + .long MANGLEA(null_call) + +#if defined(__OpenBSD__) && !defined(__ELF__) +.text +#else .section .text -.globl null_call - .type null_call, @function +#endif +.globl MANGLEA(null_call) + .type MANGLEA(null_call), @function .balign 16,0x90 -null_call: +MANGLEA(null_call): ret -.globl wrapper - .type wrapper, @function +.globl MANGLEA(wrapper) + .type MANGLEA(wrapper), @function .balign 16,0x90 -wrapper: +MANGLEA(wrapper): pusha # store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI) pushf # store flags @@ -39,7 +48,7 @@ wrapper: push %eax push %edx - call *report_entry # report entry + call *MANGLEA(report_entry) # report entry test %eax, %eax jnz .Ldone @@ -48,14 +57,14 @@ wrapper: popf # restore flags popa # restore registers - popl caller_return # switch return addresses + popl MANGLEA(caller_return) # switch return addresses pushl $.Lwrapper_return - jmp *wrapper_target # wrapper_target should return at .Lwrapper_return + jmp *MANGLEA(wrapper_target) # wrapper_target should return at .Lwrapper_return .balign 16, 0x90 .Lwrapper_return: - pushl caller_return # restore the original return address + pushl MANGLEA(caller_return) # restore the original return address pusha # more for reference sake here pushf @@ -73,7 +82,7 @@ wrapper: push %eax push %edx - call *report_ret # report the return information (same args) + call *MANGLEA(report_ret) # report the return information (same args) .Ldone: leave