On 2/2/2017 10:50 AM, Paul Koning wrote:
On Feb 2,
2017, at 1:41 PM, Noel Chiappa <jnc at mercury.lcs.mit.edu> wrote:
From: Phil Blundell
I suspect it would probably not be all that hard to write some
sort of preprocessor to convert such code
Really? Check out:
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/sys/ken/pipe.c
(Needless to say, none of the 'int *' things are actually pointers to
integers!)
In particular, what will lines like this:
sleep(ip+2, PPIPE);
do, depending on what 'ip' is declared as?
If "ip" is an int *,
it would pass the address in ip plus 2 * 2. If ip is actually the address of some struct,
then hopefully that address offset by 4 is a meaningful address. I'm guessing that
the 2 in there represents sizeof(foo)/sizeof(int). Right?
paul
The listings I've read of early unix have assembly files, mixed c +
assembly, and in this case ip is
register *ip;
so things get to be quite a lot of fun. BTW I recall seeing assembly in
the compiler phases as well as the system code, so things require a lot
of the code between the assembly interface and the C to line up. Not
sure if gcc does that, or if the conventions between early unix and gcc
would line up or not.
There are also wake calls as well with ip+1 as a parameter, FWIW. I've
not gone hunting to what those calls do. I'd need to read the sleep and
wake code, which may be assembly. More useful parts of the puzzle to know.
thanks
Jim