linux-mips
[Top] [All Lists]

Re: Setting gp on pic code

To: Brett Foster <fosterb@uoguelph.ca>
Subject: Re: Setting gp on pic code
From: Alex Gonzalez <langabe@gmail.com>
Date: Mon, 16 Jan 2006 17:09:14 +0000
Cc: linux-mips <linux-mips@linux-mips.org>
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Z7otpLGytPGl7nad/q1/Sqf/1Ryj/EcJv72QuRon9900XlqUeLFKNXGCpKFFAcBk4bj+KJBcrmomSZytY0Jew3vx3Bly20t9PWN3Uy+Z+eq2wB1DH3p1FoJ2OkxJTxn32zwl4KKXoYWTRn6hL5O8jGLSPqEPx5fjaqdpt81/iaY=
In-reply-to: <43CB8D89.6070308@uoguelph.ca>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <c58a7a270601160204h41e5dca7pa9c26578b6b29f6f@mail.gmail.com> <43CB8D89.6070308@uoguelph.ca>
Sender: linux-mips-bounce@linux-mips.org
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@uoguelph.ca> 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)
>

<Prev in Thread] Current Thread [Next in Thread>