This is the beginnings of a alternative version of the PDP-7 Unix
system which corresponds to a later development point, around mid-1971, where the system had lost the "dd" directory and gained . and .. entries. This is close to the system as described in http://www.tuhs.org/Archive/PDP-11/Distributions/research/McIlroy_v0/UnixEditionZero.txt except there are no pathnames. To use this version: cd build; make alt; make altrun
This commit is contained in:
+41
-2
@@ -22,16 +22,29 @@ BINARIES=../binaries/
|
|||||||
|
|
||||||
all: cmd others a.rim image.fs copybinaries
|
all: cmd others a.rim image.fs copybinaries
|
||||||
|
|
||||||
|
# Make alternative everything: no dd but . and ..
|
||||||
|
alt: altcmd altothers alta.rim altimage.fs
|
||||||
|
|
||||||
# The run rule has no dependencies so that the system can be booted easily
|
# The run rule has no dependencies so that the system can be booted easily
|
||||||
# and frequently with make run. However, you have to manually make all first!
|
# and frequently with make run. However, you have to manually make all first!
|
||||||
run:
|
run:
|
||||||
$(PDP7) unixv0.simh
|
$(PDP7) unixv0.simh
|
||||||
|
|
||||||
|
# Alternative run, use the altimage.fs
|
||||||
|
altrun:
|
||||||
|
$(PDP7) altunixv0.simh
|
||||||
|
|
||||||
# Warm boot Unix kernel: boots into init and a login prompt
|
# Warm boot Unix kernel: boots into init and a login prompt
|
||||||
a.rim:
|
a.rim:
|
||||||
$(AS) -f rim -o a.rim $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s
|
$(AS) -f rim -o a.rim $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s
|
||||||
$(AS) -n -f list -o a.lst $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s
|
$(AS) -n -f list -o a.lst $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s
|
||||||
|
|
||||||
|
# Alternative kernel: no dd, but . and ..
|
||||||
|
alta.rim:
|
||||||
|
$(AS) -f rim -o alta.rim -DNO_DD $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s
|
||||||
|
$(AS) -n -f list -o alta.lst -DNO_DD $(SYSSRC)/sop.s $(SYSSRC)/s[1-8].s
|
||||||
|
|
||||||
|
|
||||||
# Cold boot Unix kernel: attempts to build a minimal filesystem.
|
# Cold boot Unix kernel: attempts to build a minimal filesystem.
|
||||||
# Don't use this one!
|
# Don't use this one!
|
||||||
coldboot:
|
coldboot:
|
||||||
@@ -40,16 +53,22 @@ coldboot:
|
|||||||
|
|
||||||
# Filesystem image
|
# Filesystem image
|
||||||
image.fs: cmd others
|
image.fs: cmd others
|
||||||
$(MKFS) --format simh proto
|
$(MKFS) proto
|
||||||
$(FSCK) image.fs
|
$(FSCK) image.fs
|
||||||
|
|
||||||
|
# Alternate filesystem image: . and .. but no dd
|
||||||
|
altimage.fs: altcmd altothers
|
||||||
|
$(MKFS) -1 -2 -3 -o altimage.fs altproto
|
||||||
|
$(FSCK) -3 altimage.fs
|
||||||
|
|
||||||
|
|
||||||
copybinaries:
|
copybinaries:
|
||||||
mkdir -p $(BINARIES)
|
mkdir -p $(BINARIES)
|
||||||
cp image.fs $(BINARIES)
|
cp image.fs $(BINARIES)
|
||||||
cp a.rim $(BINARIES)
|
cp a.rim $(BINARIES)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f a.rim image.fs a.lst n.out
|
rm -f a.rim image.fs a.lst n.out altimage.fs alta.rim alta.lst
|
||||||
rm -rf $(BINDIR)
|
rm -rf $(BINDIR)
|
||||||
rm -rf $(TESTDIR)
|
rm -rf $(TESTDIR)
|
||||||
rm -rf $(BINARIES)
|
rm -rf $(BINARIES)
|
||||||
@@ -62,6 +81,11 @@ cmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \
|
|||||||
$(BINDIR)/chown $(BINDIR)/chrm $(BINDIR)/cp $(BINDIR)/ds $(BINDIR)/ed \
|
$(BINDIR)/chown $(BINDIR)/chrm $(BINDIR)/cp $(BINDIR)/ds $(BINDIR)/ed \
|
||||||
$(BINDIR)/init
|
$(BINDIR)/init
|
||||||
|
|
||||||
|
# Alternate commands: no dd, but . and ..
|
||||||
|
altcmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \
|
||||||
|
$(BINDIR)/chown $(BINDIR)/altchrm $(BINDIR)/cp $(BINDIR)/ds $(BINDIR)/ed \
|
||||||
|
$(BINDIR)/altinit
|
||||||
|
|
||||||
$(BINDIR)/as: $(CMDSRC)/as.s
|
$(BINDIR)/as: $(CMDSRC)/as.s
|
||||||
$(AS) $(ASARGS) -o $(BINDIR)/as $(CMDSRC)/as.s
|
$(AS) $(ASARGS) -o $(BINDIR)/as $(CMDSRC)/as.s
|
||||||
|
|
||||||
@@ -80,6 +104,9 @@ $(BINDIR)/chown: $(CMDSRC)/chown.s
|
|||||||
$(BINDIR)/chrm: $(CMDSRC)/chrm.s
|
$(BINDIR)/chrm: $(CMDSRC)/chrm.s
|
||||||
$(AS) $(ASARGS) -o $(BINDIR)/chrm $(CMDSRC)/chrm.s
|
$(AS) $(ASARGS) -o $(BINDIR)/chrm $(CMDSRC)/chrm.s
|
||||||
|
|
||||||
|
$(BINDIR)/altchrm: $(OTHERSRC)/wktchrm.s
|
||||||
|
$(AS) $(ASARGS) -o $(BINDIR)/altchrm -DNO_DD $(OTHERSRC)/wktchrm.s
|
||||||
|
|
||||||
$(BINDIR)/cp: $(CMDSRC)/cp.s
|
$(BINDIR)/cp: $(CMDSRC)/cp.s
|
||||||
$(AS) $(ASARGS) -o $(BINDIR)/cp $(CMDSRC)/cp.s
|
$(AS) $(ASARGS) -o $(BINDIR)/cp $(CMDSRC)/cp.s
|
||||||
|
|
||||||
@@ -92,10 +119,19 @@ $(BINDIR)/ed: $(CMDSRC)/ed1.s $(CMDSRC)/ed2.s
|
|||||||
$(BINDIR)/init: $(CMDSRC)/init.s
|
$(BINDIR)/init: $(CMDSRC)/init.s
|
||||||
$(AS) $(ASARGS) -o $(BINDIR)/init $(CMDSRC)/init.s
|
$(AS) $(ASARGS) -o $(BINDIR)/init $(CMDSRC)/init.s
|
||||||
|
|
||||||
|
# Alternative init: no dd directory
|
||||||
|
$(BINDIR)/altinit: $(CMDSRC)/init.s
|
||||||
|
$(AS) $(ASARGS) -DNO_DD -o $(BINDIR)/altinit $(CMDSRC)/init.s
|
||||||
|
|
||||||
# The commands that did not come from the scans
|
# The commands that did not come from the scans
|
||||||
others: dirs $(BINDIR)/sh $(BINDIR)/wktcat $(BINDIR)/wktcp $(BINDIR)/date \
|
others: dirs $(BINDIR)/sh $(BINDIR)/wktcat $(BINDIR)/wktcp $(BINDIR)/date \
|
||||||
$(BINDIR)/ln $(BINDIR)/ls $(BINDIR)/mv $(BINDIR)/stat
|
$(BINDIR)/ln $(BINDIR)/ls $(BINDIR)/mv $(BINDIR)/stat
|
||||||
|
|
||||||
|
# Alternative other commands: no dd, but . and ..
|
||||||
|
altothers: dirs $(BINDIR)/sh $(BINDIR)/wktcat $(BINDIR)/wktcp $(BINDIR)/date \
|
||||||
|
$(BINDIR)/ln $(BINDIR)/altls $(BINDIR)/mv $(BINDIR)/stat
|
||||||
|
|
||||||
|
|
||||||
$(BINDIR)/sh: $(OTHERSRC)/pbsh.s
|
$(BINDIR)/sh: $(OTHERSRC)/pbsh.s
|
||||||
$(AS) $(ASARGS) -o $(BINDIR)/sh $(OTHERSRC)/pbsh.s
|
$(AS) $(ASARGS) -o $(BINDIR)/sh $(OTHERSRC)/pbsh.s
|
||||||
|
|
||||||
@@ -114,6 +150,9 @@ $(BINDIR)/ln: $(OTHERSRC)/wktln.s
|
|||||||
$(BINDIR)/ls: $(OTHERSRC)/wktls.s
|
$(BINDIR)/ls: $(OTHERSRC)/wktls.s
|
||||||
$(AS) $(ASARGS) -o $(BINDIR)/ls $(OTHERSRC)/wktls.s
|
$(AS) $(ASARGS) -o $(BINDIR)/ls $(OTHERSRC)/wktls.s
|
||||||
|
|
||||||
|
$(BINDIR)/altls: $(OTHERSRC)/wktls.s
|
||||||
|
$(AS) $(ASARGS) -o $(BINDIR)/altls -DNO_DD $(OTHERSRC)/wktls.s
|
||||||
|
|
||||||
$(BINDIR)/mv: $(OTHERSRC)/wktmv.s
|
$(BINDIR)/mv: $(OTHERSRC)/wktmv.s
|
||||||
$(AS) $(ASARGS) -o $(BINDIR)/mv $(OTHERSRC)/wktmv.s
|
$(AS) $(ASARGS) -o $(BINDIR)/mv $(OTHERSRC)/wktmv.s
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Alternative prototype file for PDP-7 Unix filesystem layout
|
||||||
|
#
|
||||||
|
# This one has . and .. but no dd directory entries
|
||||||
|
#
|
||||||
|
# Entries are one of:
|
||||||
|
# filename f[r-][w-][r-][w-] uid local_file_to_insert
|
||||||
|
# dirname d[r-][w-][r-][w-] uid [inumber]
|
||||||
|
# device i[r-][w-][r-][w-] uid inumber
|
||||||
|
# link l---- inumber
|
||||||
|
#
|
||||||
|
# The top directory's name is ignored
|
||||||
|
# Numeric values are in decimal
|
||||||
|
# Contents of each directory ends with a $ on a line by itself
|
||||||
|
# Format was inspired by 6th Edition mkfs
|
||||||
|
#
|
||||||
|
/ drwr- -1 2
|
||||||
|
system drwr- -1 3
|
||||||
|
ttyin irwr- -1 6
|
||||||
|
keyboard irwr- -1 7
|
||||||
|
pptin irwr- -1 8
|
||||||
|
ttyout irwr- -1 11
|
||||||
|
display irwr- -1 12
|
||||||
|
pptout irwr- -1 13
|
||||||
|
as frwr- -1 bin/as
|
||||||
|
cat frwr- -1 bin/cat
|
||||||
|
chmod frwr- -1 bin/chmod
|
||||||
|
chown frwr- -1 bin/chown
|
||||||
|
chrm frwr- -1 bin/altchrm
|
||||||
|
cp frwr- -1 bin/cp
|
||||||
|
date frwr- -1 bin/date
|
||||||
|
ds frwr- -1 bin/ds
|
||||||
|
ed frwr- -1 bin/ed
|
||||||
|
init frwr- -1 bin/altinit
|
||||||
|
ln frwr- -1 bin/ln
|
||||||
|
ls frwr- -1 bin/altls
|
||||||
|
mv frwr- -1 bin/mv
|
||||||
|
password frw-- -1 fs/password
|
||||||
|
sh frwr- -1 bin/sh
|
||||||
|
stat frwr- -1 bin/stat
|
||||||
|
$
|
||||||
|
ken drwr- 10
|
||||||
|
system l---- 3
|
||||||
|
hello frwr- 10 fs/hello
|
||||||
|
$
|
||||||
|
dmr drwr- 12
|
||||||
|
system l---- 3
|
||||||
|
$
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
set cpu 8k
|
||||||
|
set cpu eae
|
||||||
|
set cpu history=100
|
||||||
|
show cpu
|
||||||
|
|
||||||
|
set tti unix
|
||||||
|
set rb ena
|
||||||
|
att rb altimage.fs
|
||||||
|
show dev
|
||||||
|
|
||||||
|
load -S alta.rim
|
||||||
|
dep pc 0100
|
||||||
+8
-2
@@ -124,8 +124,12 @@ login:
|
|||||||
2:
|
2:
|
||||||
lac nchar
|
lac nchar
|
||||||
sys setuid " Set the user's user-id
|
sys setuid " Set the user's user-id
|
||||||
sys chdir; dd " and change into the "dd" directory
|
#ifdef NO_DD
|
||||||
sys chdir; dir
|
sys chdir; dotdot " Change into the root directory (out of system)
|
||||||
|
#else
|
||||||
|
sys chdir; dd " Change into the "dd" directory
|
||||||
|
#endif
|
||||||
|
sys chdir; dir " and then the user's home directory
|
||||||
|
|
||||||
lac d2 " Close file descriptor 2
|
lac d2 " Close file descriptor 2
|
||||||
sys close
|
sys close
|
||||||
@@ -249,6 +253,8 @@ m3:
|
|||||||
m3s = .-m3
|
m3s = .-m3
|
||||||
dd:
|
dd:
|
||||||
<dd>;040040;040040;040040
|
<dd>;040040;040040;040040
|
||||||
|
dotdot:
|
||||||
|
<..>;040040;040040;040040
|
||||||
dir:
|
dir:
|
||||||
040040;040040;040040;040040
|
040040;040040;040040;040040
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
" Alternative chrm: chrm file [file file ...]
|
||||||
|
"
|
||||||
|
" Unlink the named files
|
||||||
|
|
||||||
|
lac 017777 " Go to the argc
|
||||||
|
tad d1 " Skip past the argc
|
||||||
|
dac 2f " Save pointing at cmd name, we will skip later
|
||||||
|
lac 017777 i " How many arguments do we have?
|
||||||
|
sad d4
|
||||||
|
sys exit " None, so exit
|
||||||
|
tad dm4 " Subtract 1
|
||||||
|
dac 017777 i " and save in the argc
|
||||||
|
|
||||||
|
1:
|
||||||
|
lac 017777 i " Any arguments left?
|
||||||
|
sna
|
||||||
|
sys exit " No, exit the program
|
||||||
|
tad dm4 " Subtract 4 from the argc and update it
|
||||||
|
dac 017777 i
|
||||||
|
lac 2f " Move up to the next filename
|
||||||
|
tad d4
|
||||||
|
dac 2f " and save it in the unlink arg
|
||||||
|
sys unlink; 2:0 " Unlink the file
|
||||||
|
sma
|
||||||
|
jmp 1b " Loop back if the unlink was OK, or issue err
|
||||||
|
lac 2b " Copy the filename pointer below
|
||||||
|
dac 2f
|
||||||
|
lac d1 " Write the filename on stdout
|
||||||
|
sys write; 2:0; 4
|
||||||
|
lac d1
|
||||||
|
sys write; 1f; 2 " Write " ?\n" on stdout
|
||||||
|
jmp 1b " and loop back
|
||||||
|
|
||||||
|
1:
|
||||||
|
040077;012000 " String literal " ?\n"
|
||||||
|
dd:
|
||||||
|
<dd>;040040;040040;040040 " Filename dd
|
||||||
|
d1: 1
|
||||||
|
d4: 4
|
||||||
|
d5: 5
|
||||||
|
dm4: -4
|
||||||
@@ -23,7 +23,9 @@ argloop:
|
|||||||
jmp setlong
|
jmp setlong
|
||||||
|
|
||||||
lac argptr " It wasn't -l, so save it as the dir to open
|
lac argptr " It wasn't -l, so save it as the dir to open
|
||||||
|
#ifndef NO_DD
|
||||||
dac 8f
|
dac 8f
|
||||||
|
#endif
|
||||||
dac 9f
|
dac 9f
|
||||||
skp
|
skp
|
||||||
|
|
||||||
@@ -79,7 +81,11 @@ entryloop:
|
|||||||
lac bufptr
|
lac bufptr
|
||||||
dac statfile " Copy the pointer to the status call
|
dac statfile " Copy the pointer to the status call
|
||||||
lac statbufptr " Get the file's details into the statbuf
|
lac statbufptr " Get the file's details into the statbuf
|
||||||
|
#ifdef NO_DD
|
||||||
|
sys status; statfile:0
|
||||||
|
#else
|
||||||
sys status; 8:curdir; statfile:0
|
sys status; 8:curdir; statfile:0
|
||||||
|
#endif
|
||||||
spa
|
spa
|
||||||
jms fileend
|
jms fileend
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,13 @@
|
|||||||
" file status (stat) system call
|
" file status (stat) system call
|
||||||
" AC/ pointer to status (inode) buffer + i-num (13 words)
|
" AC/ pointer to status (inode) buffer + i-num (13 words)
|
||||||
" sys status; dir_name_ptr; file_name_ptr
|
" sys status; dir_name_ptr; file_name_ptr
|
||||||
|
" NO_DD version: sys status; file_name_ptr
|
||||||
.status:
|
.status:
|
||||||
|
#ifdef NO_DD
|
||||||
|
jms arg " fetch file name pointer
|
||||||
|
dac .+3
|
||||||
|
lac u.cdir " get current working directory
|
||||||
|
#else
|
||||||
jms arg " fetch directory name pointer
|
jms arg " fetch directory name pointer
|
||||||
dac .+5
|
dac .+5
|
||||||
jms arg " fetch file name pointer
|
jms arg " fetch file name pointer
|
||||||
@@ -12,6 +18,7 @@
|
|||||||
lac u.cdir " get current working directory
|
lac u.cdir " get current working directory
|
||||||
jms namei; .. " look up source directory
|
jms namei; .. " look up source directory
|
||||||
jms error " not found: return error to user
|
jms error " not found: return error to user
|
||||||
|
#endif
|
||||||
jms namei; .. " look up file
|
jms namei; .. " look up file
|
||||||
jms error " not found: return error
|
jms error " not found: return error
|
||||||
jms iget " read file inode
|
jms iget " read file inode
|
||||||
@@ -103,7 +110,11 @@
|
|||||||
dac 1f
|
dac 1f
|
||||||
jms arg
|
jms arg
|
||||||
dac 2f
|
dac 2f
|
||||||
|
#ifdef NO_DD
|
||||||
|
lac u.cdir " Search the current directory
|
||||||
|
#else
|
||||||
lac d4 " Search the directory at i-num 4
|
lac d4 " Search the directory at i-num 4
|
||||||
|
#endif
|
||||||
jms namei; 0:0 " for the first argument
|
jms namei; 0:0 " for the first argument
|
||||||
jms error " Didn't find it
|
jms error " Didn't find it
|
||||||
jms namei; 1:0 " In the i-num found by 1st namei,
|
jms namei; 1:0 " In the i-num found by 1st namei,
|
||||||
|
|||||||
+10
-3
@@ -57,7 +57,7 @@ use constant D_UNIQ => 5;
|
|||||||
use constant D_NUMWORDS => 8; # Eight words in a direntry
|
use constant D_NUMWORDS => 8; # Eight words in a direntry
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
my $debug = 0;
|
my ($debug, $no_dd) = (0,0);
|
||||||
my @Block; # Array of blocks and words in each block
|
my @Block; # Array of blocks and words in each block
|
||||||
my @Freelist; # List of free block numbers
|
my @Freelist; # List of free block numbers
|
||||||
my @Usedlist; # List of in-use block numbers
|
my @Usedlist; # List of in-use block numbers
|
||||||
@@ -271,7 +271,10 @@ sub usage {
|
|||||||
|
|
||||||
### MAIN PROGRAM
|
### MAIN PROGRAM
|
||||||
|
|
||||||
GetOptions( 'debug|d' => \$debug, )
|
GetOptions(
|
||||||
|
'debug|d' => \$debug,
|
||||||
|
'no_dd|3' => \$no_dd,
|
||||||
|
)
|
||||||
or usage();
|
or usage();
|
||||||
|
|
||||||
usage() if ( @ARGV < 1 );
|
usage() if ( @ARGV < 1 );
|
||||||
@@ -327,6 +330,10 @@ foreach my $inode ( 0 .. NUMINODEBLKS * INODESPERBLK - 1 ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Now check the directories. We start with dd at i-num 4.
|
# Now check the directories. We start with dd at i-num 4.
|
||||||
check_directory( 4, "dd" );
|
if ($no_dd) {
|
||||||
|
check_directory( 2, "" );
|
||||||
|
} else {
|
||||||
|
check_directory( 4, "dd" );
|
||||||
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
+7
-4
@@ -55,7 +55,7 @@ use constant D_UNIQ => 5;
|
|||||||
use constant D_NUMWORDS => 8; # Eight words in a direntry
|
use constant D_NUMWORDS => 8; # Eight words in a direntry
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
my ($debug,$wantdot,$wantdotdot)=(0,0,0);
|
my ($debug,$wantdot,$wantdotdot, $no_dd)=(0,0,0,0);
|
||||||
my @Block; # Array of blocks and words in each block
|
my @Block; # Array of blocks and words in each block
|
||||||
my @Freelist; # List of free block numbers
|
my @Freelist; # List of free block numbers
|
||||||
my $nextinum = 1; # i-num 0 is never used
|
my $nextinum = 1; # i-num 0 is never used
|
||||||
@@ -353,9 +353,11 @@ sub make_dir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Finally, add a "dd" entry to this directory. We get the
|
# Finally, add a "dd" entry to this directory. We get the
|
||||||
# i-num from the first entry in the Dirstack
|
# i-num from the first entry in the Dirstack. Sorry for the dbl negative.
|
||||||
add_direntry( "dd", $Dirstack[0]->[2] );
|
if (!$no_dd) {
|
||||||
dprintf("Added a dd entry to i-num %d\n", $Dirstack[0]->[2] );
|
add_direntry( "dd", $Dirstack[0]->[2] );
|
||||||
|
dprintf("Added a dd entry to i-num %d\n", $Dirstack[0]->[2] );
|
||||||
|
}
|
||||||
|
|
||||||
dprintf( "Made directory %s perms %06o uid %d in inum %d\n\n",
|
dprintf( "Made directory %s perms %06o uid %d in inum %d\n\n",
|
||||||
$dirname, $perms, $uid, $inum );
|
$dirname, $perms, $uid, $inum );
|
||||||
@@ -643,6 +645,7 @@ GetOptions(
|
|||||||
'debug|d' => \$debug,
|
'debug|d' => \$debug,
|
||||||
'dot|1' => \$wantdot,
|
'dot|1' => \$wantdot,
|
||||||
'dotdot|2' => \$wantdotdot,
|
'dotdot|2' => \$wantdotdot,
|
||||||
|
'no_dd|3' => \$no_dd,
|
||||||
'format|f=s' => \$format,
|
'format|f=s' => \$format,
|
||||||
'output|o=s' => \$output,
|
'output|o=s' => \$output,
|
||||||
) or usage();
|
) or usage();
|
||||||
|
|||||||
Reference in New Issue
Block a user