linux-mips
[Top] [All Lists]

Setting gp on pic code

To: linux-mips <linux-mips@linux-mips.org>
Subject: Setting gp on pic code
From: Alex Gonzalez <langabe@gmail.com>
Date: Mon, 16 Jan 2006 10:04:39 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=gtCIoGfHk6Ubj2h6fvo3EFsPLsc/vZEtodYZ+R3+sFegTSwL8w++jB24d+JpT5/U3fT8vKT1K1Mh2cuPtbd88Je4XJN1IgKAxYmEalwnAUGenLSnTBDgcQpYYFCM1BWdCX/nPD054TWJ5JyzdorBTX8vxohDASeM9NBj1Q1fwRs=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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)"

I am confused as to why it uses a gp-relative address instead of an
absolute address for _gp. How I am supposed to reset gp then?

A bit of background. I am working on a dual core chip, with each core
running independently. They both boot from the same startup code, then
the second core waits until the first one sets all the hardware and
loads a pic binary into a shared memory region.

The second core is then released and should reset gp and jump to the
new binary (which is compiled separately from the startup code).

This arrangement seems to work OK if the binary is compiled non-pic,
but for pic code  the gp register is not set to the correct value.

Any insight into this appreciated.

Thanks,
Alex

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