The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] 2.11BSD cross compiler
@ 2010-09-28  5:54 Nick Downing
  2010-09-29  0:24 ` Tim Newsham
  0 siblings, 1 reply; 23+ messages in thread
From: Nick Downing @ 2010-09-28  5:54 UTC (permalink / raw)


hi everyone,

Just to let you all know that a few years ago I adapted the 2.11BSD
source so that it could be built on a modern system and transferred
across to the PDP-11.  The changes are:

1. The PDP-11 assembler was written in assembler so made a
line-by-line translation into C code.
2. The C compiler required access to PDP-11 math e.g. for constant
folding, so I inserted some code from Bob Supnik's emulator in those
places.
3. Basically everything that runs from a makefile (e.g. "sh", "make",
"yacc", etc) has been upgraded to a more modern coding style with non
portable code fixed up, independence on type sizes, prototypes added,
etc, and the build system now generates two versions where
appropriate, one for running locally (compiled with gcc or whatever
your local compiler is) and one for inclusion in the distribution
(compiled with the PDP-11 cross toolchain).
4. I also fixed a number of "just plain bugs" that obviously had
remained undiscovered under PDP-11 conditions.

I used conditional compilation and macros where appropriate so as not
to break the PDP-11's ability to run the toolchain locally.  I used a
binary comparison between the locally compiled build and the cross
compiled build to weed out bugs, and it did seem to be pretty robust
as I left it.  The only reason I didn't make this work available
generally (apart from laziness), was that there's quite a few
experimental changes in addition to points 1-4, for example:

5. A reworking of the (existing) system that extracts strings and puts
them in the code segment (necessary to get the PDP-11 to run large
executables such as nethack).  I can't really remember why I did this,
probably just to clean things up, but I don't think it's all that
essential so perhaps could be removed for the sake of minimal change.
6. Some changes to how "make" works, and to the Makefiles, intended to
clean things up, which in retrospect weren't essential and should be
removed (except for those changes necessary for point 3 above, need to
untangle it somehow).  I didn't get around to converting all Makefiles
so there's probably a bit of inconsistency there.  I might have broken
some things like "make tags" and "make depend", not sure.
7. Fortran stuff had to be disabled as the Fortran compiler is written
in assembly language (IIRC) and would probably be difficult to convert
into C (but I don't think this is a big deal).

If anybody volunteers to sift through the changes and sort out the
good from the dross then I will happily send the whole thing.

cheers, Nick



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-28  5:54 [TUHS] 2.11BSD cross compiler Nick Downing
@ 2010-09-29  0:24 ` Tim Newsham
  2010-09-29  0:51   ` Larry McVoy
  0 siblings, 1 reply; 23+ messages in thread
From: Tim Newsham @ 2010-09-29  0:24 UTC (permalink / raw)


> 7. Fortran stuff had to be disabled as the Fortran compiler is written
> in assembly language (IIRC) and would probably be difficult to convert
> into C (but I don't think this is a big deal).

have you considered running Warren's emulator that can
run individual binaries (rather than emulating the entire
system)?  This could let you use a few (or many, if you chose)
native tools in the build process without giving up portability.

http://ftp.math.utah.edu/pub///mirrors/minnie.tuhs.org/PDP-11/Emulators/Apout/
http://puszcza.gnu.org.ua/software/apout/

> cheers, Nick

Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  0:24 ` Tim Newsham
@ 2010-09-29  0:51   ` Larry McVoy
  2010-09-29  2:14     ` John Cowan
  0 siblings, 1 reply; 23+ messages in thread
From: Larry McVoy @ 2010-09-29  0:51 UTC (permalink / raw)


There is close zero chance I'll ever use this stuff, unless I retire
to teaching in which case I'll make people write PDP-11 assembler.

But I had to come say thanks for doing this.  The PDP-11 was such
an amazingly pleasant machine to program.  I can easily imagine that
translating stuff from assembler to C is pretty straightforward.

RIP DEC, you brought us some good stuff.

On Tue, Sep 28, 2010 at 02:24:45PM -1000, Tim Newsham wrote:
>> 7. Fortran stuff had to be disabled as the Fortran compiler is written
>> in assembly language (IIRC) and would probably be difficult to convert
>> into C (but I don't think this is a big deal).
>
> have you considered running Warren's emulator that can
> run individual binaries (rather than emulating the entire
> system)?  This could let you use a few (or many, if you chose)
> native tools in the build process without giving up portability.
>
> http://ftp.math.utah.edu/pub///mirrors/minnie.tuhs.org/PDP-11/Emulators/Apout/
> http://puszcza.gnu.org.ua/software/apout/
>
>> cheers, Nick
>
> Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com
> _______________________________________________
> TUHS mailing list
> TUHS at minnie.tuhs.org
> https://minnie.tuhs.org/mailman/listinfo/tuhs

-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  0:51   ` Larry McVoy
@ 2010-09-29  2:14     ` John Cowan
  2010-09-29  2:38       ` Larry McVoy
  0 siblings, 1 reply; 23+ messages in thread
From: John Cowan @ 2010-09-29  2:14 UTC (permalink / raw)


On Tue, Sep 28, 2010 at 8:51 PM, Larry McVoy <lm at bitmover.com> wrote:

> There is close zero chance I'll ever use this stuff, unless I retire
> to teaching in which case I'll make people write PDP-11 assembler.

That seems a tad archaic.  MIPS might be a better choice; it's 32-bit
with 32 registers, and there are excellent simulators for it.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  2:14     ` John Cowan
@ 2010-09-29  2:38       ` Larry McVoy
  2010-09-29  2:59         ` John Cowan
                           ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Larry McVoy @ 2010-09-29  2:38 UTC (permalink / raw)


On Tue, Sep 28, 2010 at 10:14:09PM -0400, John Cowan wrote:
> On Tue, Sep 28, 2010 at 8:51 PM, Larry McVoy <lm at bitmover.com> wrote:
> 
> > There is close zero chance I'll ever use this stuff, unless I retire
> > to teaching in which case I'll make people write PDP-11 assembler.
> 
> That seems a tad archaic.  MIPS might be a better choice; it's 32-bit
> with 32 registers, and there are excellent simulators for it.

Color me old school.  I like MIPS, I worked at SGI (got married to
an old school MIPS gal) but PDP-11 is so frigging intuitive.  How
can you not understand that instruction set?  If you can't, well,
sorry, not so much in my book.  It's like a stripped down C.

Come on - has anyone ever seen a better instruction set?  More 
complicated, yeah, holy moly, yeah.  But cleaner?  We owe DEC
for that one.

That said, John is, as always, (probably) right.  He's certainly right
if we are talking about skills that go to today's market, PDP-11 is not
so much.  I said "probably" because I suspect there are some people for
whom the light will go on if they do PDP-11 assembler but not so much
on MIPS.

Personally, I like anyone who can do any assembler.  One of my interview
questions is "have you written swtch?"  If you don't get the question
you are not an OS person, if you are, of course you get it.  In any
assembler (I wrote it in VAX, M68K, NS32032 though that last one was
wishful thinking - I still wish that one hadn't been so buggy).

All this late night rambling aside, +1 on the efforts of Nick, +1 on
anyone who groks PDP-11 assembly.  Those are soon to be lost skills
and I admire them.  Had a TA who could read octal dumps just like they
were C.  Ken Witte - wonder where he is now.  I used to bribe him with
a six pack to come over and help me and he'd have a beer in his hand
and the line printer output in the other and be laughing at me for some
retarded thing I had done that he figured out from the octal.
-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  2:38       ` Larry McVoy
@ 2010-09-29  2:59         ` John Cowan
  2010-09-29  3:44           ` Larry McVoy
  2010-09-30  4:22           ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Greg 'groggy' Lehey
  2010-09-29  3:14         ` [TUHS] 2.11BSD cross compiler M. Warner Losh
  2010-09-29  3:17         ` Steve Nickolas
  2 siblings, 2 replies; 23+ messages in thread
From: John Cowan @ 2010-09-29  2:59 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]

On Tue, Sep 28, 2010 at 10:38 PM, Larry McVoy <lm at bitmover.com> wrote:

> Color me old school.  I like MIPS, I worked at SGI (got married to
> an old school MIPS gal) but PDP-11 is so frigging intuitive.  How
> can you not understand that instruction set?  If you can't, well,
> sorry, not so much in my book.  It's like a stripped down C.

Yeah.  I used it on and off, but my serious assembler programming was
on the PDP-8.  Now *that* was seriously small, but you had to know the
tricks, like how to find out the absolute address of the 128-word
memory page following the one you are on when writing PIC code for
OS/8 device drivers, or how to microprogram the operate instructions
get interesting constants into the AC.

> Come on - has anyone ever seen a better instruction set?  More
> complicated, yeah, holy moly, yeah.  But cleaner?  We owe DEC
> for that one.

I remember how appalled I was when I saw the VAX instruction set.
Luckily, it didn't matter: I never did assembler again.  Still, trying
to make people think in octal at this late date seems unnecessary.

> Personally, I like anyone who can do any assembler.  One of my interview
> questions is "have you written swtch?"

/me chuckles.

>  If you don't get the question you are not an OS person,
> if you are, of course you get it.

Well, I know what it is but I've never written it.  There was a bug in
the V6 kernel version anyhow.

> Ken Witte - wonder where he is now.

Too many others out there, alas.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  2:38       ` Larry McVoy
  2010-09-29  2:59         ` John Cowan
@ 2010-09-29  3:14         ` M. Warner Losh
  2010-09-29  3:17         ` Steve Nickolas
  2 siblings, 0 replies; 23+ messages in thread
From: M. Warner Losh @ 2010-09-29  3:14 UTC (permalink / raw)


In message: <20100929023819.GA12919 at bitmover.com>
            Larry McVoy <lm at bitmover.com> writes:
: Had a TA who could read octal dumps just like they
: were C.  Ken Witte - wonder where he is now.  I used to bribe him with
: a six pack to come over and help me and he'd have a beer in his hand
: and the line printer output in the other and be laughing at me for some
: retarded thing I had done that he figured out from the octal.

I used to impress the first year C students by typing 'more core' and
then pointing to a random spot on the screen and saying "Oh, you
passed NULL to strcmp here."  The sad thing was, I had about a 75% hit
rate...  Not really a 'skill' but rather just knowing the common
errors for the current assignment and being a lucky guesser :)

Warner



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  2:38       ` Larry McVoy
  2010-09-29  2:59         ` John Cowan
  2010-09-29  3:14         ` [TUHS] 2.11BSD cross compiler M. Warner Losh
@ 2010-09-29  3:17         ` Steve Nickolas
  2010-09-29  3:55           ` Larry McVoy
  2 siblings, 1 reply; 23+ messages in thread
From: Steve Nickolas @ 2010-09-29  3:17 UTC (permalink / raw)


On Tue, 28 Sep 2010, Larry McVoy wrote:

> Color me old school.  I like MIPS, I worked at SGI (got married to
> an old school MIPS gal) but PDP-11 is so frigging intuitive.  How
> can you not understand that instruction set?  If you can't, well,
> sorry, not so much in my book.  It's like a stripped down C.
>
> Come on - has anyone ever seen a better instruction set?  More
> complicated, yeah, holy moly, yeah.  But cleaner?  We owe DEC
> for that one.

Dunno, the only instruction set I really grok is 65C02, which is by your 
standards probably little more than a toy.

-uso.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  2:59         ` John Cowan
@ 2010-09-29  3:44           ` Larry McVoy
  2010-09-30  4:22           ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Greg 'groggy' Lehey
  1 sibling, 0 replies; 23+ messages in thread
From: Larry McVoy @ 2010-09-29  3:44 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2533 bytes --]

On all this old school stuff - just in case you think it doesn't matter,
it does.  One of the best guys I have here is a guy who did printer 
firmware.  I had to teach him what a cache was, he had never seen one.
But holy moly does he hold the whole picture in his head.  And has 
forgotten more about SCM than I'll ever know (we do that stuff, 
BitKeeper, etc).

People who understand the hardware are useful.  I cringe at what we 
call a CS degree these days.

And BTW, if you are one of those old school guys and want a job, hit 
me up.  We're very picky, we have a ~8 year retention rate, but that's
because we make sure that you will be happy and we will be happy.  If
we have one good hire a year I'm ecstatic.  Gotta be Bay Area for the
first year though (you can live in my guest house in the redwoods :)

--lm

On Tue, Sep 28, 2010 at 10:59:22PM -0400, John Cowan wrote:
> On Tue, Sep 28, 2010 at 10:38 PM, Larry McVoy <lm at bitmover.com> wrote:
> 
> > Color me old school.  I like MIPS, I worked at SGI (got married to
> > an old school MIPS gal) but PDP-11 is so frigging intuitive.  How
> > can you not understand that instruction set?  If you can't, well,
> > sorry, not so much in my book.  It's like a stripped down C.
> 
> Yeah.  I used it on and off, but my serious assembler programming was
> on the PDP-8.  Now *that* was seriously small, but you had to know the
> tricks, like how to find out the absolute address of the 128-word
> memory page following the one you are on when writing PIC code for
> OS/8 device drivers, or how to microprogram the operate instructions
> get interesting constants into the AC.
> 
> > Come on - has anyone ever seen a better instruction set?  More
> > complicated, yeah, holy moly, yeah.  But cleaner?  We owe DEC
> > for that one.
> 
> I remember how appalled I was when I saw the VAX instruction set.
> Luckily, it didn't matter: I never did assembler again.  Still, trying
> to make people think in octal at this late date seems unnecessary.
> 
> > Personally, I like anyone who can do any assembler.  One of my interview
> > questions is "have you written swtch?"
> 
> /me chuckles.
> 
> >  If you don't get the question you are not an OS person,
> > if you are, of course you get it.
> 
> Well, I know what it is but I've never written it.  There was a bug in
> the V6 kernel version anyhow.
> 
> > Ken Witte - wonder where he is now.
> 
> Too many others out there, alas.

-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  3:17         ` Steve Nickolas
@ 2010-09-29  3:55           ` Larry McVoy
  2010-09-29  4:34             ` [TUHS] 6502 and swtch, was " Warren Toomey
  2010-09-29 20:54             ` [TUHS] " Peter Jeremy
  0 siblings, 2 replies; 23+ messages in thread
From: Larry McVoy @ 2010-09-29  3:55 UTC (permalink / raw)


On Wed, Sep 29, 2010 at 05:17:33AM +0200, Steve Nickolas wrote:
> On Tue, 28 Sep 2010, Larry McVoy wrote:
>
>> Color me old school.  I like MIPS, I worked at SGI (got married to
>> an old school MIPS gal) but PDP-11 is so frigging intuitive.  How
>> can you not understand that instruction set?  If you can't, well,
>> sorry, not so much in my book.  It's like a stripped down C.
>>
>> Come on - has anyone ever seen a better instruction set?  More
>> complicated, yeah, holy moly, yeah.  But cleaner?  We owe DEC
>> for that one.
>
> Dunno, the only instruction set I really grok is 65C02, which is by your  
> standards probably little more than a toy.

Oh, no.  Useful.  There was similar Intel (i think) cpu that was flashable.
I wrote code for it that muxed two lines over one serial line.  I'm sorta
proud of this, this was back in the BLIT days (loved that terminal, holy
crap, loved it).  I was a grad student at Wisconsin and we had one long
serial port line to our office, no ethernet (this was back when 10Mbit
was really weird).  Shared an office with another guy and we had one
blit.  I talked the department out of another one, and did a wire wrapped
board with that CPU on it and all it did was use the 8th bit to mux.
Bit set, his blit, not set, my blit.

Worked fantastic until the blits melted.  Still miss those, they were the
X terminal ahead of their time. 

Anyhoo, the 6502 is a fine little processor and knowing how to make it
sing is a useful skill.

It's not the toy-ness so much, it's what you do with it.  You can do a
lot with that CPU, ask any car company.
-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 6502 and swtch, was Re: 2.11BSD cross compiler
  2010-09-29  3:55           ` Larry McVoy
@ 2010-09-29  4:34             ` Warren Toomey
  2010-09-29  5:13               ` Steve Nickolas
  2010-09-30 17:49               ` Tim Newsham
  2010-09-29 20:54             ` [TUHS] " Peter Jeremy
  1 sibling, 2 replies; 23+ messages in thread
From: Warren Toomey @ 2010-09-29  4:34 UTC (permalink / raw)


> On Wed, Sep 29, 2010 at 05:17:33AM +0200, Steve Nickolas wrote:
> > On Tue, 28 Sep 2010, Larry McVoy wrote:
> > Dunno, the only instruction set I really grok is 65C02, which is by your  
> > standards probably little more than a toy.

On Tue, Sep 28, 2010 at 08:55:34PM -0700, Larry McVoy wrote:
> Anyhoo, the 6502 is a fine little processor and knowing how to make it
> sing is a useful skill.

Argh, I wasn't going to post back but I can't resist. Back in the 80's I
rewrote Xinu from C into 6502 assembly, and got very primitive multitasking
working on the Apple ][. I guess that counts as writing swtch :-)

ftp://minnie.tuhs.org/pub/apple2/apple2xinu.tar.gz

Cheers,
	Warren



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 6502 and swtch, was Re: 2.11BSD cross compiler
  2010-09-29  4:34             ` [TUHS] 6502 and swtch, was " Warren Toomey
@ 2010-09-29  5:13               ` Steve Nickolas
  2010-09-30 17:49               ` Tim Newsham
  1 sibling, 0 replies; 23+ messages in thread
From: Steve Nickolas @ 2010-09-29  5:13 UTC (permalink / raw)


On Wed, 29 Sep 2010, Warren Toomey wrote:

> Argh, I wasn't going to post back but I can't resist. Back in the 80's I
> rewrote Xinu from C into 6502 assembly, and got very primitive multitasking
> working on the Apple ][. I guess that counts as writing swtch :-)
>
> ftp://minnie.tuhs.org/pub/apple2/apple2xinu.tar.gz

Specific to, I'm guessing, the banking hardware of the Laser 3000/Dick 
Smith Cat?  (I saw a disk image on Asimov with your name on it that 
mentioned the Cat.  I've used a Laser 128, but never a 3000 which is 
apparently a bit more different from a real ][.)

It might be made to work on a real ][ with some heavy wizardry.  I think I 
saw someone on comp.sys.apple2 talking about doing that a few months back.

Running some sort of *x on an Apple ][ would be interesting, seeing as 
it's been done on the C64.  I actually own an Apple //e.

-uso.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29  3:55           ` Larry McVoy
  2010-09-29  4:34             ` [TUHS] 6502 and swtch, was " Warren Toomey
@ 2010-09-29 20:54             ` Peter Jeremy
  2010-09-29 21:34               ` Larry McVoy
  1 sibling, 1 reply; 23+ messages in thread
From: Peter Jeremy @ 2010-09-29 20:54 UTC (permalink / raw)


On 2010-Sep-28 20:55:34 -0700, Larry McVoy <lm at bitmover.com> wrote:
>On Wed, Sep 29, 2010 at 05:17:33AM +0200, Steve Nickolas wrote:
>> Dunno, the only instruction set I really grok is 65C02, which is by your  
>> standards probably little more than a toy.
>
>Oh, no.  Useful.  There was similar Intel (i think) cpu that was flashable.

Maybe 8748.  There was a mask version of this in the PC keyboard
controller (and hence still buried in most if not all southbridges).
That was followed by the 8051 family (8751 would have been the EPROM
version) - which I believe was very popular in car ECUs.  It was also
multi-sourced.  I've used both i8748 and a Philips 8051 clone at $work
many years ago.

>Anyhoo, the 6502 is a fine little processor and knowing how to make it
>sing is a useful skill.

For various reasons, I never learnt 6502.  I preferred the Motorola CPUs
(though $work was very Intel based).

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20100930/ea6ae489/attachment.sig>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
  2010-09-29 20:54             ` [TUHS] " Peter Jeremy
@ 2010-09-29 21:34               ` Larry McVoy
  0 siblings, 0 replies; 23+ messages in thread
From: Larry McVoy @ 2010-09-29 21:34 UTC (permalink / raw)


On Thu, Sep 30, 2010 at 06:54:42AM +1000, Peter Jeremy wrote:
> On 2010-Sep-28 20:55:34 -0700, Larry McVoy <lm at bitmover.com> wrote:
> >On Wed, Sep 29, 2010 at 05:17:33AM +0200, Steve Nickolas wrote:
> >> Dunno, the only instruction set I really grok is 65C02, which is by your  
> >> standards probably little more than a toy.
> >
> >Oh, no.  Useful.  There was similar Intel (i think) cpu that was flashable.
> 
> Maybe 8748.  There was a mask version of this in the PC keyboard
> controller (and hence still buried in most if not all southbridges).
> That was followed by the 8051 family (8751 would have been the EPROM
> version) - which I believe was very popular in car ECUs.  It was also

I think it was a variant of the 8051 that had EPROM and 3 UARTs.  Because
I needed 3 - one for the long line to the CS building, and 2 for the 2
terminals.
-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] PDP-8 (was: 2.11BSD cross compiler)
  2010-09-29  2:59         ` John Cowan
  2010-09-29  3:44           ` Larry McVoy
@ 2010-09-30  4:22           ` Greg 'groggy' Lehey
  2010-09-30  4:53             ` John Cowan
  2010-09-30 13:50             ` Larry McVoy
  1 sibling, 2 replies; 23+ messages in thread
From: Greg 'groggy' Lehey @ 2010-09-30  4:22 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2616 bytes --]

On Tuesday, 28 September 2010 at 22:59:22 -0400, John Cowan wrote:
> On Tue, Sep 28, 2010 at 10:38 PM, Larry McVoy <lm at bitmover.com> wrote:
>
>> Color me old school.  I like MIPS, I worked at SGI (got married to
>> an old school MIPS gal) but PDP-11 is so frigging intuitive.  How
>> can you not understand that instruction set?  If you can't, well,
>> sorry, not so much in my book.  It's like a stripped down C.
>
> Yeah.  I used it on and off, but my serious assembler programming
> was on the PDP-8.  Now *that* was seriously small, but you had to
> know the tricks, like how to find out the absolute address of the
> 128-word memory page following the one you are on when writing PIC
> code for OS/8 device drivers, or how to microprogram the operate
> instructions get interesting constants into the AC.

That was my first machine too (well, a PDP-12, which was really a
hybrid PDP-8/LINC-8, but I only used the PDP-8 instructions).  That
was a nice, compact instruction set.  It has the great advantage that
I can still remember just about every instruction today.  Remember the
autoincrement registers?  Even in those days they looked like a
kludge, but they helped a lot.

>> Come on - has anyone ever seen a better instruction set?  More
>> complicated, yeah, holy moly, yeah.  But cleaner?  We owe DEC
>> for that one.
>
> I remember how appalled I was when I saw the VAX instruction set.
> Luckily, it didn't matter: I never did assembler again.  Still,
> trying to make people think in octal at this late date seems
> unnecessary.

It's funny how long octal clung on.  It should have gone away with 8
bit bytes.  But somehow I still have a soft spot for octal, and
numbers like 7778 still look wrong.

>> Personally, I like anyone who can do any assembler.  One of my interview
>> questions is "have you written swtch?"
>>
>>  If you don't get the question you are not an OS person,
>> if you are, of course you get it.

Hmm.  Am I expected to understand this?  Seriously, I don't know how
many people really wrote anything like swtch ().

Greg
--
Finger grog at FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.  See
http://www.lemis.com/grog/email/signed-mail.php for more details.
If your Microsoft MUA reports problems, please read
http://tinyurl.com/broken-mua
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20100930/4857efaa/attachment.sig>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] PDP-8 (was: 2.11BSD cross compiler)
  2010-09-30  4:22           ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Greg 'groggy' Lehey
@ 2010-09-30  4:53             ` John Cowan
  2010-09-30 13:50             ` Larry McVoy
  1 sibling, 0 replies; 23+ messages in thread
From: John Cowan @ 2010-09-30  4:53 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1182 bytes --]

On Thu, Sep 30, 2010 at 12:22 AM, Greg 'groggy' Lehey <grog at lemis.com> wrote:

>  Remember the
> autoincrement registers?  Even in those days they looked like a
> kludge, but they helped a lot.

I hardly ever used them, but I can't remember exactly why not.  I
remember writing quite a few subroutine libraries in PAL/8, and of
course you didn't want to steal them from the main program.

> It's funny how long octal clung on.  It should have gone away with 8
> bit bytes.

Octal made some sense on the PDP-11, with its 3-bit register fields,
even though the instructions were 16 bits.  I think the notation got
stabilized in the culture just because it was included in C.  In my
pre-announcement review of Go (not a work assignment, just something I
went and did when I was at Google) I urged them to remove octal from
integer, character, and string literals, but nope, they are still
there.  For one thing, it means that literals interoperate among C,
C++, and Go, though I don't know if that was the motivation.

>  But somehow I still have a soft spot for octal, and
> numbers like 7778 still look wrong.

/me chuckles.

> Hmm.  Am I expected to understand this?

No.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] PDP-8 (was: 2.11BSD cross compiler)
  2010-09-30  4:22           ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Greg 'groggy' Lehey
  2010-09-30  4:53             ` John Cowan
@ 2010-09-30 13:50             ` Larry McVoy
  2010-10-02  3:46               ` Greg 'groggy' Lehey
  2010-10-02 10:06               ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Wolfgang Helbig
  1 sibling, 2 replies; 23+ messages in thread
From: Larry McVoy @ 2010-09-30 13:50 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

> >>  If you don't get the question you are not an OS person,
> >> if you are, of course you get it.
> 
> Hmm.  Am I expected to understand this?  Seriously, I don't know how
> many people really wrote anything like swtch ().

You'd be amazed at how many people did their own user level threads.
Gotta write swtch() for that.

And it's not swtch() so much as do you understand the stack frames?
If you could look at the stack frames and give me a stack trace
that's more or less the same thing.
-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 6502 and swtch, was Re: 2.11BSD cross compiler
  2010-09-29  4:34             ` [TUHS] 6502 and swtch, was " Warren Toomey
  2010-09-29  5:13               ` Steve Nickolas
