Skip to content

Commit c9b85a2

Browse files
author
Yui Kwan Calvin Leung
committed
added Groupname and files in code dir
1 parent bb5295d commit c9b85a2

File tree

215 files changed

+26106
-544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+26106
-544
lines changed

COPYRIGHT

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) 1992-1993 The Regents of the University of California.
2+
All rights reserved.
3+
4+
Permission to use, copy, modify, and distribute this software and its
5+
documentation for any purpose, without fee, and without written agreement is
6+
hereby granted, provided that the above copyright notice and the following
7+
two paragraphs appear in all copies of this software.
8+
9+
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
10+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
11+
OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
12+
CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13+
14+
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
15+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
16+
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
17+
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
18+
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

Group 26

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Group 26
2+
3+
Conner Frey, connerfr
4+
Hung Vu Viet, vuviet
5+
Yui Kwan Calvin Leung, yuikwanl

Makefile

Lines changed: 20 additions & 544 deletions
Large diffs are not rendered by default.

Makefile.common

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# This is part of a GNU Makefile, included by the Makefiles in
2+
# each of the subdirectories.
3+
#
4+
# This file includes all of the baseline code provided by Nachos.
5+
# Whenever you add a .h or .cc file, put it in the appropriate
6+
# _H,_C, or _O list.
7+
#
8+
# The dependency graph between assignments is:
9+
# 1. THREADS before everything else
10+
# 2. USERPROG must come before VM
11+
# 3. USERPROG can come before or after FILESYS, but if USERPROG comes
12+
# before (as in this distribution), then it must define FILESYS_STUB
13+
#
14+
# Other than that, you have complete flexibility.
15+
#
16+
# Also whenever you change the include structure of your program, you should
17+
# do a gmake depend in the subdirectory -- this will modify the Makefile
18+
# to keep track of the new dependency.
19+
20+
# You might want to play with the CFLAGS, but if you use -O it may
21+
# break the thread system. You might want to use -fno-inline if
22+
# you need to call some inline functions from the debugger.
23+
24+
# Copyright (c) 1992 The Regents of the University of California.
25+
# All rights reserved. See copyright.h for copyright notice and limitation
26+
# of liability and disclaimer of warranty provisions.
27+
28+
CFLAGS = -g -Wall -Wno-unused -Wshadow -fwritable-strings $(INCPATH) $(DEFINES) $(HOST) -DCHANGED
29+
LDFLAGS =
30+
31+
# These definitions may change as the software is updated.
32+
# Some of them are also system dependent
33+
CPP=/lib/cpp
34+
CC = /usr/sfw/bin/g++
35+
LD = /usr/sfw/bin/g++
36+
AS = /usr/ccs/bin/as
37+
38+
PROGRAM = nachos
39+
40+
THREAD_H =../threads/copyright.h\
41+
../threads/list.h\
42+
../threads/scheduler.h\
43+
../threads/synch.h \
44+
../threads/synchlist.h\
45+
../threads/system.h\
46+
../threads/thread.h\
47+
../threads/utility.h\
48+
../machine/interrupt.h\
49+
../machine/sysdep.h\
50+
../machine/stats.h\
51+
../machine/timer.h
52+
53+
THREAD_C =../threads/main.cc\
54+
../threads/list.cc\
55+
../threads/scheduler.cc\
56+
../threads/synch.cc \
57+
../threads/synchlist.cc\
58+
../threads/system.cc\
59+
../threads/thread.cc\
60+
../threads/utility.cc\
61+
../threads/threadtest.cc\
62+
../machine/interrupt.cc\
63+
../machine/sysdep.cc\
64+
../machine/stats.cc\
65+
../machine/timer.cc
66+
67+
THREAD_S = ../threads/switch.s
68+
69+
THREAD_O =main.o list.o scheduler.o synch.o synchlist.o system.o thread.o \
70+
utility.o threadtest.o interrupt.o stats.o sysdep.o timer.o
71+
72+
USERPROG_H = ../userprog/addrspace.h\
73+
../userprog/bitmap.h\
74+
../filesys/filesys.h\
75+
../filesys/openfile.h\
76+
../machine/console.h\
77+
../machine/machine.h\
78+
../machine/mipssim.h\
79+
../machine/translate.h
80+
81+
USERPROG_C = ../userprog/addrspace.cc\
82+
../userprog/bitmap.cc\
83+
../userprog/exception.cc\
84+
../userprog/progtest.cc\
85+
../machine/console.cc\
86+
../machine/machine.cc\
87+
../machine/mipssim.cc\
88+
../machine/translate.cc
89+
90+
USERPROG_O = addrspace.o bitmap.o exception.o progtest.o console.o machine.o \
91+
mipssim.o translate.o
92+
93+
VM_H =
94+
VM_C =
95+
VM_O =
96+
97+
FILESYS_H =../filesys/directory.h \
98+
../filesys/filehdr.h\
99+
../filesys/filesys.h \
100+
../filesys/openfile.h\
101+
../filesys/synchdisk.h\
102+
../machine/disk.h
103+
FILESYS_C =../filesys/directory.cc\
104+
../filesys/filehdr.cc\
105+
../filesys/filesys.cc\
106+
../filesys/fstest.cc\
107+
../filesys/openfile.cc\
108+
../filesys/synchdisk.cc\
109+
../machine/disk.cc
110+
FILESYS_O =directory.o filehdr.o filesys.o fstest.o openfile.o synchdisk.o\
111+
disk.o
112+
113+
NETWORK_H = ../network/post.h ../machine/network.h
114+
NETWORK_C = ../network/nettest.cc ../network/post.cc ../machine/network.cc
115+
NETWORK_O = nettest.o post.o network.o
116+
117+
S_OFILES = switch.o
118+
119+
OFILES = $(C_OFILES) $(S_OFILES)
120+
121+
$(PROGRAM): $(OFILES)
122+
$(LD) $(OFILES) $(LDFLAGS) -o $(PROGRAM)
123+
124+
$(C_OFILES): %.o:
125+
$(CC) $(CFLAGS) -c $<
126+
127+
switch.o: ../threads/switch.s
128+
$(CPP) $(CPP_AS_FLAGS) -P $(INCPATH) $(HOST) ../threads/switch.s > swtch.s
129+
$(AS) -o switch.o swtch.s
130+
131+
depend: $(CFILES) $(HFILES)
132+
$(CC) $(INCPATH) $(DEFINES) $(HOST) -DCHANGED -M $(CFILES) > makedep
133+
echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
134+
echo '$$r makedep' >>eddep
135+
echo 'w' >>eddep
136+
ed - Makefile < eddep
137+
rm eddep makedep
138+
echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
139+
echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
140+
echo '# see make depend above' >> Makefile
141+
142+
clean::
143+
rm -f core nachos DISK *.o swtch.s
144+

