Skip to content

Commit

Permalink
Initial commit, with early history wiped.
Browse files Browse the repository at this point in the history
Earlier commits from March 2017 - Mary 2017 include:

* updated README
* licensing
* fixed kthread arg passing by using stack bottom, not top (LIKE AN IDIOT!).
* kthreads with args/retval wrapping are working but i can't figure out how to actually call them once reconstructed from the stack!
* threading is working! dunno how to return from a thread yet though, haha.
* DOES NOT RUN. context seitching  still in progress
* DOES NOT BUILD.  still working on context switching code
* added initial context switching framework. DOES NOT WORK yet
* Added rust log functionality, closes theseus-os#1
* large reorganization of source
* fix keyboard issues, basic kbd is working now. fixed stupid error in keycodes_ascii crate
* keyboard works now with unsafe VecDeque as a queue, but there's no real issue with it using unsafe static mut
* DOES NOT BUILD. In-progress commit. In the kbd interrupt handler, we cannot use Mutex (will cause deadlock), which means we can't use lazy_static. Tried to use Once<>, but it's not working with RefCells that would allow mutability. Need to find an alternate solution.
* keyboard still causing deadlock somewhere. might be the fact that the KBD_QUEUE mutex is being locked by both the kbd interrupt handler and by the rust_main
* keyboard works on the interrupt side, but my main loop that reads from the KBD_QUEUE in our main function causes the system to lockup...
* keyboard driver compiles but untested at runtime
* keyboard library compiles, but may not work yet. Still need to remove other dependencies on std library, like the queue crate
* added initial keyboard indirection layer and keyboard scancode to ascii library, which will be its own separate crate.
* fixed interrupt table indexing issue
* interrupts work but keyboard handler isn't finished yet, so it can only be triggered once
* added basic serial I/O support for debugging to QEMU console
  • Loading branch information
kevinaboos committed May 15, 2017
0 parents commit 3cf3460
Show file tree
Hide file tree
Showing 53 changed files with 4,363 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Compiled files
*.o
*.so
*.rlib
*.dll

# Executables
*.exe

# Generated by Cargo
/target/

# Build directory
/build/
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language: rust

rust:
- nightly

cache: cargo

before_script:
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=$TRAVIS_RUST_VERSION -y
- source ~/.cargo/env
- rustup component add rust-src
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
- (test -x $HOME/.cargo/bin/rustfmt || cargo install rustfmt)
- (test -x $HOME/.cargo/bin/xargo || cargo install xargo)
- cargo install-update -a

sudo: false

notifications:
email:
on_success: never
on_failure: change

addons:
apt:
packages:
- nasm

script:
- make
101 changes: 101 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
authors = ["Kevin Boos <[email protected]>"]
name = "restful_os"
version = "0.1.0"

[dependencies]
bit_field = "0.7.0"
bitflags = "0.7.0"
multiboot2 = "0.1.0"
once = "0.3.2"
rlibc = "1.0.0"
spin = "0.4.5"
volatile = "0.1.0"
x86 = "0.8.1"
x86_64 = "0.1.0"
cpuio = "0.2.0"


[dependencies.log]
default-features = false
version = "0.3.7"

[dependencies.hole_list_allocator]
path = "libs/hole_list_allocator"

[dependencies.lazy_static]
features = ["spin_no_std"]
version = "0.2.1"

[dependencies.keycodes_ascii]
path = "libs/keycodes_ascii"

[lib]
crate-type = ["staticlib"]
9 changes: 9 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2017 Kevin Boos

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.
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

arch ?= x86_64
target ?= $(arch)-restful_os
kernel := build/kernel-$(arch).bin
iso := build/os-$(arch).iso

