config/mips/trampolines.c on SGI

Godmar Back gback at cs.utah.edu
Fri Oct 29 09:07:52 PDT 1999


> 
> 
> 
> Essentially, you need to ensure that
> the jalr $25 below calls (jumps with lr) soft_fixup_trampoline, which
> is a symbol in the text segment.
> 
> Upon entry $25 points to mips_do_fixup_trampoline.  lw $25, -4($25)
> loads the address of soft_fixup_trampoline in $25 to which jalr $25
> then jumps. This is so because it is stored in the text segment right
> before mips_do_fixup_trampoline.
> 
> Now if your assembler doesn't like words in the text segment,
> it seems like doing something like:
> 
>      lui $25,soft_fixup_trampoline(high)
>      ori $25,$25,soft_fixup_trampoline(low)
>      jalr $25
> or
>      lui $25,high(soft_fixup_trampoline)
>      ori $25,$25,low(soft_fixup_trampoline)
>      jalr $25
> 

No, nevermind.  This doesn't work.  The linker wouldn't resolve it.

However, the following compiles for me:

        .ent mips_do_fixup_tramp
.data
.extern soft_fixup_trampoline
l1:
        .word soft_fixup_trampoline
.text
.align 4
mips_do_fixup_tramp:
        lw $25, l1
        lw $25, 0($25)
        jalr $25
        .end mips_do_fixup_tramp

This may work.
Tim or Peter would know better.  Tim did the MIPS port, AFAIK.

	- Godmar



More information about the kaffe mailing list