3 #define GLUE(a, b) a ## b
4 #define JOIN(a, b) GLUE(a, b)
6 #define MANGLE(s) JOIN(EXTERN_ASM, s)
9 .globl MANGLE(caller_return)
10 MANGLE(caller_return):
12 .globl MANGLE(report_entry)
14 .long MANGLE(null_call)
15 .globl MANGLE(report_ret)
17 .long MANGLE(null_call)
18 .global MANGLE(wrapper_target)
19 MANGLE(wrapper_target):
20 .long MANGLE(null_call)
23 .globl MANGLE(null_call)
24 .type MANGLE(null_call), @function
28 .globl MANGLE(wrapper)
29 .type MANGLE(wrapper), @function
32 pusha # store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI)
35 push %ebp # set up a stack frame
38 leal 4(%ebp), %eax # push flags addr
40 leal 8(%ebp), %eax # push registers addr
49 call *MANGLE(report_entry) # report entry
54 leave # restore %esp, %ebp
56 popa # restore registers
58 popl MANGLE(caller_return) # switch return addresses
59 pushl $.Lwrapper_return
61 jmp *MANGLE(wrapper_target) # wrapper_target should return at .Lwrapper_return
65 pushl MANGLE(caller_return) # restore the original return address
66 pusha # more for reference sake here
69 push %ebp # set up a stack frame
72 leal 4(%ebp), %eax # push flags addr
74 leal 8(%ebp), %eax # push registers addr
77 leal 40(%ebp), %edx # push stack top address (relative to our entry)
79 subl %edx, %eax # calculate difference between entry and previous frame
83 call *MANGLE(report_ret) # report the return information (same args)