[TUHS] asm helper routines in v7

Warner Losh imp at bsdimp.com
Wed Jan 5 07:28:37 AEST 2022


On Tue, Jan 4, 2022 at 2:24 PM Will Senn <will.senn at gmail.com> wrote:

> On 1/4/22 3:12 PM, Dan Cross wrote:
>
> On Tue, Jan 4, 2022 at 3:38 PM Will Senn <will.senn at gmail.com> <will.senn at gmail.com> wrote:
>
> [snip]
> My questions are:
>
> 1. Is mesg or an equivalent available in v7?
>
> Perhaps just call printf?
>
>
> 2. If not, what was the v7 way of putting strings out?
>
> Here's what I did:
>
> $ rm -f h h.o
> $ cat h.s
> .globl _printf, _exit
>
> mov     sp, r5
> mov     $hi,(sp)
> jsr     pc,*$_printf
> mov     $0, (sp)
> jsr     pc,*$_exit
>
> hi: <Hello, World!\n\0>
> $ as -o h.o h.s
> $ ld -o h h.o -lc
> $ ./h
> Hello, World!
> $ rm h h.o
>
>
> 3. Why aren't the system call names defined?
>
> If I had to hazard a guess, it would have been to de-emphasize the use
> of assembler for user code, particularly as 7th Edition was starting
> to be portable beyond the PDP-11.
>
>
> 4. What was the v7 way of naming system calls?
>
> I imagine the canonical way to invoke system calls from assembler was
> invoking calling functions in the C library and linking against that.
>
>         - Dan C.
>
> Yep, that worked... you make it look so easy, and your rationales are
> definitely believable :).
>

You can use puts too, at least in v7.

The system call interface between V6 and V7 changed as well...  Some
internal AT&T branches
(cb unix for one) could run both V6 and V7 binaries. BSD uses the v7 system
call interface through
2.10.x. 2.11 moves to a new system call interface as well. There's niggles
in these statements, since
it isn't quite exactly the same, but for things like this it's ok.

V7 also moved to stdio completely. V6 had precursor routines to stdio and
mesg() was dropped in
that whole process.

Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20220104/2fe2748e/attachment.htm>


More information about the TUHS mailing list