[fpc-pascal] issue when enabling -O2
Karoly Balogh (Charlie/SGR)
charlie at scenergy.dfmk.hu
Wed Jan 10 18:03:42 CET 2018
On Wed, 10 Jan 2018, Matias Vara wrote:
> Thank you very much Karol, I completly missed this point during the
> development of my kernel (Or maybe I had in mind sometime ago but I
> forgot it)It was only when I decided to play with -02 that all these
> issues arrised.
BTW, your code (as shown by the parameter passing in your assembler dumps)
seems to use the Microsoft x64 calling convention, which declares RSI
value as callee-saved, and then your code overwrites that without saving.
So the fact that your code overwrites it, could be the culprit. (And then
the OUTSD instruction also increases RSI by 4, so even if that MOV
wouldn't be there, you'd still need to save it.)
Also note that the 64bit x86-64 ABI is very different between Linux and
Windows, for example.
BTW, developing a kernel in Pascal is cool... ;)
More information about the fpc-pascal