Hi,
Thank you for telling the review to me.
I want to write reply to his comment directly,
but the forum registration doesn't work for me at the moment.
Instead,I'll reply to his comment in the mail.
I assumed that he reviews later code( not "slow" version ) to write this one.
Firstly,what I'm aiming to port gpSP is working the promgram on A320
properly.
not priority on performance.
> >At the very least, m_jal need not be used for the branches to internal
subroutines.
if he is saying about PSP version, then he is right.
but not right for a320 and other linux stuff.
The gpSP for A320 is genereted as a PIC( position independent code).
there is a code before changes to use m_jal.
>from mips_update_gba in mips_stub.S
> > sw $0, CHANGED_PC_STATUS($16)
> > jal update_gba # process the next event
> > nop
gcc puts a warning like this.
> >mips_stub.S: Assembler messages:
> >mips_stub.S:372: Warning: No .cprestore pseudo-op used in PIC code
And this is the result.
> > 108: ae00007c sw zero,124(s0)
> > 10c: 8f990000 lw t9,0(gp)
> > 110: 0320f809 jalr t9
> > 114: 00000000 nop
it jumps out like the valley where I don't know.
because $gp save nowhere in the code.
but I didn't know this.
> >The $gp restore is also redundant given that save_registers
performs this and is used before any external calls in order to follow
proper ABI convention.
Indeed,he is made it like this and I didn't find this until I read the forum.
> > lw $28, GP_SAVE($16)
However, the problem is where the $gp is stored.
I can't find the part anywhere in orignal assembler code.
Let me know where is the part if anyone can
( the original assembler code mips_stub.S was dated May-23-2007, it might be updated after this)
> > The 16 byte stack allocation is also perplexing;
does the ABI seriously require this?
The stack was a problem for porting.
There is an example for ABI(calling conversion).
C code:
void test(int value)
{
if (value)
value = 5678;
}
Generated code:
00400760 <test>:
400760: 27bdfff8 addiu sp,sp,-8
400764: afbe0004 sw s8,4(sp)
400768: 03a0f021 move s8,sp
40076c: afc40008 sw a0,8(s8)
400770: 8fc20008 lw v0,8(s8)
400774: 00000000 nop
400778: 10400003 beqz v0,400788 <test+0x28>
40077c: 00000000 nop
400780: 2402162e li v0,5678
400784: afc20008 sw v0,8(s8)
400788: 03c0e821 move sp,s8
40078c: 8fbe0004 lw s8,4(sp)
400790: 27bd0008 addiu sp,sp,8
400794: 03e00008 jr ra
400798: 00000000 nop
The first line is added -8 to sp,
but after a few lines , the code stores word(4bytes) to the stack(sp + 8).
that means it is required some stack allocation before call the function.
Of course we need to understand the difference of psp-gcc and mipsel-linux-uclibc-gcc.
Anyway, thank you for telling me and sorry for this long my not proper English.
Regards,
--------
BouKiCHi