-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
205 changed files
with
19,303 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,190 @@ | ||
The modified portion from original pintos, is subject to the following license: | ||
|
||
RECEX SHARED SOURCE LICENSE | ||
version 1.0, 30 May 2013 | ||
|
||
Copyright (c) 2020 Casys lab, KAIST. <http://casys.kaist.ac.kr> | ||
Everyone is permitted to copy and distribute verbatim | ||
copies of this license document, but changing it is | ||
not allowed. | ||
|
||
TERMS AND CONDITIONS | ||
|
||
0. Definitions. | ||
|
||
"This License" refers to version 1.0 of RecEx Shared | ||
Source License. | ||
|
||
"The program", "the source", "the source code", "these | ||
files", "this file" refers to any copyrightable work | ||
licensed under this License. | ||
|
||
"You" refers to the Licensee. The licensee could be a | ||
person or a organisation. | ||
|
||
"personal use" refers to usage by, only and only, the | ||
licensee, and not by any other person or organisation | ||
related in any way to the licensee. | ||
|
||
1. Usage | ||
|
||
You are free to download, copy, compile, study, and | ||
refer to the source code for any personal use of yours. | ||
|
||
Usage by you of any work covered by this license should | ||
not, directly or indirectly, enable its usage by any | ||
other individual or organisation. | ||
|
||
2. Modifications | ||
|
||
You are free to make any modifications to the source | ||
covered by this license. You are also free to compile | ||
the source after modifying it and using the compiled | ||
product obtained thereafter in compliance with this | ||
License. | ||
|
||
3. Redistribution | ||
|
||
You may NOT under any circumstance copy, redistribute | ||
and/or republish the source or a work based on it (which | ||
includes binary or object code compiled from it) in part | ||
or whole. | ||
|
||
4. Non-compliance | ||
|
||
You may not copy, modify, sublicense, or distribute the | ||
Program except as expressly provided under this License. | ||
Any attempt otherwise to copy, modify, sublicense or | ||
distribute the Program is void, and will automatically | ||
terminate your rights under this License. | ||
|
||
5. Acceptance of License | ||
|
||
You are not required to accept this License, since you have | ||
not signed it. However, nothing else grants you permission | ||
to modify or use the source. These actions are prohibited | ||
by law if you do not accept this License. Therefore, by | ||
modifying or using the source (or any work based on the | ||
source), you indicate your acceptance of this License to do | ||
so, and all its terms and conditions for copying, | ||
redistributing or modifying the source or works based on it. | ||
|
||
6. Permissions | ||
|
||
If you intend to incorporate the source code, in part or whole, | ||
into any free or proprietary program, you need to explicitly | ||
write to the original author(s) to ask for permission. | ||
|
||
7. No Warranty | ||
|
||
The source code licensed under this license is shared "as is". | ||
Since it is intended for sharing as reference, there is no | ||
warranty, of either the source code, or the program compiled | ||
from it. The entire risk of quality or performance of the | ||
program is with you. | ||
|
||
THE ORIGINAL AUTHOR OF THE PROGRAM IS NOT LIABLE TO YOU FOR | ||
DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR | ||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO | ||
USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR | ||
DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR | ||
THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY | ||
OTHER PROGRAMS) | ||
|
||
END OF TERMS AND CONDITIONS | ||
|
||
The original version of the 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,36 @@ | ||
# -*- makefile -*- | ||
|
||
SHELL = /bin/sh | ||
|
||
VPATH = $(SRCDIR) | ||
|
||
# We use x86_64 for now. | ||
CC = gcc | ||
LD = ld | ||
OBJCOPY = objcopy | ||
|
||
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 -Os -fno-omit-frame-pointer -mno-red-zone | ||
CFLAGS += -mcmodel=large -fno-plt -fno-pic -mno-sse | ||
CPPFLAGS = -nostdinc -I$(SRCDIR) -I$(SRCDIR)/include/lib -I$(SRCDIR)/include | ||
CPPFLAGS += -I$(SRCDIR)/include/lib/kernel | ||
ASFLAGS = -Wa,--gstabs -mcmodel=large | ||
LDFLAGS = --no-relax | ||
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 | ||
|
||
%.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,29 @@ | ||
BUILD_SUBDIRS = threads filesys | ||
|
||
all:: | ||
@echo "Run 'make' in subdirectories: $(BUILD_SUBDIRS)." | ||
@echo "This top-level make has only 'clean' targets." | ||
|
||
CLEAN_SUBDIRS = $(BUILD_SUBDIRS) examples | ||
|
||
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 `$(TAGS_SOURCES)` | ||
|
||
tags:: | ||
ctags `$(TAGS_SOURCES)` | ||
|
||
cscope.files:: | ||
$(TAGS_SOURCES) > cscope.files | ||
|
||
cscope:: cscope.files | ||
cscope -b -q -k |
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,64 @@ | ||
# -*- makefile -*- | ||
|
||
SRCDIR = ../.. | ||
|
||
all: os.dsk | ||
|
||
include ../../Make.config | ||
include ../Make.vars | ||
include ../../tests/Make.tests | ||
|
||
# Compiler and assembler options. | ||
os.dsk: CPPFLAGS += -I$(SRCDIR)/lib/kernel | ||
|
||
# Core kernel. | ||
include ../../threads/targets.mk | ||
# User process code. | ||
# include ../../userprog/targets.mk | ||
# Virtual memory code. | ||
# include ../../vm/targets.mk | ||
# Filesystem code. | ||
include ../../filesys/targets.mk | ||
# Library code shared between kernel and user programs. | ||
include ../../lib/targets.mk | ||
# Kernel-specific library code. | ||
include ../../lib/kernel/targets.mk | ||
# Device driver code. | ||
include ../../devices/targets.mk | ||
|
||
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 | ||
|
||
kernel.o: threads/kernel.lds.s $(OBJECTS) | ||
$(LD) $(LDFLAGS) -T $< -o $@ $(OBJECTS) | ||
|
||
kernel.bin: kernel.o | ||
$(OBJCOPY) -O binary -R .note -R .comment -S $< $@.tmp | ||
dd if=$@.tmp of=$@ bs=4096 conv=sync | ||
rm $@.tmp | ||
|
||
threads/loader.o: threads/loader.S kernel.bin | ||
$(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES) -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'` | ||
|
||
loader.bin: threads/loader.o | ||
$(LD) $(LDFLAGS) -N -e start -Ttext 0x7c00 --oformat binary -o $@ $< | ||
|
||
os.dsk: loader.bin kernel.bin | ||
cat $^ > $@ | ||
|
||
clean:: | ||
rm -f $(OBJECTS) $(DEPENDS) | ||
rm -f threads/loader.o threads/kernel.lds.s threads/loader.d | ||
rm -f kernel.o kernel.lds.s | ||
rm -f kernel.bin loader.bin os.dsk | ||
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 |
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,52 @@ | ||
# -*- makefile -*- | ||
|
||
$(PROGS): CPPFLAGS += -I$(SRCDIR)/include/lib/user -I. | ||
$(PROGS): CFLAGS := -fno-stack-protector | ||
|
||
# Linker flags. | ||
$(PROGS): LDFLAGS = -nostdlib -static -Wl,-T,$(LDSCRIPT) | ||
$(PROGS): LDSCRIPT = $(SRCDIR)/lib/user/user.lds | ||
|
||
# Library code shared between kernel and user programs. | ||
lib_SRC = lib/debug.c # Debug code. | ||
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 | ||
|
||
# User level only library code. | ||
lib/user_SRC = lib/user/debug.c # Debug helpers. | ||
lib/user_SRC += lib/user/syscall.c # System calls. | ||
lib/user_SRC += lib/user/console.c # Console code. | ||
|
||
LIB_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(lib_SRC) $(lib/user_SRC))) | ||
LIB_DEP = $(patsubst %.o,%.d,$(LIB_OBJ)) | ||
LIB = lib/user/entry.o libc.a | ||
|
||
PROGS_SRC = $(foreach prog,$(PROGS),$($(prog)_SRC)) | ||
PROGS_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(PROGS_SRC))) | ||
PROGS_DEP = $(patsubst %.o,%.d,$(PROGS_OBJ)) | ||
|
||
all: $(PROGS) | ||
|
||
define TEMPLATE | ||
$(1)_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$($(1)_SRC))) | ||
$(1): $$($(1)_OBJ) $$(LIB) $$(LDSCRIPT) | ||
$$(CC) $$(CFLAGS) $$(LDFLAGS) $$($(1)_OBJ) $$(LIB) -o $$@ | ||
endef | ||
|
||
$(foreach prog,$(PROGS),$(eval $(call TEMPLATE,$(prog)))) | ||
|
||
libc.a: $(LIB_OBJ) | ||
rm -f $@ | ||
ar r $@ $^ | ||
ranlib $@ | ||
|
||
clean:: | ||
rm -f $(PROGS) $(PROGS_OBJ) $(PROGS_DEP) | ||
rm -f $(LIB_DEP) $(LIB_OBJ) lib/user/entry.[do] libc.a | ||
|
||
.PHONY: all clean | ||
|
||
-include $(LIB_DEP) $(PROGS_DEP) |
Oops, something went wrong.