rust_os := target/$(target)/debug/librestful_os.a
linker_script := src/arch/arch_$(arch)/boot/linker.ld
grub_cfg := src/arch/arch_$(arch)/boot/grub.cfg
assembly_source_files := $(wildcard src/arch/arch_$(arch)/boot/*.asm)
assembly_object_files := $(patsubst src/arch/arch_$(arch)/boot/%.asm, \
build/arch/$(arch)/%.o, $(assembly_source_files))

.PHONY: all clean run debug iso cargo gdb

all: $(kernel)

clean:
@cargo clean
@rm -rf build

orun:
@qemu-system-x86_64 -cdrom $(iso) -s -serial stdio

odebug:
@qemu-system-x86_64 -cdrom $(iso) -s -S -serial stdio

run: $(iso)
@qemu-system-x86_64 -cdrom $(iso) -s -serial stdio

debug: $(iso)
@qemu-system-x86_64 -cdrom $(iso) -s -S -serial stdio

gdb:
@rust-os-gdb/bin/rust-gdb "build/kernel-x86_64.bin" -ex "target remote :1234"

iso: $(iso)

$(iso): $(kernel) $(grub_cfg)
@mkdir -p build/isofiles/boot/grub
@cp $(kernel) build/isofiles/boot/kernel.bin
@cp $(grub_cfg) build/isofiles/boot/grub
@grub-mkrescue -o $(iso) build/isofiles 2> /dev/null
@rm -r build/isofiles

$(kernel): cargo $(rust_os) $(assembly_object_files) $(linker_script)
@ld -n --gc-sections -T $(linker_script) -o $(kernel) $(assembly_object_files) $(rust_os)

cargo:
@xargo build --target $(target)

# compile assembly files
build/arch/$(arch)/%.o: src/arch/arch_$(arch)/boot/%.asm
@mkdir -p $(shell dirname $@)
@nasm -felf64 $< -o $@
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Theseus OS

Theseus is a new OS that tackles the problem of *state spill*, the harmful yet ubiquitous phenomenon described in our [research paper from EuroSys 2017 here](http://kevinaboos.web.rice.edu/statespy.html).

We have build Theseus from scratch using Rust to completely rethink state management in an OS, with the intention of avoiding state spill or mitigating its effects to the fullest extent possible.

The design of Theseus's components and subsystems is frequently inspired by RESTful architectures used across the Web, so there are also references to its previous name `restful_OS` throughout the repository.


## Setting up Rust

As our OS is based off of [Philipp Oppermann's fantastic Blog OS](htpp://os,phil-opp.com), our setup process is similar to his (taken in part from [his instructions](http://os.phil-opp.com/set-up-rust.html)). We highly encourage you to follow along with his excellent series of blog posts to understand the initial boot-up procedure of our OS on x86-64 architectures.

You will need the current Rust compiler and toolchain by following the [setup instructions here](https://www.rust-lang.org/en-US/install.html).

Basically, just run this command and follow the instructions:
`$ curl https://sh.rustup.rs -sSf | sh`

Because OS development requires many language features that Rust considers to be unstable, you must use a nightly compiler. You can accomplish this with:
`$ rustup default nightly`

Since we're cross compiling for a custom target triple, we need to install the Rust source code:
`$ rustup component add rust-src`

We also need to install Xargo, a drop-in replacement wrapper for Cargo that makes cross-compiling easier:
`$ cargo install xargo`


## Additional Build Environment Setup
Currently we only support building on 64-bit Debian-like Linux distributions (e.g., Ubuntu 16.04). You will need to install the following packages:
* `nasm`
* `grub-mkrescue`
* `grub-pc-bin`
* `mtools`
* `xorriso`
* `qemu`
* others may be required as well, TBD.

To build and run Theseus in QEMU, simply run:
`$ make run`

To run it without rebuilding the whole project:
`$ make orun`



## IDE Setup
The developer's personal preference is to use Visual Studio Code (VS Code), which is officially supported on Rust's [Are We IDE Yet](https://areweideyet.com/) website. Other good options include Atom, Sublime, Eclipse, and Intellij, but we have had the most success developing with VS Code. You'll need to install several plugins, like racer and rust-fmt, to allow whichever IDE you choose to properly understand Rust source code.

## License
The source code is licensed under the MIT License. See the LICENSE-MIT file for more.
2 changes: 2 additions & 0 deletions Xargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-restful_os.dependencies]
collections = {}
2 changes: 2 additions & 0 deletions libs/bump_allocator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by Cargo
/target/
7 changes: 7 additions & 0 deletions libs/bump_allocator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
authors = ["Philipp Oppermann <[email protected]>"]
name = "bump_allocator"
version = "0.1.0"

[dependencies]
spin = "0.4.5"
Loading

0 comments on commit 3cf3460

Please sign in to comment.