3 #define GLUE(a, b) a ## b
4 #define JOIN(a, b) GLUE(a, b)
5 #define MANGLE(s) JOIN(EXTERN_ASM, s)
8 .globl MANGLE(caller_return)
11 .globl MANGLE(report_entry)
13 .long MANGLE(null_call)
14 .globl MANGLE(report_ret)
16 .long MANGLE(null_call)
17 .global MANGLE(wrapper_target)
18 MANGLE(wrapper_target):
19 .long MANGLE(null_call)
22 .globl MANGLE(null_call)
23 .type MANGLE(null_call), @function
27 .globl MANGLE(wrapper)
28 .type MANGLE(wrapper), @function
31 pusha # store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI)
34 push %ebp # set up a stack frame
37 leal 4(%ebp), %eax # push flags addr
39 leal 8(%ebp), %eax # push registers addr
48 call *MANGLE(report_entry) # report entry
53 leave # restore %esp, %ebp
55 popa # restore registers
57 popl MANGLE(caller_return) # switch return addresses
58 pushl $.Lwrapper_return
60 jmp *MANGLE(wrapper_target) # wrapper_target should return at .Lwrapper_return
64 pushl MANGLE(caller_return) # restore the original return address
65 pusha # more for reference sake here
68 push %ebp # set up a stack frame
71 leal 4(%ebp), %eax # push flags addr
73 leal 8(%ebp), %eax # push registers addr
76 leal 40(%ebp), %edx # push stack top address (relative to our entry)
78 subl %edx, %eax # calculate difference between entry and previous frame
82 call *MANGLE(report_ret) # report the return information (same args)