Related articles |
---|
Alpha assembly language - ldah/lda after jsr tim.jones@mail.com (2003-10-08) |
Re: Alpha assembly language - ldah/lda after jsr gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-10-12) |
Re: Alpha assembly language - ldah/lda after jsr jvorbrueggen@mediasec.de (Jan C.=?iso-8859-1?Q?Vorbr=FCggen?=) (2003-10-12) |
Re: Alpha assembly language - ldah/lda after jsr firefly@diku.dk (Peter \Firefly\Lund) (2003-10-12) |
Re: Alpha assembly language - ldah/lda after jsr gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-10-13) |
Re: Alpha assembly language - ldah/lda after jsr gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-10-13) |
From: | "Peter \"Firefly\" Lund" <firefly@diku.dk> |
Newsgroups: | comp.compilers |
Date: | 12 Oct 2003 19:03:56 -0400 |
Organization: | Department of Computer Science, University of Copenhagen |
References: | 03-10-040 |
Keywords: | assembler |
Posted-Date: | 12 Oct 2003 19:03:56 EDT |
On Thu, 8 Oct 2003, Timothy Jones wrote:
> ldah/lda pair of instructions to load the $gp after a function call.
If it is assembler code /you/ write, then use the ldgp instruction
instead.
(it is not a good idea to disassemble alpha object code, fiddle with it,
and then reassemble it unless you know what you are doing)
ldgp is actually not a real instruction but a socalled pseudoinstruction
that expands at assembly-time to whatever the assembler deems necessary to
get the right value loaded into the global pointer register ($gp).
The really important part is that the address you specify must be the
address of the ldgp pseudoinstruction itself. You usually use a register
for that purpose, the return address register ($ra) seems particularly
handy right after a jsr, don't you think? ;)
> which is all very well but if I want to change the schedule slightly
> by adding a nop like this:
And then it obviously goes wrong because you use the address of the nop...
(or rather, an incorrect displacement relative to $ra, to get the address
to load $gp from, hence you get an incorrect $gp value)
> I've already been reading the Assembly Language
> Programmer's Guide without much luck.
Try again...
-Peter
"People seem to misinterpret complexity as sophistication." -- Niklaus Wirth
Return to the
comp.compilers page.
Search the
comp.compilers archives again.