audio: add af_lavrresample, remove old resampling filters
[mplayer.git] / loader / wrapper.S
blobb0c83896d23f23da743f8659ea20663008e0873a
1 #include "config.h"
3 #define GLUE(a, b) a ## b
4 #define JOIN(a, b) GLUE(a, b)
5 #define EXTERN_ASM
6 #define MANGLE(s)  JOIN(EXTERN_ASM, s)
8 .data
9 .globl MANGLE(caller_return)
10 MANGLE(caller_return):
11         .long 0
12 .globl MANGLE(report_entry)
13 MANGLE(report_entry):
14         .long MANGLE(null_call)
15 .globl MANGLE(report_ret)
16 MANGLE(report_ret):
17         .long MANGLE(null_call)
18 .global MANGLE(wrapper_target)
19 MANGLE(wrapper_target):
20         .long MANGLE(null_call)
22 .text
23 .globl MANGLE(null_call)
24         .type MANGLE(null_call), @function
25         .balign 16,0x90
26 MANGLE(null_call):
27         ret
28 .globl MANGLE(wrapper)
29         .type MANGLE(wrapper), @function
30         .balign 16,0x90
31 MANGLE(wrapper):
32         pusha                   # store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI)
33         pushf                   # store flags
35         push %ebp               # set up a stack frame
36         movl %esp, %ebp
38         leal 4(%ebp), %eax      # push flags addr
39         push %eax
40         leal 8(%ebp), %eax      # push registers addr
41         push %eax
43         leal 40(%ebp), %edx
44         movl (%ebp), %eax
45         subl %edx, %eax
46         push %eax
47         push %edx
49         call *MANGLE(report_entry)      # report entry
51         test %eax, %eax
52         jnz .Ldone
54         leave                   # restore %esp, %ebp
55         popf                    # restore flags
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
63         .balign 16, 0x90
64 .Lwrapper_return:
65         pushl MANGLE(caller_return)     # restore the original return address
66         pusha                   # more for reference sake here
67         pushf
69         push %ebp               # set up a stack frame
70         movl %esp, %ebp
72         leal 4(%ebp), %eax      # push flags addr
73         push %eax
74         leal 8(%ebp), %eax      # push registers addr
75         push %eax
77         leal 40(%ebp), %edx     # push stack top address (relative to our entry)
78         movl (%ebp), %eax
79         subl %edx, %eax         # calculate difference between entry and previous frame
80         push %eax
81         push %edx
83         call *MANGLE(report_ret)        # report the return information (same args)
84 .Ldone:
86         leave
87         popf
88         popa
89         ret