ftp notes
Carl S. Gutekunst
csg at pyramid.pyramid.com
Sun Feb 5 13:26:12 AEST 1989
In article <9924 at tness7.UUCP> mechjgh at tness7.UUCP (Greg Hackney ) writes:
>> I have found what I think is the problem with the FTP user agent not
>> understanding the "binary" command. It turns out that the code is
>> _heavily_ dependent on the stack for argument passing - it uses a
>> dummy first argument as a pointer to the rest of the arguments in
>> variable-argument functions. This code breaks on the Pyramid.
Old bug. Talk to RTOC for a fix.
The actual "bug" here is amusing. You can do VAX-style argument-list traversal
on a Pyramid, if all the arguments are integral scalars or pointers, and you
have no more than 13 arguments. This is because the register stack is memory
addressable.
The problem is that the compiler grabs "unused" registers in the call-from
window (the 'P' registers) for scratch space. So, if the function in question
only declares one argument and tries to get the rest by traversal, you end up
getting compiler scratch values overwriting your argument list. If you simply
declare the function to have 13 arguments, then the compiler puts its scratch
variables in local 'L' registers, and the parameter list traversal works.
This was the fix I used for FTP. varargs was too much work. :-) (I *did* put
a warning in the sources and RCS comments about an "ugly non-portable hack.")
I noticed in OSx 5.0 that the compiler now puts scratch variables in the call-
to register window (the 'T' registers), which neatly avoids the problem. Some-
how, though, I don't think the compiler group quite had my kind of hacking in
mind when they made that change....
<csg>
More information about the Comp.sys.pyramid
mailing list