The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Ron Natalie <ron@ronnatalie.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] A language question
Date: Wed, 1 Sep 2021 12:09:51 -0600	[thread overview]
Message-ID: <CANCZdfqtum5XOXMzU8higFu7qqgdk8eRC-=3JAYqgLm0YDJb4Q@mail.gmail.com> (raw)
In-Reply-To: <emb7ef3194-1912-4969-9763-7a703eefabc9@alien>

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

On Wed, Sep 1, 2021 at 10:07 AM Ron Natalie <ron@ronnatalie.com> wrote:

> I disagree.  TRAP according to the processor handbook was intended to be
> used for what UNIX calls system calls.    EMT was the emulator trap used to
> simulate other operating systems on the same hardware.    Oddly, for some
> reason, all the DEC OSes use EMT instructions for their system calls.
>  This came in handy when JHU ported BasicPlus from RSTS to UNIX.     That
> executable could run fine on UNIX because we caught the few EMT traps that
> mattered to us and simulated them.   The only thing we had to do other than
> that was to add a "nostack()" system call that got rid of the normal
> UNIX-maintained stack starting at the address space (RSTS executables like
> many DEC OSs used a stack that started around 1000).
>

The various RT-11 emulators use variations on this theme as well, some
inside the kernel, some as a signal handler (fast forward 40-odd years and
I'm catching the SIGSEGV traps in executing 16-bit code to implement the
unix system calls)... It's a very useful and elegant trick that's been
oft-repeated.


> Many of the UNIX signals come straight from PDP-11 traps:  SIGFPE, SIGIOT,
> SIGSEGV, SIGBUS, SIGILL, SIGEMT. and those traps invoked those signals.
>

Yes. They seemed to make perfect sense when I encountered them in Unix
after growing up on RSTS/e and RT-11 before my first contact with Unix....


> FPE - floating point exception
> ILL - illegal exception (either unknown opcode or CERTAIN of the
> privileged instructions, others were ignored)
> BUS - fatal unibus timeout trap.   Usually an attempt to access a
> memory/unibus address that doesn't respond, or to do word accesses on odd
> boundaries.
> SEGV - accessing memory not mapped to you
> IOT - the IOT instruction
> BPT - the BPT instruction
> TRAP, EMT - these instructions
>
>

[-- Attachment #2: Type: text/html, Size: 2635 bytes --]

  reply	other threads:[~2021-09-01 18:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 13:23 Richard Salz
2021-09-01 13:28 ` Dan Cross
2021-09-01 13:44   ` Clem Cole
2021-09-01 14:23   ` Paul Winalski
2021-09-01 14:29     ` John Cowan
2021-09-01 15:59       ` Ron Natalie
2021-09-01 18:09         ` Warner Losh [this message]
2021-09-01 18:43         ` John Cowan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANCZdfqtum5XOXMzU8higFu7qqgdk8eRC-=3JAYqgLm0YDJb4Q@mail.gmail.com' \
    --to=imp@bsdimp.com \
    --cc=ron@ronnatalie.com \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).