On Sun, 5 Jul 1998, Glynn Clements wrote:
>> 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.
I definitely think that is not correct; if I ignore the fact that
special registers like ESP have to be saved that leaves me EBP;
I didn't save EBP and the program crashed; I saved EBP and it worked.
Maybe you consider EBP special (frame pointer)? -fomit-frame-pointer
doesn't change the set of registers which have to be saved, does it?
What about FPU registers? Can I assume they're empty when entering
function?
>> 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).
Well, I was talking about Linux. It seems that the info page is so
old that it doesn't know Linux.
>The best way to learn to write functions in assembler is to write them
>in C, then compile them to assembler with `gcc -S ...'.
Well, I already can write them. It's just that I'm unsure if I do
it 'right', althought it works.
--
| Tuukka Toivonen <[EMAIL PROTECTED]> [PGP public key
| Homepage: http://www.ee.oulu.fi/~tuukkat/ available]
| Try also finger -l [EMAIL PROTECTED]
| Studying information engineering at the University of Oulu
+-----------------------------------------------------------