* Alpha Assmebly question: LDQ_U r31_zero,0(r30_sp) showing up?!
@ 1994-01-17 5:22 Adam Sah
1994-01-18 3:20 ` Philippe Pouliquen
1994-01-19 20:46 ` Joseph Martin
0 siblings, 2 replies; 4+ messages in thread
From: Adam Sah @ 1994-01-17 5:22 UTC (permalink / raw)
What does the following alpha assembly instruction _do_?
LDQ_U r31_zero,0(r30_sp)
According to the manual, it reads the memory address out of stack pointer,
masking over misalignment, and drops it off in the bit bucket, without
changing r30_sp.
In other words, nothing.
And yet, I see this pop up all the time when I examine code output from the
C compiler, both gcc as well as native cc.
What am I missing?
--
Thanks again,
-A.Sah'94 ...Adam Sah...asah@cs.Berkeley.EDU...
Only ask yourself questions that you can find answers to.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Alpha Assmebly question: LDQ_U r31_zero,0(r30_sp) showing up?!
1994-01-17 5:22 Alpha Assmebly question: LDQ_U r31_zero,0(r30_sp) showing up?! Adam Sah
@ 1994-01-18 3:20 ` Philippe Pouliquen
1994-01-19 2:14 ` Jon Kay
1994-01-19 20:46 ` Joseph Martin
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Pouliquen @ 1994-01-18 3:20 UTC (permalink / raw)
In article <ASAH.94Jan16212209@ginsberg.cs.Berkeley.EDU> asah@cs.Berkeley.EDU (Adam Sah) writes:
>
>What does the following alpha assembly instruction _do_?
>
>LDQ_U r31_zero,0(r30_sp)
>
>According to the manual, it reads the memory address out of stack pointer,
> masking over misalignment, and drops it off in the bit bucket, without
> changing r30_sp.
>
>In other words, nothing.
>
>And yet, I see this pop up all the time when I examine code output from the
> C compiler, both gcc as well as native cc.
>
>What am I missing?
>
>
>--
>Thanks again,
>-A.Sah'94 ...Adam Sah...asah@cs.Berkeley.EDU...
> Only ask yourself questions that you can find answers to.
I don't know. :-)
But I do have a some guesses. The instruction may be an expensive NOP.
Or it could be some technique required to flush a buffer of some sort
on the CPU. Or it might be a way of testing the stack pointer to make
sure its valid (not pointing to 'invalid' space).
Consider the following:
- User program messes with the stack pointer.
- User program does a system call.
- Kernel uses user stack to get system call arguments and ends up making
the user program uid root (because the stack pointer pointed to where
the kernel stores the user programs uid in the user space.)
A quick test of the stack pointer before a system call would prevent
this. (However, if you coded things up in assembler, bypassing cc and
libc, you could get around it.)
As far as 'gcc' goes, it uses 'cc' to generate code for things that
'it doesn't already know how to do'. Therefore, 'gcc' might simply be
incorporating code produced by 'cc'.
Philippe Pouliquen
philippe@zeus.ece.jhu.edu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Alpha Assmebly question: LDQ_U r31_zero,0(r30_sp) showing up?!
1994-01-18 3:20 ` Philippe Pouliquen
@ 1994-01-19 2:14 ` Jon Kay
0 siblings, 0 replies; 4+ messages in thread
From: Jon Kay @ 1994-01-19 2:14 UTC (permalink / raw)
In article <2hfki4INNj0h@jhunix.hcf.jhu.edu> philippe@jhunix.hcf.jhu.edu (Philippe Pouliquen) writes:
>In article <ASAH.94Jan16212209@ginsberg.cs.Berkeley.EDU> asah@cs.Berkeley.EDU (Adam Sah) writes:
>>What does the following alpha assembly instruction _do_?
>>LDQ_U r31_zero,0(r30_sp)
>>According to the manual, it reads the memory address out of stack pointer,
>> masking over misalignment, and drops it off in the bit bucket, without
>> changing r30_sp. ... In other words, nothing.
>>And yet, I see this pop up all the time when I examine code output from the
>> C compiler, both gcc as well as native cc.
>>What am I missing?
>
>I don't know. :-)
>
>But I do have a some guesses. The instruction may be an expensive
>NOP. ...
My theory is that it's the "start fetching cache line" instruction.
Of course, you can fetch a cache line by loading to a normal register,
but then you get frozen due to interlocks when you actually try to use
the data that hasn't shown up yet. I don't guess there's much point
in putting interlocks on register zero.
Of course, I think this because I've spent the last several weeks
fervently wishing the MIPS R3000 had such an instruction (on the R3000
you get one load delay slot and then you freeze).
So how are things these days, Philippe?
Jon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Alpha Assmebly question: LDQ_U r31_zero,0(r30_sp) showing up?!
1994-01-17 5:22 Alpha Assmebly question: LDQ_U r31_zero,0(r30_sp) showing up?! Adam Sah
1994-01-18 3:20 ` Philippe Pouliquen
@ 1994-01-19 20:46 ` Joseph Martin
1 sibling, 0 replies; 4+ messages in thread
From: Joseph Martin @ 1994-01-19 20:46 UTC (permalink / raw)
The instruction in question is indeed a NOP. It's only special
attribute is that it a MEMORY NOP and can be issued in the same
cycle with an ALU instruction. If you look, you'll also find
ALU NOPS paired with true memory instructions.
\Joe [ Joseph A. Martin
jmartin@sousa.amt.ako.dec.com Digital Equipment Corporation
50 Nagog Park AKO2-1/G3
(508) 264-7891 Acton, MA 01720 U.S.A.
]
My opinions only, blah, blah...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1994-01-19 20:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-01-17 5:22 Alpha Assmebly question: LDQ_U r31_zero,0(r30_sp) showing up?! Adam Sah
1994-01-18 3:20 ` Philippe Pouliquen
1994-01-19 2:14 ` Jon Kay
1994-01-19 20:46 ` Joseph Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox