Subject: Re: PDP-11 thoughts
To: None <port-vax@netbsd.org>
From: John Wilson <wilson@dbit.com>
List: port-vax
Date: 11/15/2000 02:03:29
>From: Ken Seefried <kseefried@DigitalMoJo.com>

>>that and PDP-11 And VAX instruction set are better matched
>>to C as a higher language.  
>
>In what way, other than some obscure things like pre- and post-incriment?  

Orthogonality in addressing modes.  An 80x86 pretty much turns into a
load/store machine (it almost is anyway) when a C compiler is trying to
generate code for it.  So the code gets fat.  On an 11, even a brain-dead
C compiler generates semi-OK code by just leaving all the variables where
they are and operating on them in place.  And a smart compiler can do a
whole lot better.  For one thing, you can use any register as a pointer
and any register as a counter, on an 80x86 you get jammed up pretty
quickly as you use up the special-purpose registers.

>It's been a long time since I played with this stuff, but I recall you could
>protect segment registers (among other things) if you were using the x86
>mode that used protection rings and gates.

Yep.  It's truly horrible, but the 80x86 segment descriptors have ring
values in them, and also there's a per-process local descriptor table which
is only visible to the current task so other tasks' LDTs are totally
hidden.

Apparently there are a few different definitions of "segmentation", the
Multics folks mean something a bit fancier than the 80x86 segmentation,
the point being to make sure you get faults with 99% of pointer bugs, so
it's supposed to help with debugging.  On the 80x86 it's pretty simple, the
descriptor sets the base and length of the segment in flat memory (this is
upstream of the pager on 386 and later so it doesn't *have* to be physically
contiguous), plus a wide array of confusing access and segment type bits.
In real mode it's simpler, the segment length is always 64 KB and the base
address is the seg reg value times 16 (in prot mode the seg reg value is
used to find the descriptor in whichever table).

John Wilson
D Bit