[fpc-devel] Porting FPC to a new architecture

Michael Schnell mschnell at lumino.de
Thu Nov 19 15:18:08 CET 2009


Felipe Monteiro de Carvalho wrote:
> 
> What operating system will you be targetting?

Linux

> 
> I think that telling FPC which ASM instructions to use should be quite
> easy, the main problem should be getting a grip in the binutils, how
> to link libraries and all other stuff that comes with it.

Yep: the ABI of the architecture. This is defined with the C compiler.
We of course would need take care of this.

> 
> Luckly linux-mipsel has standard GNU binutils, but I don't know about NIOS2
> 

Of course NIOS/Linux uses the standard GNU binutils, as well.
But even with the standard GNU binutils, the ABI perhaps is different
between MIPS32 and NIOS. I could search for the complete appropriate
paper if you are interested. Here some stuff I just remember:

R00      always is 0
R01      used by Assembler for optimization (don't use)
R02      Function Return Value (least significant 32 Bits) (Not used by
Compiler)
R03      Function Return Value (most significant 32 Bits)
R04      Function Argument (First 32 Bits)
R05      Function Argument (Second 32 Bits)
R06      Function Argument (Third 32 Bits)
R07      Function Argument (Fourth 32 Bits)
R08..R15 Caller Saved General Purpose
R16..R22 Callee-Saved General Purpose
R23      Pointer to Thread Local Storage ("ThreadVar")
R24      Exception Temporary (Not used by Compiler)
R25      Break Temporary (Not used by Compiler)
R26      Global Pointer
R27      Stack Pointer
R28      Frame Pointer
R29      Exception Return Address (Not used by Compiler)
R30      Break Return Address (Not used by Compiler)
R31      Function Return Address




More information about the fpc-devel mailing list