Tuukka Toivonen wrote:
> I have made some functions in assembly and want to call them
> from C (or vice versa). I have already got it to work, however..
>
> What registers I should save and what registers are not needed
> to save? I have saved everything with 'pushad' but that's
> inefficient.
On x86, you don't need to save any registers; a function call is
assumed to corrupt all registers.
> Reading GCC info page:
>
> > GNU CC is normally configured to use the same function calling
> > convention normally in use on the target system.
>
> But GNU CC _defines_ what is the normally used calling convention.
No it doesn't (except on Linux, which basically `inherited' the Minix
calling convention, IIRC).
> So this is a recursive definition...
No it isnt'.
> This is about all what the info page says. And as I don't have
> GCC source and it's a bit big to download, I ask here.
>
> I'm using Linux 2.0.34, GCC 2.7.2 and x86 (Pentium).
The best way to learn to write functions in assembler is to write them
in C, then compile them to assembler with `gcc -S ...'.
--
Glynn Clements <[EMAIL PROTECTED]>