The programmer's guide says in chapter 6.3 that when using "register" convention then it does not save any registers. A very old version of this document even said explicitly: "The registers are not saved when calling a function or procedure", this sentence is no longer in the programmer's guide but the table 6.3 still says "None" in the column "registers saved". I interpreted this as "when calling such a function or procedure it [the function] will not save any registers" or in other words If I write such a function myself I can do with eax, edx, ecx, ebx, edi, esi inside my function whatever I want and don't need to save and restore them, the caller is responsible.
But this does not seem to be true. It seems it will assume that at least certain registers are saved by the callee, ebx is one of them I found today by accident because the caller used it as the loop variable and I believe there are other registers too. Or is this "none" meant from the perspective of the callee and means that the *caller* will not save any registers *before* the call? IMHO this section of the manual is a bit vague or ambiguous and could be clarified. (btw. there is also something written about "GCC registers" without mentioning anywhere what a "GCC register" actually is) Is there maybe any other document somewhere that describes what *exactly* is expected by the compiler to happen with the registers during a function call or maybe somebody can show me where in the FPC sources I have to look to see for myself what exactly is going on? with exactly I also mean such little details like for example if a function returns QWord then it returns them in eax and edx but if it does only return a DWord then can I still use edx for other things and the caller will just ignore it or will it then be owned by the caller? And what if it is a procedure (no return value at all) who will then own eax? Bernd _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal