jacob said:
Chris Dollin a écrit :
Excuse me but:
<quote>
3.2.1 The stack pointer, SP or R13
Register R13 is used as a stack pointer and is also known as the
SP register
<end quote>
ARM Architecture: Chapter 3. Page 26
Now you tell me that C doesn't use register R13?
Of /course/ I'm not telling you that; read the message I wrote.
I'm telling you that a particular ARM C implementation doesn't
blindly use R13 as a stack pointer in the usual sense as "there's
a contiguous region of store indexed by SP and that's the stack."
It /could/ use R7 instead, if it chose, and use SP to hold function
results. While such a choice might be ... questionable ..., the
fact that it's /possible/ suggests to me that strong assertions
about "SP" and "hardware stack" are ... also questionable.
Please, we have had this discussion a thousand times. You are confusing
passing arguments in some registers with absence of a stack.
No, I'm not. The two issues are of course /related/. /You/ are
confusing convention with hardware [there's nothing that
SP does that R1 cannot do, /apart from/ SP being shadowed; the
use of SP as a "stack pointer" is a software convention that
a user-space application is free not to follow at its own
[in]convenience.
The ARM C stack is /not contiguous/; it's a linked list of
stack chunks. Keith's message contrasted:
with
|> The other is a data structure with last-in first-out (LIFO) behavior.
|> This kind of stack can be implemented in a variety of ways: as a
|> contiguous array, as a linked list, or as organized flocks of carrier
|> pigeons.
Your
]> I would like that you provide an example. I strongly believe that
]> you have none, or some dead system decades ago.
I read as providing an example of a C implementation that doesn't
use Keith's first meaning. I provided one.
Are you saying that (a) that's not what you were asking or (b) that
my example satisfies Keith's /first/ meaning?
This is called "passing arguments in the registers".
Which is /not/ "passing arguments on the stack".
This is done
by lcc-win in all 64 bit x86 targets and in the power PC version.
You are confusing this calling convention with the absence of a
stack.
I note you haven't commented on the /stack-free/ definition of
`inc`. Not all C functions need the stack, hardware or otherwise.
System 360 was developed last century in the sixties. Great example of
a CURRENT architecture.
Wikipedia ... 360 ... 370 ... 390 ...
In 2000, the System/390 was replaced by the zSeries. The zSeries
mainframes introduced the 64-bit z/Architecture, the most significant
design improvement since the 31-bit transition. All have retained
essential backward compatibility with the original S/360 architecture
and instruction set.
I stress that last sentence. I'm /assuming/ that "essential backward
compatability" means that there isn't additional special support in
user-space for "a hardware stack".
And anyway, you are wrong. Mainframes also have a stack obviously.
There's nothing in the least obvious about it [1] if what you mean is
Keith's first meaning. If it's Keith's /second/ meaning, ie some
LIFO-organised store, well duh, for some applications I'm sure
they do: stacks are useful, especially for nested procedure calls.
But /special hardware support/ for a contiguous stack with a dedicated
register isn't a requirement, even if it would be useful.
[1] Independantly of whether it's true.
--
"Is there a reason this is written in iambic pentameter?" Marten,
/Questionable Content/
Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England