[TUHS] as(1) on Ultrix-11 vs 2.11BSD

Jacob Ritorto jacob.ritorto at gmail.com
Wed Apr 29 10:17:54 AEST 2020


On Tue, Apr 28, 2020 at 9:03 AM Ronald Natalie <ron at ronnatalie.com> wrote:

> Yes, you aren’t programming 2.11 BSD correctly.
>

Wow, I'd hoped it was that.  Thank you so much!  I spent way too much time
fiddling incorrectly.
Was an example I'd cobbled together from my college textbook I've been
going back through, _Assembly_Language_for_the_PDP-11_RT-RSX-UNIX_ (c)1981
Kapps and Stafford.  We didn't have UNIX for the class so never ran into
this.


> Your examples are the older UNIX syscalls (your programs work correctly in
> Version 6 by the way as well).
>
> In 2.11 BSD, all the arguments for the syscalls are inline (i.e., none are
> passed in registers.   This appears to be the beginnings of making the
> kernel protable across architectures.
> The systent table no longer has separate fields for args in registers and
> not in registers and the code in sys/pdp/trap.c doesn’t look at the
> registers anymore.
>

I wonder if the differences are written up somewhere.  I did try to look
for more documentation but came up short.  Must've been quite
well-ingrained in programmers' minds in the day.


> Proper code now should be:
>           sys 4
>          1
>          a
>          6
>         sys 1
>         0
> Note your previous code used to just return 6 from the program (the return
> value of write).
>

Ah, so passing exit code as an arg to sys 1.  Cool.  Thanks again!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200428/f10cd57e/attachment.html>


More information about the TUHS mailing list