@ 2010-09-30 17:49               ` Tim Newsham
  1 sibling, 0 replies; 23+ messages in thread
From: Tim Newsham @ 2010-09-30 17:49 UTC (permalink / raw)


> Argh, I wasn't going to post back but I can't resist. Back in the 80's I
> rewrote Xinu from C into 6502 assembly, and got very primitive multitasking
> working on the Apple ][. I guess that counts as writing swtch :-)
>
> ftp://minnie.tuhs.org/pub/apple2/apple2xinu.tar.gz

Along the same line: http://lng.sourceforge.net/
A unix-like system written for 6502 (not my doing, I just
find it cute).  Its interesting because in several ways
the 6502's not really a great cpu for this kind of thing
(fixed location stack, not easy to write PIC code...).

But hey, if you can support 8 concurrent users on a 48k
pdp11, why not unix on a c64? :)

> 	Warren

Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] PDP-8 (was: 2.11BSD cross compiler)
  2010-09-30 13:50             ` Larry McVoy
@ 2010-10-02  3:46               ` Greg 'groggy' Lehey
  2010-10-02 21:03                 ` Larry McVoy
  2010-10-02 10:06               ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Wolfgang Helbig
  1 sibling, 1 reply; 23+ messages in thread
From: Greg 'groggy' Lehey @ 2010-10-02  3:46 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]

On Thursday, 30 September 2010 at  6:50:29 -0700, Larry McVoy wrote:
>>>>  If you don't get the question you are not an OS person,
>>>> if you are, of course you get it.
>>
>> Hmm.  Am I expected to understand this?  Seriously, I don't know how
>> many people really wrote anything like swtch ().
>
> You'd be amazed at how many people did their own user level threads.
> Gotta write swtch() for that.

I think you're missing the joke.  But swtch () is a specific kernel
function in UNIX, though in this thread (excuse the pun) people seem
to be using it as a synonym for a scheduler.  And not many people need
to write their threading library by hand any more.

> And it's not swtch() so much as do you understand the stack frames?

That's a different issue.  Any programmer worth his salt needs to
understand the underlying hardware, including stack frames.  For my
personal understanding of them, see
http://www.lemis.com/grog/Documentation/PUS/porting_unix_software/obj.pdf
towards the end, or http://www.lemis.com/grog/Papers/Debug-tutorial/
for the kernel context, page 17 on.

> If you could look at the stack frames and give me a stack trace
> that's more or less the same thing.

(gdb) bt

The real question is not to get a stack trace, but to analyse it.

Greg
--
Finger grog at FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.  See
http://www.lemis.com/grog/email/signed-mail.php for more details.
If your Microsoft MUA reports problems, please read
http://tinyurl.com/broken-mua
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20101002/e02ab2c7/attachment.sig>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] PDP-8 (was: 2.11BSD cross compiler)
  2010-09-30 13:50             ` Larry McVoy
  2010-10-02  3:46               ` Greg 'groggy' Lehey
@ 2010-10-02 10:06               ` Wolfgang Helbig
  1 sibling, 0 replies; 23+ messages in thread
From: Wolfgang Helbig @ 2010-10-02 10:06 UTC (permalink / raw)


Hi,

Am 30.09.2010 um 15:50 schrieb Larry McVoy:
> 
> And it's not swtch() so much as do you understand the stack frames?

Absolutely. In http://wwwlehre.dhbw-stuttgart.de/~helbig/os/script/chapt2.3 you'll find all about stacks in Unix V6.

> If you could look at the stack frames and give me a stack trace
> that's more or less the same thing.

Sincerely,
Wolfgang




^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] PDP-8 (was: 2.11BSD cross compiler)
  2010-10-02  3:46               ` Greg 'groggy' Lehey
@ 2010-10-02 21:03                 ` Larry McVoy
  2010-10-02 21:39                   ` [TUHS] PDP-8 M. Warner Losh
  0 siblings, 1 reply; 23+ messages in thread
From: Larry McVoy @ 2010-10-02 21:03 UTC (permalink / raw)


> > If you could look at the stack frames and give me a stack trace
> > that's more or less the same thing.
> 
> (gdb) bt
> 
> The real question is not to get a stack trace, but to analyse it.

Hmm, we seem to have a different view.  I like people who can write
the gdb bt code, not run it.  This isn't an imaginary thing, one of 
my guys showed up one day with his own hand rolled backtrace that we
ended up putting in our product for support.

The advantage of his, over the following hack we had before, was that
it worked when no gdb was installed (windows):

