2.9BSD 弄ってみましたメモ

とりあえず

$ sudo apt-get install simh

しつつ github から clone

$ git clone git://github.com/magoroku15/2.9BSD.git

ちょい時間かかってます。clone 終了したので README 確認します。

$ cat README 

- How to start simh with this system in ubuntu.
 pdp11 bsd.ini
 
- How to boot.
 rl(0,0)rlunix

- How to change multiuser
 login: root

- How to quit shimh
 # sync; sync; sync;
 ^e
sim> q

$

このままヤッてみるか。

$ pdp11 bsd.ini 

PDP-11 simulator V3.8-1
Disabling XQ
:boot

70Boot
: rl(0,0)rlunix

Berkeley UNIX (Rev. 2.9.1) Sun Nov 20 14:55:50 PST 1983
mem = 1979072

CONFIGURE SYSTEM:
xp 0 csr 176700 vector 254 attached
rk 0 csr 177400 vector 220 attached
hk 0 csr 177440 vector 210 attached
rl 0 csr 174400 vector 160 attached
rp ? csr 176700 vector 254 interrupt vector already in use
ht 0 csr 172440 vector 224 skipped:  No CSR
tm 0 csr 172520 vector 224 attached
ts 0 csr 172520 vector 224 interrupt vector already in use
dh ? csr 160020 vector 370 skipped:  No CSR
dm ? csr 170500 vector 360 skipped:  No autoconfig routines
dz ? csr 160110 vector 320 interrupt vector wrong
dz ? csr 160110 vector 320 interrupt vector wrong
dn 0 csr 175200 vector 300 skipped:  No autoconfig routines
vp ? csr 177500 vector 174 skipped:  No autoconfig routines
lp 0 csr 177514 vector 200 attached
Erase=^?, kill=^U, intr=^C
# ls
.cshrc        READ_ME       examples      mdec          tmp
.login        bin           genallsys.sh  mnt           unix
.msgsrc       boot          hkunix        rkunix        usr
.profile      dev           lib           rlunix        xpunix
2.9stamp      etc           lost+found    rpunix
# pwd
/
# ls bin
#        cmp      e        icheck   mt       pstat    strip    vi
[        cp       echo     iostat   mv       pwd      stty     view
adb      csh      ed       kill     ncheck   ranlib   su       wc
ar       date     edit     l        newgrp   restor   sync     who
as       dcheck   ex       ld       nice     rm       tail     write
cat      dd       expr     ln       nm       rmail    tar      yes
cc       df       false    login    od       rmdir    tee
chgrp    diff     fgrep    ls       oldcsh   sh       test
chmod    du       file     mail     passwd   size     time
chown    dump     find     make     pr       sleep    touch
clri     dumpdir  grep     mkdir    ps       sort     true
# 

cat ってコマンドあるな。/ に README があるようなので確認。

# cat READ_ME
There are five almost-identical copies of unix here
(hkunix, rkunix, rlunix, rpunix, and xpunix).  All except xpunix
are stripped, and xpunix is linked to unix for programs like ps to use.
If you need to save space, remove all of these that you will not use
except unix itself.  All of the copies were patched with the script
genallsys.sh, which you can use as an example if you want to do any other
patching on one of these until you can recompile.
# 

む、genallsys.sh って何だろ。中身は以下らしいです。

cp unix rlunix
cp unix rpunix
cp unix rkunix
cp unix hkunix
cp unix xpunix
adb -w rlunix << 'EOF'
swapdev?w 04000
rootdev?w 04000
pipedev?w 04000
swplo?W 8000
nswap?w 2240
'EOF'
adb -w rpunix << 'EOF'
0254?w rpio
swapdev?w 0401
rootdev?w 0400
pipedev?w 0400
nswap?w 5200
'EOF'
adb -w hkunix << 'EOF'
swapdev?w 02001
rootdev?w 02000

adb コマンドって何でしょ。デバッガなのか。

gdgd な tweet してたら

@myb1126 さんから「adbを叩くのが一番良いドキュメントですw」とのフォローを頂いたので試してみたんですが微妙。。

# cp unix testunix
# adb testunix
swapdev?
060774:         03001   = bgt   061000
rootdev?
060772:         03000   = bgt   060774
pipedev?
060776:         03000   = bgt   061000
swplo?
061000:         0       = halt
nswap?
061004:         011300  = mov   (r3),r0

むむ、genallsys.sh にあるソレをタタいてみるか。てかたまに tty なデバイスが開けん、って叱られるんだけどこのあたりもよく分からんな。
とは言え、-w 付けて実行して swapdev?w してみたら書きこまれてますね。

# adb -w testunix
swapdev?
060774:         04000   = jsr   r0,r0

てか、help みたいなナニは無いのかorz
ええい全然分からんぞ、って言っていたら man があった。てかこれ、ソース見たい。

というか

# ps
/dev/swap: No such file or directory
#

むむ、/dev/tty* が云々とか微妙な不具合があるのかどうか。引き続きいくつか確認してみます。