Initial Spring 2016 commit.

This commit is contained in:
Geoffrey Challen
2015-12-23 00:50:04 +00:00
commit cafa9f5690
732 changed files with 92195 additions and 0 deletions

32
kern/conf/DUMBVM Normal file
View File

@@ -0,0 +1,32 @@
# Kernel config file using dumbvm.
# This should be used until you have your own VM system.
include conf/conf.kern # get definitions of available options
debug # Compile with debug info.
#
# Device drivers for hardware.
#
device lamebus0 # System/161 main bus
device emu* at lamebus* # Emulator passthrough filesystem
device ltrace* at lamebus* # trace161 trace control device
device ltimer* at lamebus* # Timer device
device lrandom* at lamebus* # Random device
device lhd* at lamebus* # Disk device
device lser* at lamebus* # Serial port
#device lscreen* at lamebus* # Text screen (not supported yet)
#device lnet* at lamebus* # Network interface (not supported yet)
device beep0 at ltimer* # Abstract beep handler device
device con0 at lser* # Abstract console on serial port
#device con0 at lscreen* # Abstract console on screen (not supported)
device rtclock0 at ltimer* # Abstract realtime clock
device random0 at lrandom* # Abstract randomness device
#options net # Network stack (not supported)
options semfs # Semaphores for userland
options sfs # Always use the file system
#options netfs # You might write this as a project.
options dumbvm # Chewing gum and baling wire.

36
kern/conf/DUMBVM-OPT Normal file
View File

@@ -0,0 +1,36 @@
# Kernel config file using dumbvm.
# This should be used until you have your own VM system.
#
# This config builds with optimization for performance testing.
#
include conf/conf.kern # get definitions of available options
#debug # Optimizing compile (no debug).
options noasserts # Disable assertions.
#
# Device drivers for hardware.
#
device lamebus0 # System/161 main bus
device emu* at lamebus* # Emulator passthrough filesystem
device ltrace* at lamebus* # trace161 trace control device
device ltimer* at lamebus* # Timer device
device lrandom* at lamebus* # Random device
device lhd* at lamebus* # Disk device
device lser* at lamebus* # Serial port
#device lscreen* at lamebus* # Text screen (not supported yet)
#device lnet* at lamebus* # Network interface (not supported yet)
device beep0 at ltimer* # Abstract beep handler device
device con0 at lser* # Abstract console on serial port
#device con0 at lscreen* # Abstract console on screen (not supported)
device rtclock0 at ltimer* # Abstract realtime clock
device random0 at lrandom* # Abstract randomness device
#options net # Network stack (not supported)
options semfs # Semaphores for userland
options sfs # Always use the file system
#options netfs # You might write this as a project.
options dumbvm # Chewing gum and baling wire.

33
kern/conf/GENERIC Normal file
View File

@@ -0,0 +1,33 @@
# Kernel config file for an ordinary, generic kernel.
# This config file should be used once you start working on
# your own VM system.
include conf/conf.kern # get definitions of available options
debug # Compile with debug info.
#
# Device drivers for hardware.
#
device lamebus0 # System/161 main bus
device emu* at lamebus* # Emulator passthrough filesystem
device ltrace* at lamebus* # trace161 trace control device
device ltimer* at lamebus* # Timer device
device lrandom* at lamebus* # Random device
device lhd* at lamebus* # Disk device
device lser* at lamebus* # Serial port
#device lscreen* at lamebus* # Text screen (not supported yet)
#device lnet* at lamebus* # Network interface (not supported yet)
device beep0 at ltimer* # Abstract beep handler device
device con0 at lser* # Abstract console on serial port
#device con0 at lscreen* # Abstract console on screen (not supported)
device rtclock0 at ltimer* # Abstract realtime clock
device random0 at lrandom* # Abstract randomness device
#options net # Network stack (not supported)
options semfs # Semaphores for userland
options sfs # Always use the file system
#options netfs # You might write this as a project.
#options dumbvm # Use your own VM system now.

36
kern/conf/GENERIC-OPT Normal file
View File

