[patch 19/36][mips] Hookize static chain and trampoline macros

Richard Sandiford rdsandiford@googlemail.com
Tue Sep 22 18:19:00 GMT 2009


Richard Henderson <rth@redhat.com> writes:
> Your trampoline can be greatly simplified for N32 and N64 abis.  Recall 
> that the current address is passed in via $25.  Which simplifies your 
> trampoline to e.g.
>
> 	lw	$1,20($25)
> 	lw	$25,16($25)
> 	jr	$25
> 	 nop

Ah, good point.

FTR, this is a "hosted" vs. "freestanding" thing really.  Non-abicalls
o32, n32 and n64 all use arbitrary pointers while the abicalls versions
all use $25.  Same goes for VxWorks kernel mode vs. RTP mode.  Maybe the
worry was that it wasn't worth complicating things, but...

> And why emit raw integers to the template?  It just makes things a bit 
> confusing in my opinion.  Integers are of course acceptable if you're 
> not going to use a template...

...that's an excellent question.  I've no idea.

Using asm would certainly make it easier to handle the $25/not-$25 and
pointer size differences.  (As will having it all in mips.c, so thanks
for that.)  I'll give it a go.

Richard



More information about the Gcc-patches mailing list