Re: how to realize long jump instruction in ia 64 assebly language?

James E Wilson <[email protected]> 16 Feb 2006 11:15:28 -0800
Newsgroups gmane.linux.redhat.ia64.general
Message-ID <[email protected]>
On Wed, 2006-02-15 at 18:08, ChenMingChun wrote:
> suppose the entry point of the mapped file is 0x200000000013ac90,the
> jump code
> i wrote is as follow:
>  asm("movl r1=0x200000000013ac90\n");
>  asm("mov b6=r1");
>  asm("br  b6");

"doesn't work" isn't descriptive enough.  Exactly what goes wrong?

Also, without a testcase that we can use to reproduce the problem, all
we can do is guess at what might be wrong.

You may need to add stop bits (;;) between the instructions.  Gcc will
normally do this for you, but since I don't have a testcase, I can't be
sure of what exactly you are doing.

You may have a problem with the gp register and/or a function
descriptor.  Are you sure the entry point is a code address?  Could it
possibly be a function descriptor instead?  If so, then you need to read
the code address and gp value from the function descriptor.  Even if it
is a code address, if this is a shared library that you have loaded,
then it probably has its own gp value that needs to be loaded into the
gp register.  This gp value would be in one of the elf header fields.

You can find info about function descriptors in the Itanium ABI docs,
which are available from the developer.intel.com web site.  See the ABI
manual, and the Software Conventions and Runtime Architecture Guide.