@@ -0,0 +1,36 @@
# Kernel config file for an ordinary, generic kernel.
# This config file should be used once you start working on
# your own VM system.
#
# This config builds with optimization for performance testing.
include conf/conf.kern # get definitions of available options
#debug # Optimizing compile (no debug).
options noasserts # Disable assertions.
#
# Device drivers for hardware.
#
device lamebus0 # System/161 main bus
device emu* at lamebus* # Emulator passthrough filesystem
device ltrace* at lamebus* # trace161 trace control device
device ltimer* at lamebus* # Timer device
device lrandom* at lamebus* # Random device
device lhd* at lamebus* # Disk device
device lser* at lamebus* # Serial port
#device lscreen* at lamebus* # Text screen (not supported yet)
#device lnet* at lamebus* # Network interface (not supported yet)
device beep0 at ltimer* # Abstract beep handler device
device con0 at lser* # Abstract console on serial port
#device con0 at lscreen* # Abstract console on screen (not supported)
device rtclock0 at ltimer* # Abstract realtime clock
device random0 at lrandom* # Abstract randomness device
#options net # Network stack (not supported)
options semfs # Semaphores for userland
options sfs # Always use the file system
#options netfs # You might write this as a project.
#options dumbvm # Use your own VM system now.

440
kern/conf/conf.kern Normal file
View File

@@ -0,0 +1,440 @@
#
# Machine-independent kernel config definitions.
#
# The idea is that the files, options, and facilities in the system
# are declared by conf.kern and the various files it includes. Then a
# kernel config (such as ASST1, or GENERIC, or TEST, or whatever) is
# used to select options and facilities for a particular kernel build.
#
# To add new files to the system, you need to edit this file (or
# others like it) and rerun the config script.
#
# Note: when running the config script, be sure to be in the
# right directory (the same one this file is in) and run it as
# "./config", not just "config" - in the latter case you will
# probably get the host system's kernel config utility, which
# will likely make a mess and produce mysterious error messages.
#
# The documentation for the syntax of these files follows.
#
############################################################
#
# Kernel config file syntax:
#
# The syntax for including the system definition is:
#
# include conf.kern
#
# This should come first. This is because the system must be
# defined before you can do much else useful.
#
# You can also include other files using the same syntax.
#
#
# The syntax for turning on a kernel compile option is:
#
# options optname
#
# A previous "defoption" must have been seen first. See below
# for more information.
#
# The act of compiling with debug info is (has to be) handled
# specially, and is just "debug" without the "options".
#
#
# The syntax for turning on a device driver is:
#
# device foo%
# device foo% at bar%
#
# where the % is either a number or a star, which is treated as
# a wildcard. The first line enables a device foo that is not
# supposed to be "attached" to anything. The second line enables
# a device foo that is attached to a device bar. For more
# information about what this means, see below.
#
#
############################################################
#
# Kernel definition file syntax:
#
# Note: All source file names are relative to the top directory of the
# kernel source, that is, src/kern.
#
# The syntax for adding a regular source file is:
#
# [machine M | platform P] file sourcefile.c
#
# Such a file is always included automatically in every kernel
# built for machine M, or platform P, or all kernels.
#
#
# The syntax for defining optional source files is:
#
# defoption optname
# [machine M | platform P] optfile optname sourcefile.c
# [machine M | platform P] optofffile optname sourcefile.c
#
# "defoption" declares the name of a kernel option. These are
# then turned on by including "options optname" in a
# kernel config.
#
# Source files added with optfile are compiled in if the option
# specified is enabled. Source files added with optofffile are
# compiled in if the option specified is not enabled.
#
# Additionally, a file "opt-optname.h" is created in the compile
# directory, which defines a C preprocessor symbol OPT_OPTNAME.
# This symbol is #defined to either 0 or 1 in the logical way.
# Thus, you can have small bits of code that are enabled or
# disabled by particular options by writing constructs like
#
# #include "opt-foo.h"
# #if OPT_FOO
# code();
# #else
# other_code();
# #endif
#
# *** Be sure to use #if and not #ifdef - you want the value
# of the symbol.
# *** Be sure to remember to include the header file for the
# option - if you don't, cpp will silently assume it is 0,
# which can be quite frustrating.
#
# The defoption must be seen before any optional file
# declarations that use it.
#
#
# The syntax for defining device drivers is:
#
# defdevice devname sourcefile.c
# defattach devname% otherdevname% sourcefile.c
# pseudoattach devname%
#
# Declare a device driver and its "attachment(s)". (The device
# driver can then be selectively included or not included in any
# particular kernel by using the "device" statement in the
# kernel config file.)
#
# The specified source files are only compiled if the device
# is enabled.
#
# The % is either a specific number N, meaning "only the Nth
# such device can be attached this way", or a star (*), meaning
# "any such device can be attached this way".
#
# In OS/161, device drivers are conceptually organized into
# trees. This mimics the organization of real hardware, where
# several expansion cards are plugged into one bus and there
# might be several devices on each expansion card and so forth.
#
# There can be any number of these trees. However, devices at
# the root of each tree must be able to probe and "find"
# themselves completely on their own. This generally means that
# they are either all software with no hardware, or they are the
# system main bus which is located in a machine-dependent way.
#
# Software-only devices are known as "pseudo-devices". These
# are "attached" with the pseudoattach directive; functions
# of the form
#
# pseudoattach_devname
#
# are called from autoconf.c to create instances as requested.
# These calls are made from the function pseudoconfig(), which
# should be called from dev/init.c after hardware device
# initialization completes. The pseudoattach functions should
# perform all setup and initialization necessary. (No
# config_devname function will be called.)
#
# Devices with attachments are automatically probed and
# configured from code in autoconf.c. This file is generated
# by the config script. It contains functions called
# "autoconf_devname", for each device. These functions call
# other functions, which are supplied by device drivers,
# which have the following hardwired names:
#
# attach_devname1_to_devname2
#
# A "devname2" device has been found and configured;
# this function attempts to probe the devname2 for
# a "devname1" device. Returns NULL if nothing was
# found.
#
# config_devname
#
# A "devname" device has been found. This function
# can then perform initialization that's shared
# among all the possible things it can be attached
# to.
#
# The idea is that there can be multiple attachments for
# the same device to different underlying devices. In the
# real world this can be used to great effect when you have,
# for instance, the same ethernet chipset used on both PCI
# and ISA cards - the chipset behaves the same way in both
# cases, but the probe and attach logic is very different.
#
# The attach_foo_to_bar functions are put in the files
# specified with defattach; the config_foo function (and
# generally the rest of the driver for the foo device) is
# put in the file specified with defdevice.
#
# One selects particular attachments when including the device
# in the kernel. A top-level device with no attachments should
# be included with this syntax:
#
# device bar
#
# A pseudo-device should be included with this syntax:
#
# device bar0
#
# To make use of device foo, which can be found attached to
# device bar, one of the following syntaxes is used:
#
# device foo* at bar*
# device foo* at bar0
# device foo0 at bar*
# device foo0 at bar0
#
# depending on to what extent you want to configure only a
# specific device number.
#
# It sometimes matters what order things are handled in; probes
# occur more or less in the order things appear in the config,
# as constrained by the tree structure of the available devices.
#
# Note that OS/161 does not make extensive use of this
# functionality, and the device driver architecture outlined
# here is overkill for such a limited environment as System/161.
# However, it's similar to the way real systems are organized.
#
#
# The syntax for including other config/definition files is:
#
# include filename
#
# The filename is relative to the top of the kernel source tree.
#
# Thus,
# include conf/conf.foo includes src/kern/conf/conf.foo
#
#
############################################################
########################################
# #
# Generic machine-independent devices. #
# #
########################################
#
# These are abstract system services we expect the system hardware to
# provide: beeping, system console I/O, and time of day clock.
#
# These come before the archinclude so that the hardware device
# definitions, which are included from there, can define attachments
# for them.
#
defdevice beep dev/generic/beep.c
defdevice con dev/generic/console.c
defdevice rtclock dev/generic/rtclock.c
defdevice random dev/generic/random.c
########################################
# #
# Machine-dependent stuff #
# #
########################################
#
# Get the definitions for each machine and platform supported. The
# ones used will be selected by make at compile time based on the
# contents of the top-level defs.mk file.
#
# This will declare a bunch of machine-dependent source files and also
# declare all the hardware devices (since what sorts of hardware we
# expect to find is machine-dependent.)
#
include arch/mips/conf/conf.arch
include arch/sys161/conf/conf.arch
########################################
# #
# Support code #
# #
########################################
#
# Kernel utility code
#
file lib/array.c
file lib/bitmap.c
file lib/bswap.c
file lib/kgets.c
file lib/kprintf.c
file lib/misc.c
file lib/time.c
file lib/uio.c
defoption noasserts
#
# Standard C functions
#
# For most of these, we take the source files from our libc. Note
# that those files have to have been hacked a bit to support this.
#
file ../common/libc/printf/__printf.c
file ../common/libc/printf/snprintf.c
file ../common/libc/stdlib/atoi.c
file ../common/libc/string/bzero.c
file ../common/libc/string/memcpy.c
file ../common/libc/string/memmove.c
file ../common/libc/string/memset.c
file ../common/libc/string/strcat.c
file ../common/libc/string/strchr.c
file ../common/libc/string/strcmp.c
file ../common/libc/string/strcpy.c
file ../common/libc/string/strlen.c
file ../common/libc/string/strrchr.c
file ../common/libc/string/strtok_r.c
########################################
# #
# Core kernel source files #
# #
########################################
#
# Thread system
#
file thread/clock.c
file thread/spl.c
file thread/spinlock.c
file thread/synch.c
file thread/thread.c
file thread/threadlist.c
#
# Process system
#
file proc/proc.c
#
# Virtual memory system
# (you will probably want to add stuff here while doing the VM assignment)
#
file vm/kmalloc.c
optofffile dumbvm vm/addrspace.c
#
# Network
# (nothing here yet)
#
defoption net
#optfile net net/net.c
#
# VFS layer
#
file vfs/device.c
file vfs/vfscwd.c
file vfs/vfsfail.c
file vfs/vfslist.c
file vfs/vfslookup.c
file vfs/vfspath.c
file vfs/vnode.c
#
# VFS devices
#
file vfs/devnull.c
#
# System call layer
# (You will probably want to add stuff here while doing the basic system
# calls assignment.)
#
file syscall/loadelf.c
file syscall/runprogram.c
file syscall/time_syscalls.c
#
# Startup and initialization
#
file main/main.c
file main/menu.c
########################################
# #
# Filesystems #
# #
########################################
#
# semfs (fake filesystem providing userlevel semaphores)
#
defoption semfs
optfile semfs fs/semfs/semfs_fsops.c
optfile semfs fs/semfs/semfs_obj.c
optfile semfs fs/semfs/semfs_vnops.c
#
# sfs (the small/simple filesystem)
#
defoption sfs
optfile sfs fs/sfs/sfs_balloc.c
optfile sfs fs/sfs/sfs_bmap.c
optfile sfs fs/sfs/sfs_dir.c
optfile sfs fs/sfs/sfs_fsops.c
optfile sfs fs/sfs/sfs_inode.c
optfile sfs fs/sfs/sfs_io.c
optfile sfs fs/sfs/sfs_vnops.c
#
# netfs (the networked filesystem - you might write this as one assignment)
#
defoption netfs
#optfile netfs fs/netfs/netfs_fs.c # or whatever
#
# Note that "emufs" is completely contained in the "emu" device.
#
########################################
# #
# Test code #
# #
########################################
file test/arraytest.c
file test/bitmaptest.c
file test/threadlisttest.c
file test/threadtest.c
file test/tt3.c
file test/synchtest.c
file test/semunit.c
file test/kmalloctest.c
file test/fstest.c
optfile net test/nettest.c

1063
kern/conf/config Executable file

File diff suppressed because it is too large Load Diff

67
kern/conf/newvers.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/sh
#
# newvers.sh - increment build number in current directory (a build directory)
# and emit vers.c.
# The build number is kept in the file "version".
#
# Usage: newvers.sh CONFIGNAME
#
# Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
# The President and Fellows of Harvard College.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
if [ ! -f autoconf.c ]; then
#
# If there's no file autoconf.c, we are in the wrong place.
#
echo "$0: Not in a kernel build directory"
exit 1
fi
if [ "x$1" = x ]; then
echo "Usage: $0 CONFIGNAME"
exit 1
fi
CONFIG="$1"
#
# Get and increment the version number
#
VERS=`cat version 2>/dev/null || echo 0`
VERS=`expr $VERS + 1`
echo "$VERS" > version
#
# Write vers.c
#
echo '/* This file is automatically generated. Edits will be lost.*/' > vers.c
echo "const int buildversion = $VERS;" >> vers.c
echo 'const char buildconfig[] = "'"$CONFIG"'";' >> vers.c