[fpc-devel] progress of freepascal for mips

Fuxin Zhang zhangfx at lemote.com
Fri Jun 8 11:06:28 CEST 2012


> Hi Fuxin,
>
>   I committed to trunk your changes together with
> a few changes to cpupara that allow me to generate
> a compiler (not yet operational, but it"s going forward).
> Florian asked be to commit it.
Thank you for your work, then I will start based on the trunk.
>
>   It is not closely following a specific abi, but for parameters
> it works like this:
>   Up to 6 parameters are passed in registers $r4 to $r9,
> others on the stack starting at offset 24 (=6*4).
> (I had to adapt the 6 parameter very of linux/mips/syscall.inc
> in order to get fpmmap to work).
Yes, I did the same work to make some tests work.
>
>   The startup code of the function pushes these registers
> back to the 6 4 byte slots from 0 to 24.
>   It sets $fp register ($r29 or $s8)
> to the previous value of the $sp stack register.
>   This way, function parameters can be accessed by
> offsets to $fp register, while locals or parameters
> of function that will be called inside the function
> are accessed via $sp register.
Understand.
>
>   The biggest problem now is that GDB is not
> pleased this, because it find that there is a frame register ($r29)
> so that it computes falsely the address of all locals and arguments...
We have to study how GDB analysis mips stack, up to now I use gdb only
with instruction level debugging: break *0x4001da, si, info registers
etc.:)
But I think it won't be hard. I have looked at lots of c compiler's
code,we are not very far away from it.
>
>   I think that we should add a list of all mips known ABI and
> create a record that lists their specificities,
>   This way, we should be able to convert some constants
> into ABI specific values.
In the real world the MIPS O32 abi is still a de facto ABI. N32/N64
support is still not very robust for linux/mips. So I think we should
first add the support of O32. My new code is almost O32 compatible and I
will upload it as soon as possible.

What do you mean by stating 'create a record that lists their
specificities'? Is it that we create a readme file for mips ABI and upload
it to the repository? There is an old ABI document for O32 called "System
V APPLICATION BINARY INTERFACE MIPS RISC Processor supplement", you can
get it from http://www.lemote.com/upfiles/mipsabi32.pdf.

Regards


>
> Pierre
>
>
>
>
>





More information about the fpc-devel mailing list