void
gdb_backtrace(void)
{
        FILE    *f;
        char    *cmd;

        unless (getenv("_BK_BACKTRACE")) return;
        unless ((f = efopen("BK_TTYPRINTF")) ||
            (f = fopen(DEV_TTY, "w"))) {
                f = stderr;
        }
        cmd = aprintf("gdb -batch -ex backtrace '%s/bk' %u 1>&%d 2>&%d",
            bin, getpid(), fileno(f), fileno(f));

        system(cmd);
        free(cmd);
        if (f != stderr) fclose(f);
}
-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] PDP-8
  2010-10-02 21:03                 ` Larry McVoy
@ 2010-10-02 21:39                   ` M. Warner Losh
  0 siblings, 0 replies; 23+ messages in thread
From: M. Warner Losh @ 2010-10-02 21:39 UTC (permalink / raw)


In message: <20101002210346.GE27937 at bitmover.com>
            Larry McVoy <lm at bitmover.com> writes:
: > > If you could look at the stack frames and give me a stack trace
: > > that's more or less the same thing.
: > 
: > (gdb) bt
: > 
: > The real question is not to get a stack trace, but to analyse it.
: 
: Hmm, we seem to have a different view.  I like people who can write
: the gdb bt code, not run it.  This isn't an imaginary thing, one of 
: my guys showed up one day with his own hand rolled backtrace that we
: ended up putting in our product for support.
: 
: The advantage of his, over the following hack we had before, was that
: it worked when no gdb was installed (windows):
: 
: void
: gdb_backtrace(void)
: {
:         FILE    *f;
:         char    *cmd;
: 
:         unless (getenv("_BK_BACKTRACE")) return;
:         unless ((f = efopen("BK_TTYPRINTF")) ||
:             (f = fopen(DEV_TTY, "w"))) {
:                 f = stderr;
:         }
:         cmd = aprintf("gdb -batch -ex backtrace '%s/bk' %u 1>&%d 2>&%d",
:             bin, getpid(), fileno(f), fileno(f));
: 
:         system(cmd);
:         free(cmd);
:         if (f != stderr) fclose(f);
: }

Stack back traces are easy on x86, but get a lot harder on !x86 at
high optimization layers without help from libunwind.  That's the down
side of not relying on gdb... :)

Warner



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [TUHS] 2.11BSD cross compiler
       [not found] <mailman.2278.1285732537.1039.tuhs@minnie.tuhs.org>
@ 2010-09-29 16:20 ` John Finigan
  0 siblings, 0 replies; 23+ messages in thread
From: John Finigan @ 2010-09-29 16:20 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

> > There is close zero chance I'll ever use this stuff,
> > unless I retire
> > to teaching in which case I'll make people write
> > PDP-11 assembler.
> 
> That seems a tad archaic.  MIPS might be a better
> choice; it's 32-bit
> with 32 registers, and there are excellent simulators for
> it.

At my university there's a grad class that's ostensibly on reverse
engineering,but you can't really disassemble anything if you don't
learn assembler, so you learn it.  The downside, I guess, is that
I've read a decent amount of x86 assembler, but written very little.

I don't think it's a bad way to learn, but of course, Larry was
talking about teaching a nice instruction set, and you
kind of lose that.  But you get Windows DLL function calling 
back as a booby prize.  

John Finigan




^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2010-10-02 21:39 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-28  5:54 [TUHS] 2.11BSD cross compiler Nick Downing
2010-09-29  0:24 ` Tim Newsham
2010-09-29  0:51   ` Larry McVoy
2010-09-29  2:14     ` John Cowan
2010-09-29  2:38       ` Larry McVoy
2010-09-29  2:59         ` John Cowan
2010-09-29  3:44           ` Larry McVoy
2010-09-30  4:22           ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Greg 'groggy' Lehey
2010-09-30  4:53             ` John Cowan
2010-09-30 13:50             ` Larry McVoy
2010-10-02  3:46               ` Greg 'groggy' Lehey
2010-10-02 21:03                 ` Larry McVoy
2010-10-02 21:39                   ` [TUHS] PDP-8 M. Warner Losh
2010-10-02 10:06               ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Wolfgang Helbig
2010-09-29  3:14         ` [TUHS] 2.11BSD cross compiler M. Warner Losh
2010-09-29  3:17         ` Steve Nickolas
2010-09-29  3:55           ` Larry McVoy
2010-09-29  4:34             ` [TUHS] 6502 and swtch, was " Warren Toomey
2010-09-29  5:13               ` Steve Nickolas
2010-09-30 17:49               ` Tim Newsham
2010-09-29 20:54             ` [TUHS] " Peter Jeremy
2010-09-29 21:34               ` Larry McVoy
     [not found] <mailman.2278.1285732537.1039.tuhs@minnie.tuhs.org>
2010-09-29 16:20 ` John Finigan

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).