[MPlayer-dev-eng] OT: loader/stubs.s:EH_prolog convertion to C
Michael Niedermayer
michaelni at gmx.at
Wed Oct 23 21:05:41 CEST 2002
Hi
On Wednesday 23 October 2002 20:47, Alex Beregszaszi wrote:
> Hi,
>
> i've converted it into C using gcc __asm__, but I got some questions:
[...]
> thats not working, so i disassembled the objects: gcc is putting its own
> function-frame codes (altought my functions isn't defining any parameters)
> (note: i removed "esp", "ebp", but no sense)
>
> pushl %ebp
> mov %esp, %ebp
> ... (my code)
> mov %ebp, %esp
> pop %ebp
> ret
>
> so i did a hack, and it's now working:
> pushl %ebp
> mov %esp, %ebp
>
> popl %ebp
> ... (my code) + ret
> mov %ebp, %esp
> pop %ebp
> ret
>
> It's working for me (tm). Are there any better solutions?
yes
try something like
asm volatile(
"jmp 9f \n\t"
"0: \n\t"
(my code) + ret
"9: \n\t"
"leal 0b, %0 \n\t"
: "=r" (func_ptr)
);
Michael
More information about the MPlayer-dev-eng
mailing list