-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 64e9941
Showing
645 changed files
with
32,236 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Pintos, including its documentation, is subject to the following | ||
license: | ||
|
||
Copyright (C) 2004, 2005, 2006 Board of Trustees, Leland Stanford | ||
Jr. University. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
A few individual files in Pintos were originally derived from other | ||
projects, but they have been extensively modified for use in Pintos. | ||
The original code falls under the original license, and modifications | ||
for Pintos are additionally covered by the Pintos license above. | ||
|
||
In particular, code derived from Nachos is subject to the following | ||
license: | ||
|
||
/* Copyright (c) 1992-1996 The Regents of the University of California. | ||
All rights reserved. | ||
|
||
Permission to use, copy, modify, and distribute this software | ||
and its documentation for any purpose, without fee, and | ||
without written agreement is hereby granted, provided that the | ||
above copyright notice and the following two paragraphs appear | ||
in all copies of this software. | ||
|
||
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO | ||
ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR | ||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE | ||
AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA | ||
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" | ||
BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO | ||
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR | ||
MODIFICATIONS. | ||
*/ | ||
|
||
Also, code derived from MIT's 6.828 course code is subject to the | ||
following license: | ||
|
||
/* | ||
* Copyright (C) 1997 Massachusetts Institute of Technology | ||
* | ||
* This software is being provided by the copyright holders under the | ||
* following license. By obtaining, using and/or copying this software, | ||
* you agree that you have read, understood, and will comply with the | ||
* following terms and conditions: | ||
* | ||
* Permission to use, copy, modify, distribute, and sell this software | ||
* and its documentation for any purpose and without fee or royalty is | ||
* hereby granted, provided that the full text of this NOTICE appears on | ||
* ALL copies of the software and documentation or portions thereof, | ||
* including modifications, that you make. | ||
* | ||
* THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO | ||
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, | ||
* BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR | ||
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR | ||
* THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY | ||
* THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT | ||
* HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE OR | ||
* DOCUMENTATION. | ||
* | ||
* The name and trademarks of copyright holders may NOT be used in | ||
* advertising or publicity pertaining to the software without specific, | ||
* written prior permission. Title to copyright in this software and any | ||
* associated documentation will at all times remain with copyright | ||
* holders. See the file AUTHORS which should have accompanied this software | ||
* for a list of all copyright holders. | ||
* | ||
* This file may be derived from previously copyrighted software. This | ||
* copyright applies only to those changes made by the copyright | ||
* holders listed in the AUTHORS file. The rest of this file is covered by | ||
* the copyright notices, if any, listed below. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# -*- makefile -*- | ||
|
||
SHELL = /bin/sh | ||
|
||
VPATH = $(SRCDIR) | ||
|
||
# Binary utilities. | ||
# If the host appears to be x86, use the normal tools. | ||
# If it's x86-64, use the compiler and linker in 32-bit mode. | ||
# Otherwise assume cross-tools are installed as i386-elf-*. | ||
X86 = i.86\|pentium.*\|[pk][56]\|nexgen\|viac3\|6x86\|athlon.*\|i86pc | ||
X86_64 = x86_64 | ||
|
||
# Pintos doesn't compile/run properly using gcc 4.3+. | ||
# Force cross compiled older version of GCC (4.1.2) for now. | ||
#CCPROG = /usr/class/cs140/x86_64/bin/i586-elf-gcc | ||
CCPROG = /lusr/opt/gcc-4.2.4/bin/gcc | ||
ifeq ($(strip $(shell command -v $(CCPROG) 2> /dev/null)),) | ||
CCPROG = gcc | ||
endif | ||
|
||
ifneq (0, $(shell expr `uname -m` : '$(X86)')) | ||
CC = $(CCPROG) | ||
LD = ld | ||
OBJCOPY = objcopy | ||
else | ||
ifneq (0, $(shell expr `uname -m` : '$(X86_64)')) | ||
CC = $(CCPROG) -m32 | ||
LD = ld -melf_i386 | ||
OBJCOPY = objcopy | ||
else | ||
CC = i386-elf-gcc | ||
LD = i386-elf-ld | ||
OBJCOPY = i386-elf-objcopy | ||
endif | ||
endif | ||
|
||
|
||
ifeq ($(strip $(shell command -v $(CC) 2> /dev/null)),) | ||
$(warning *** Compiler ($(CC)) not found. Did you set $$PATH properly? Please refer to the Getting Started section in the documentation for details. ***) | ||
endif | ||
|
||
# Compiler and assembler invocation. | ||
DEFINES = | ||
WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wsystem-headers | ||
CFLAGS = -g -msoft-float -O | ||
CPPFLAGS = -nostdinc -I$(SRCDIR) -I$(SRCDIR)/lib | ||
ASFLAGS = -Wa,--gstabs | ||
LDFLAGS = | ||
DEPS = -MMD -MF $(@:.o=.d) | ||
|
||
# Turn off -fstack-protector, which we don't support. | ||
ifeq ($(strip $(shell echo | $(CC) -fno-stack-protector -E - > /dev/null 2>&1; echo $$?)),0) | ||
CFLAGS += -fno-stack-protector | ||
endif | ||
|
||
# Turn off --build-id in the linker, which confuses the Pintos loader. | ||
#ifeq ($(strip $(shell $(LD) --build-id=none -e 0 /dev/null -o /dev/null 2>&1; echo $$?)),0) | ||
#LDFLAGS += -Wl,--build-id=none | ||
#endif | ||
|
||
%.o: %.c | ||
$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) $(WARNINGS) $(DEFINES) $(DEPS) | ||
|
||
%.o: %.S | ||
$(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES) $(DEPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
BUILD_SUBDIRS = threads userprog vm filesys | ||
|
||
all:: | ||
@echo "Run 'make' in subdirectories: $(BUILD_SUBDIRS)." | ||
@echo "This top-level make has only 'clean' targets." | ||
|
||
CLEAN_SUBDIRS = $(BUILD_SUBDIRS) examples utils | ||
|
||
clean:: | ||
for d in $(CLEAN_SUBDIRS); do $(MAKE) -C $$d $@; done | ||
rm -f TAGS tags | ||
|
||
distclean:: clean | ||
find . -name '*~' -exec rm '{}' \; | ||
|
||
TAGS_SUBDIRS = $(BUILD_SUBDIRS) devices lib | ||
TAGS_SOURCES = find $(TAGS_SUBDIRS) -name \*.[chS] -print | ||
|
||
TAGS:: | ||
etags --members `$(TAGS_SOURCES)` | ||
|
||
tags:: | ||
ctags -T --no-warn `$(TAGS_SOURCES)` | ||
|
||
cscope.files:: | ||
$(TAGS_SOURCES) > cscope.files | ||
|
||
cscope:: cscope.files | ||
cscope -b -q -k | ||
|
||
################## | ||
# Handin your work | ||
################## | ||
TAID = "yjkwon" | ||
|
||
turnin.tar: clean | ||
tar cf turnin.tar `find . -type f | grep -v '^\.*$$' | grep -v '/CVS/' | grep -v '/\.svn/' | grep -v '/\.git/' | grep -v '*\.tar\.gz' | grep -v '/\~/' | grep -v '/\.txt' | grep -v '/\.pl' |grep -v '/\.tar/'` | ||
|
||
TURNIN := /lusr/bin/turnin | ||
GRADER := benbb | ||
LAB1_NAME := threads | ||
LAB2_NAME := user | ||
LAB3_NAME := vm | ||
LAB4_NAME := fs | ||
|
||
turnin_threads: turnin.tar | ||
echo "Turning in threads_turnin.tar containing the following files:" | ||
tar tf turnin.tar | ||
mv turnin.tar threads_turnin.tar | ||
$(TURNIN) --submit $(GRADER) $(LAB1_NAME) threads_turnin.tar | ||
|
||
turnin_user: turnin.tar | ||
echo "Turning in user_turnin.tar containing the following files:" | ||
tar tf turnin.tar | ||
mv turnin.tar user_turnin.tar | ||
$(TURNIN) --submit $(GRADER) $(LAB2_NAME) user_turnin.tar | ||
|
||
turnin_vm: turnin.tar | ||
echo "Turning in vm_turnin.tar containing the following files:" | ||
tar tf turnin.tar | ||
mv turnin.tar vm_turnin.tar | ||
$(TURNIN) --submit $(GRADER) $(LAB3_NAME) vm_turnin.tar | ||
|
||
turnin_fs: turnin.tar | ||
echo "Turning in fs_turnin.tar containing the following files:" | ||
tar tf turnin.tar | ||
mv turnin.tar fs_turnin.tar | ||
$(TURNIN) --submit $(GRADER) $(LAB4_NAME) fs_turnin.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# -*- makefile -*- | ||
|
||
# WARNING: Don't edit me! I am automatically generated. | ||
|
||
SRCDIR = ../.. | ||
|
||
all: kernel.bin loader.bin | ||
|
||
include ../../Make.config | ||
include ../Make.vars | ||
include ../../tests/Make.tests | ||
|
||
# Compiler and assembler options. | ||
kernel.bin: CPPFLAGS += -I$(SRCDIR)/lib/kernel | ||
|
||
# Core kernel. | ||
threads_SRC = threads/start.S # Startup code. | ||
threads_SRC += threads/init.c # Main program. | ||
threads_SRC += threads/thread.c # Thread management core. | ||
threads_SRC += threads/switch.S # Thread switch routine. | ||
threads_SRC += threads/interrupt.c # Interrupt core. | ||
threads_SRC += threads/intr-stubs.S # Interrupt stubs. | ||
threads_SRC += threads/synch.c # Synchronization. | ||
threads_SRC += threads/palloc.c # Page allocator. | ||
threads_SRC += threads/malloc.c # Subpage allocator. | ||
|
||
# Device driver code. | ||
devices_SRC = devices/pit.c # Programmable interrupt timer chip. | ||
devices_SRC += devices/timer.c # Periodic timer device. | ||
devices_SRC += devices/kbd.c # Keyboard device. | ||
devices_SRC += devices/vga.c # Video device. | ||
devices_SRC += devices/serial.c # Serial port device. | ||
devices_SRC += devices/block.c # Block device abstraction layer. | ||
devices_SRC += devices/partition.c # Partition block device. | ||
devices_SRC += devices/ide.c # IDE disk block device. | ||
devices_SRC += devices/input.c # Serial and keyboard input. | ||
devices_SRC += devices/intq.c # Interrupt queue. | ||
devices_SRC += devices/rtc.c # Real-time clock. | ||
devices_SRC += devices/shutdown.c # Reboot and power off. | ||
devices_SRC += devices/speaker.c # PC speaker. | ||
|
||
# Library code shared between kernel and user programs. | ||
lib_SRC = lib/debug.c # Debug helpers. | ||
lib_SRC += lib/random.c # Pseudo-random numbers. | ||
lib_SRC += lib/stdio.c # I/O library. | ||
lib_SRC += lib/stdlib.c # Utility functions. | ||
lib_SRC += lib/string.c # String functions. | ||
lib_SRC += lib/arithmetic.c # 64-bit arithmetic for GCC. | ||
lib_SRC += lib/ustar.c # Unix standard tar format utilities. | ||
|
||
# Kernel-specific library code. | ||
lib/kernel_SRC = lib/kernel/debug.c # Debug helpers. | ||
lib/kernel_SRC += lib/kernel/list.c # Doubly-linked lists. | ||
lib/kernel_SRC += lib/kernel/bitmap.c # Bitmaps. | ||
lib/kernel_SRC += lib/kernel/hash.c # Hash tables. | ||
lib/kernel_SRC += lib/kernel/console.c # printf(), putchar(). | ||
|
||
# User process code. | ||
userprog_SRC = userprog/process.c # Process loading. | ||
userprog_SRC += userprog/pagedir.c # Page directories. | ||
userprog_SRC += userprog/exception.c # User exception handler. | ||
userprog_SRC += userprog/syscall.c # System call handler. | ||
userprog_SRC += userprog/gdt.c # GDT initialization. | ||
userprog_SRC += userprog/tss.c # TSS management. | ||
|
||
# No virtual memory code yet. | ||
#vm_SRC = vm/file.c # Some file. | ||
|
||
# Filesystem code. | ||
filesys_SRC = filesys/filesys.c # Filesystem core. | ||
filesys_SRC += filesys/free-map.c # Free sector bitmap. | ||
filesys_SRC += filesys/file.c # Files. | ||
filesys_SRC += filesys/directory.c # Directories. | ||
filesys_SRC += filesys/inode.c # File headers. | ||
filesys_SRC += filesys/fsutil.c # Utilities. | ||
|
||
SOURCES = $(foreach dir,$(KERNEL_SUBDIRS),$($(dir)_SRC)) | ||
OBJECTS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCES))) | ||
DEPENDS = $(patsubst %.o,%.d,$(OBJECTS)) | ||
|
||
threads/kernel.lds.s: CPPFLAGS += -P | ||
threads/kernel.lds.s: threads/kernel.lds.S threads/loader.h | ||
|
||
kernel.o: threads/kernel.lds.s $(OBJECTS) | ||
$(LD) -T $< -o $@ $(OBJECTS) | ||
|
||
kernel.bin: kernel.o | ||
$(OBJCOPY) -R .note -R .comment -S $< $@ | ||
|
||
threads/loader.o: threads/loader.S | ||
$(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES) | ||
|
||
loader.bin: threads/loader.o | ||
$(LD) -N -e 0 -Ttext 0x7c00 --oformat binary -o $@ $< | ||
|
||
os.dsk: kernel.bin | ||
cat $^ > $@ | ||
|
||
clean:: | ||
rm -f $(OBJECTS) $(DEPENDS) | ||
rm -f threads/loader.o threads/kernel.lds.s threads/loader.d | ||
rm -f kernel.bin.tmp | ||
rm -f kernel.o kernel.lds.s | ||
rm -f kernel.bin loader.bin | ||
rm -f bochsout.txt bochsrc.txt | ||
rm -f results grade | ||
|
||
Makefile: $(SRCDIR)/Makefile.build | ||
cp $< $@ | ||
|
||
-include $(DEPENDS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- makefile -*- | ||
|
||
all: | ||
|
||
include Make.vars | ||
|
||
DIRS = $(sort $(addprefix build/,$(KERNEL_SUBDIRS) $(TEST_SUBDIRS) lib/user)) | ||
|
||
all grade check: $(DIRS) build/Makefile | ||
cd build && $(MAKE) $@ | ||
$(DIRS): | ||
mkdir -p $@ | ||
build/Makefile: ../Makefile.build | ||
cp $< $@ | ||
|
||
build/%: $(DIRS) build/Makefile | ||
cd build && $(MAKE) $* | ||
|
||
clean: | ||
rm -rf build |
Oops, something went wrong.