Re: Setting gp on pic code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, that works.

Just for completeness, it needed to be addiu instead of ori as follows:

    lui     $28,%HI(_gp)
    addiu   $28,%LO(_gp)

because %LO is a signed 16 bit number.

Alex

On 1/16/06, Brett Foster <fosterb@xxxxxxxxxxx> wrote:
> Alex Gonzalez wrote:
>
> >Hi,
> >
> >I am trying to set the gp register on pic code as follows:
> >
> >"la gp,_gp"
> >
> >Disassembling the resulting code,
> >
> >"lw gp,0(gp)"
> >
> >
> Yes, this is normal... Use the following to set up the GP:
>         //init GP
>         lui     gp,%HI(_gp)
>         ori     gp,%LO(_gp)
>


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux