The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Dan Cross <crossd@gmail.com>
To: John Levine <johnl@taugh.com>
Cc: tuhs@tuhs.org, peter.martin.yardley@gmail.com
Subject: [TUHS] Re: mental architecture models, Anyone ever heard of teaching a case study of Initial Unix?
Date: Fri, 5 Jul 2024 18:10:04 -0400	[thread overview]
Message-ID: <CAEoi9W6QUQGW6n+ejK6yhN52YDSz3oe5QxOOcyc2z0iYir6VGg@mail.gmail.com> (raw)
In-Reply-To: <20240705213804.550128EDF53C@ary.qy>

On Fri, Jul 5, 2024 at 5:47 PM John Levine <johnl@taugh.com> wrote:
> It appears that Peter Yardley <peter.martin.yardley@gmail.com> said:
> >The DG Nova had a pretty nice architecture. 2 accumulators, 2 index registers, program counter, status register. No stack register tho. There was a micro processor version by Fairchild.
>
> It did, but it was word addressed which makes it an historical
> curiosity like its spiritual predecessors PDP-4/5/7/8/9.
>
> I also have a mental model of a PDP-11 but these days it's more a simplified 386
> leaving out the dumb or useless stuff.  I ignore the segments which are useless
> other than for 286 emulation, and some of the strange instructions like decimal
> adjust and the warty 8 and 16 bit registers.
>
> What's important is the memory model which on a 386 the way it was
> invariably set up was a flat 32 bit consistent little-endian byte
> addressed memory with a stack and reasonable addressing modes, and 4K
> pages for virtual memory.

It is important to ask, "what does one want to learn about
architecture by going through this study exercise?"  If one just wants
to study the unprivileged instruction set at the level of assembler
mnemonics, then x86_64 isn't completely awful.  Some of the registers
are oddly named, and some instructions have odd implicit operands
(e.g., `inc %rax`, but if you're just looking at assembler syntax,
perhaps one doesn't care.  Of course, the instruction encoding is a
huge mess, but most work-a-day programmers don't have to care about
that.

Where it gets really ugly, in my opinion, is in the privileged
instruction set, and there you can't get away from history: there's no
escaping descriptor tables or segmentation there! The interrupt stack
table in the TSS must be set up properly or you're bound for a triple
fault.  This implies the GDT, IDT, TR, and TSS --- all 286-era goo ---
are all properly set up, and you can't get away from that stuff, even
in a modern operating system (you have to reload the TSS _or_ replace
RSP0 on every thread switch: there's no other way; that's just how the
hardware works). And then there's the matter that you _have_ to enable
paging before switching into 64-bit mode on x86...it's not hard, but
it's annoying (and the x86S proposal doubles down on it).  It'd be
more rational to allow execution against a flat 64-bit physical
address space; for x86S, I'd rather be able to specify a reset vector
in the physical address space by some sort of external strap.

Both RISC-V and ARM seem much more rational in this world by comparison.

I don't like the RISC-V page table format, though: it doesn't permit
you to pun the root of the paging radix tree for other levels, meaning
you can't use the "recursive page table" trick to get access to page
tables themselves: this, in turn, has effects on the rest of the
design of a virtual memory system.  I think I've found a way around
that involving a dedicated temporary mapping region, but it's kind of
a pain and takes a non-trivial chunk of virtual address _space_ (if
not fully realized memory) that I don't care for.  How to handle
cached vs uncached mappings, e.g., for MMIO, is still a bit mysterious
to me.  Honestly, this is something that x86 got largely right.

ARM is ok, but has grown a lot of complexity; most of which can be
ignored until needed, I suspect; saturating arithmetic, for example.
Understanding it is not critical to understanding more or less how the
computer works.

> ARM should be OK too but I have to ask which ARM? There have been so
> many generations often not backward compatible.

I'd start with ARMv8 at this point.  It has less confusing, more
rational stack push/pop semantics and I think they did away with the
conditional execution stuff, which is easier to reason about.

My 2c.

        - Dan C.

  parent reply	other threads:[~2024-07-05 22:10 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03  4:51 [TUHS] " sjenkin
2024-07-03  5:02 ` [TUHS] " Al Kossow
2024-07-03  6:46   ` arnold
2024-07-03 14:04   ` Clem Cole
2024-07-03 15:22     ` Theodore Ts'o
2024-07-03 15:36       ` Larry McVoy
2024-07-03 14:59   ` Marc Rochkind
2024-07-03 23:35     ` G. Branden Robinson
2024-07-04 13:00       ` Marc Donner
2024-07-03  9:04 ` A. P. Garcia
2024-07-03 15:17 ` Vincenzo Nicosia
2024-07-03 15:35   ` Marc Donner
2024-07-03 17:39     ` Jon Forrest
2024-07-03 17:49       ` segaloco via TUHS
2024-07-03 18:16         ` Erik E. Fair
2024-07-03 19:58         ` Rich Salz
2024-07-03 23:15     ` Dave Horsfall
2024-07-03 23:23       ` Marc Donner
2024-07-03 23:26       ` Rik Farrow
2024-07-04 23:26         ` Dave Horsfall
2024-07-03 15:37   ` Al Kossow
2024-07-03 16:01     ` Al Kossow
2024-07-03 16:05       ` Warner Losh
2024-07-03 23:29   ` Marc Rochkind
2024-07-03 23:50     ` G. Branden Robinson
2024-07-04  8:23     ` Vincenzo Nicosia
2024-07-04 20:34       ` Nevin Liber
2024-07-04 20:44         ` segaloco via TUHS
2024-07-04 21:41           ` sjenkin
     [not found]             ` <7AC009E5-C985-44AD-A55E-E0BFC05CDD31@serissa.com>
2024-07-05  9:41               ` Steve Jenkin
2024-07-05  9:47               ` Steve Jenkin
2024-07-05  0:03         ` Stuff Received
2024-07-05  0:12           ` Larry McVoy
2024-07-05  2:24             ` Adam Thornton
2024-07-05  2:42               ` Bakul Shah via TUHS
2024-07-05  7:13                 ` arnold
2024-07-05  7:42                   ` Bakul Shah via TUHS
2024-07-05  8:20                     ` arnold
2024-07-05  8:52                       ` G. Branden Robinson
2024-07-05  7:36               ` Dave Horsfall
2024-07-05 10:18                 ` Peter Yardley
2024-07-05 21:38                   ` [TUHS] Re: mental architecture models, " John Levine
2024-07-05 21:49                     ` Larry McVoy
2024-07-05 22:08                       ` Charles H Sauer (he/him)
2024-07-05 22:24                         ` Larry McVoy
2024-07-05 23:17                       ` John Levine
2024-07-06 12:52                         ` sjenkin
2024-07-06 14:02                           ` John R Levine
2024-07-06 15:58                           ` Clem Cole
2024-07-06 20:56                             ` John R Levine
2024-07-06 21:32                               ` Charles H Sauer (he/him)
2024-07-06 23:46                                 ` Peter Yardley
2024-07-07 17:43                                   ` James Frew
2024-07-07  1:39                                 ` John Levine
2024-07-07  3:26                                   ` [TUHS] Re: PL.8 [was " Charles H Sauer (he/him)
2024-07-08 21:39                                 ` [TUHS] " Aron Insinga
2024-07-08 22:14                                   ` Paul Winalski
2024-07-09  1:04                                     ` Aron Insinga
2024-07-08 22:17                                   ` Rik Farrow
2024-07-09  0:08                                     ` Adam Thornton
2024-07-09  2:40                                       ` Dave Horsfall
2024-07-09  2:43                                         ` Warner Losh
2024-07-09  4:23                                         ` Adam Thornton
2024-07-09  5:06                                         ` Aron Insinga
2024-07-07  5:33                         ` arnold
2024-07-05 22:10                     ` Dan Cross [this message]
2024-07-07 22:00                   ` [TUHS] " Dave Horsfall
2024-07-07 23:28                     ` Brad Spencer
2024-07-08  6:17                       ` Dave Horsfall
2024-07-08  6:27                       ` Lars Brinkhoff
2024-07-08  6:51                         ` Dave Horsfall
2024-07-08  9:36                           ` David Arnold
2024-07-08  6:59                       ` arnold
2024-07-08 13:22                         ` Larry McVoy
2024-07-08 15:37                           ` Al Kossow
2024-07-08 17:22                             ` Tom Lyon
2024-07-08 17:04                           ` Clem Cole
2024-07-08 15:28                         ` Brad Spencer
2024-07-08 15:33                           ` Al Kossow
2024-07-09 22:54                         ` Dave Horsfall
2024-07-10 13:18                           ` Chet Ramey via TUHS
2024-07-10 14:29                             ` John Levine
2024-07-08  0:21                     ` John Levine
2024-07-08  0:35                       ` Dave Horsfall
2024-07-08 12:29                     ` Peter Yardley
2024-07-05 16:40                 ` Jon Steinhart
2024-07-06 13:20                   ` Dave Horsfall
2024-07-05  0:08       ` Marc Rochkind
2024-07-04  1:53 ` John Levine
2024-07-04  2:59   ` segaloco via TUHS
2024-07-04  6:53     ` Rob Pike
2024-07-04 15:07       ` Larry McVoy
2024-07-07 13:57 [TUHS] Re: mental architecture models, " Noel Chiappa
2024-07-07 16:43 ` John Levine
2024-07-10  2:20 Douglas McIlroy

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=CAEoi9W6QUQGW6n+ejK6yhN52YDSz3oe5QxOOcyc2z0iYir6VGg@mail.gmail.com \
    --to=crossd@gmail.com \
    --cc=johnl@taugh.com \
    --cc=peter.martin.yardley@gmail.com \
    --cc=tuhs@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).