[fpc-devel] question about parameter loading code

Sergei Gorelkin sergei_gorelkin at mail.ru
Sun Jun 10 18:50:11 CEST 2012


10.06.2012 20:26, Florian Klämpfl пишет:
> Am 10.06.2012 08:15, schrieb Fuxin Zhang:
>> Dear sirs,
>>
>>    When trying to generate code debuggable by GDB, I meet a problem:
>>
>> * it seems mips C code will expect a frame pointer = sp after stack
>> adjustment
>> * but in cpupara.pas, when we create para info, we don't know yet the
>> whole stack size, thus the reference offset cannot be set correctly
>>
>
> This is exactly the point where I'am already stuck with MIPS for several
> days/weeks. I'am still no sure what's the best solution ...
>
As far as I can understand, basically the same problem stands in the way of implementing compliant 
stack frames for x86_64-win64. I was thinking about a having a virtual framepointer register. We'll 
need to:
  - keep a list of all assembler instructions that reference this virtual FP register
  - after final frame size becomes known, fixup these instructions to reference a real FP with 
adjusted offset. Or maybe not keep a separate list of instructions, but instead just iterate the 
entire procedure asmlist (because about every second instruction is subject to fixup).

Regards,
Sergei



More information about the fpc-devel mailing list