Makefile.dep

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This is part of a GNU-Makefile, to specify system-dependent
2+
# parts of the Makefile enviroment.
3+
#
4+
# This gets included as part of the GNU-Makefile used in each of
5+
# the subdirectories.
6+
#
7+
8+
# To compile Nachos on an SCF Sparc running SunOS 5.4,
9+
# uncomment the next four lines.
10+
HOST = -DHOST_SPARC -DHOST_IS_BIG_ENDIAN -DHOST_SVR4 -DHOST_SunOS5
11+
CPP = /usr/ccs/lib/cpp
12+
CPP_AS_FLAGS = -D_ASM
13+
LDFLAGS = -lsocket -lnsl -L/usr/ucblib -lucb
14+

README

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Nachos is instructional software for teaching undergraduate, and potentially
2+
graduate, level operating systems courses. The Nachos distribution
3+
comes with:
4+
5+
simple baseline code for a working operating system
6+
a simulator for a generic personal computer/workstation
7+
8+
The assignments illustrate and explore all areas of modern operating
9+
systems, including threads and concurrency, multiprogramming,
10+
system calls, virtual memory, software-loaded TLB's, file systems,
11+
network protocols, remote procedure call, and distributed systems.
12+
13+
To get started, you should:
14+
1. lpr nachos.ps -- print out the paper describing nachos
15+
2. cd code; make print -- print out the nachos source code
16+
3. cd code/c++example; lpr *.ps *.h *.cc -- print out C++ primer
17+
4. cd code; gmake all -- compile nachos source code
18+
19+
The basic Nachos system was written for a MIPS workstation. It has
20+
been ported to other platforms, but as of now, there are a few gotchas.
21+
The Nachos kernel and machine simulator run directly on the host machine,
22+
but user-level programs running on top of Nachos are simulated instruction-by-
23+
instruction. The simulator assumes MIPS object code, in little endian format.
24+
It would take much more work to complete the port and change the CPU
25+
simulator to simulate other instruction sets (although this is under
26+
investigation). Keeping the MIPS CPU causes a one problem:
27+
28+
The Nachos kernel runs runs native mode while the user programs
29+
runs on the simulated CPU. This is a little weird on the non-MIPS workstations
30+
because the user programs are using little endian (typically) and the kernel is
31+
using big endian. Some information (such as the argv[] array) that
32+
is passed between the kernel and the user though user memory must be
33+
byte swapped. (Unfortunately, this isn't as easy to fix as simply
34+
cross-compiling to the SGI MIPS, which is big endian; in a few places,
35+
the simulation assumes little endian format. We're working on fixing this.)
36+

bin/Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Use normal make for this Makefile
2+
#
3+
# Makefile for:
4+
# coff2noff -- converts a normal MIPS executable into a Nachos executable
5+
# disassemble -- disassembles a normal MIPS executable
6+
#
7+
# Copyright (c) 1992 The Regents of the University of California.
8+
# All rights reserved. See copyright.h for copyright notice and limitation
9+
# of liability and disclaimer of warranty provisions.
10+
11+
# If the host is big endian (SPARC, SNAKE, etc):
12+
# change to (disassemble and coff2flat don't support big endian yet):
13+
# CFLAGS= -I./ -I../threads -DHOST_IS_BIG_ENDIAN
14+
# all: coff2noff
15+
16+
CC=gcc
17+
#CFLAGS=-I./ -I../threads
18+
LD=gcc
19+
20+
#all: coff2noff disassemble
21+
22+
CFLAGS= -Wall -I./ -I../threads -DHOST_IS_BIG_ENDIAN
23+
all: coff2noff
24+
25+
26+
# converts a COFF file to Nachos object format
27+
coff2noff: coff2noff.o
28+
$(LD) coff2noff.o -o coff2noff
29+
30+
# converts a COFF file to a flat address space (for Nachos version 2)
31+
coff2flat: coff2flat.o
32+
$(LD) coff2flat.o -o coff2flat
33+
34+
# dis-assembles a COFF file
35+
disassemble: out.o opstrings.o
36+
$(LD) out.o opstrings.o -o disassemble
37+
38+
clean:
39+
rm -f *.o coff2flat coff2noff disassemble out

bin/Makefile.orig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Use normal make for this Makefile
2+
#
3+
# Makefile for:
4+
# coff2noff -- converts a normal MIPS executable into a Nachos executable
5+
# disassemble -- disassembles a normal MIPS executable
6+
#
7+
# Copyright (c) 1992 The Regents of the University of California.
8+
# All rights reserved. See copyright.h for copyright notice and limitation
9+
# of liability and disclaimer of warranty provisions.
10+
11+
# If the host is big endian (SPARC, SNAKE, etc):
12+
# change to (disassemble and coff2flat don't support big endian yet):
13+
# CFLAGS= -I./ -I../threads -DHOST_IS_BIG_ENDIAN
14+
# all: coff2noff
15+
16+
CC=gcc
17+
CFLAGS=-I./ -I../threads
18+
LD=gcc
19+
20+
all: coff2noff disassemble
21+
22+
# converts a COFF file to Nachos object format
23+
coff2noff: coff2noff.o
24+
$(LD) coff2noff.o -o coff2noff
25+
26+
# converts a COFF file to a flat address space (for Nachos version 2)
27+
coff2flat: coff2flat.o
28+
$(LD) coff2flat.o -o coff2flat
29+
30+
# dis-assembles a COFF file
31+
disassemble: out.o opstrings.o
32+
$(LD) out.o opstrings.o -o disassemble

bin/coff.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* coff.h
2+
* Data structures that describe the MIPS COFF format.
3+
*/
4+
5+
struct filehdr {
6+
unsigned short f_magic; /* magic number */
7+
unsigned short f_nscns; /* number of sections */
8+
long f_timdat; /* time & date stamp */
9+
long f_symptr; /* file pointer to symbolic header */
10+
long f_nsyms; /* sizeof(symbolic hdr) */
11+
unsigned short f_opthdr; /* sizeof(optional hdr) */
12+
unsigned short f_flags; /* flags */
13+
};
14+
15+
#define MIPSELMAGIC 0x0162
16+
17+
#define OMAGIC 0407
18+
#define SOMAGIC 0x0701
19+
20+
typedef struct aouthdr {
21+
short magic; /* see above */
22+
short vstamp; /* version stamp */
23+
long tsize; /* text size in bytes, padded to DW bdry*/
24+
long dsize; /* initialized data " " */
25+
long bsize; /* uninitialized data " " */
26+
long entry; /* entry pt. */
27+
long text_start; /* base of text used for this file */
28+
long data_start; /* base of data used for this file */
29+
long bss_start; /* base of bss used for this file */
30+
long gprmask; /* general purpose register mask */
31+
long cprmask[4]; /* co-processor register masks */
32+
long gp_value; /* the gp value used for this object */
33+
} AOUTHDR;
34+
#define AOUTHSZ sizeof(AOUTHDR)
35+
36+
37+
struct scnhdr {
38+
char s_name[8]; /* section name */
39+
long s_paddr; /* physical address, aliased s_nlib */
40+
long s_vaddr; /* virtual address */
41+
long s_size; /* section size */
42+
long s_scnptr; /* file ptr to raw data for section */
43+
long s_relptr; /* file ptr to relocation */
44+
long s_lnnoptr; /* file ptr to gp histogram */
45+
unsigned short s_nreloc; /* number of relocation entries */
46+
unsigned short s_nlnno; /* number of gp histogram entries */
47+
long s_flags; /* flags */
48+
};
49+

0 commit comments

Comments
 (0)