-
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 d5bc6c3
Showing
56 changed files
with
3,306 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,8 @@ | ||
[build] | ||
target = "riscv64gc-unknown-none-elf" | ||
|
||
[target.riscv64gc-unknown-none-elf] | ||
rustflags = "-C target-feature=-c" # Disable compressed instructions | ||
|
||
[unstable] | ||
build-std = ["core", "alloc", "compiler_builtins"] |
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,2 @@ | ||
/target | ||
log.txt |
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,6 @@ | ||
{ | ||
"rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf", | ||
"rust-analyzer.check.allTargets": false, | ||
"rust-analyzer.imports.preferNoStd": true, | ||
"rust-analyzer.showUnlinkedFileNotification": false, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,32 @@ | ||
[workspace] | ||
members = ["allocator", "hal-core", "hal-riscv"] | ||
exclude = ["runner", "usercode"] | ||
resolver = "2" | ||
|
||
[package] | ||
name = "pathos" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
harness = false | ||
test = false | ||
|
||
[[bin]] | ||
name = "pathos" | ||
harness = false | ||
|
||
[dependencies] | ||
hal-riscv = { path = "hal-riscv" } | ||
hal-core = { path = "hal-core" } | ||
allocator = { path = "allocator" } | ||
owo-colors = "4.0.0" | ||
spin = "0.9.8" | ||
once_cell = { version = "1.19.0", features = [ | ||
"alloc", | ||
"race", | ||
], default-features = false } | ||
elf = { version = "0.7.4", default-features = false } | ||
uart_16550 = "0.3.0" |
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,12 @@ | ||
## PathOS kernel code | ||
|
||
This is the kernel code for the PathOS operating system. It is a simple kernel that runs on the RISC-V architecture. | ||
|
||
## Development | ||
|
||
Install riscv64 toolchain to ~/.local/bin | ||
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-riscv64-linux.tar.gz | ||
|
||
Install `qemu-system` and `qemu-system-riscv64`. | ||
|
||
zzz |
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,4 @@ | ||
[package] | ||
name = "allocator" | ||
version = "0.1.0" | ||
edition = "2021" |
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,18 @@ | ||
``` | ||
// Smallest block = 8 bytes | ||
// Allocatable memory size = 64 bytes | ||
// Highest order = 3 (2^3 * 8 = 64) | ||
// Calculate order from smallest block and allocatable memory size: | ||
// 2 ^ n = memsize / blocksize | ||
// n = log2(memsize / blocksize) | ||
// 3 64 | ||
// 2 32 32 | ||
// 1 16 16 16 16 | ||
// 0 8 8 8 8 8 8 8 8 | ||
// Number of nodes = 2 ^ (order + 1) - 1 | ||
// Total size required to bookkeep allocatable memory = num_nodes * node_size | ||
// For order = 3 and node_size = 8, total size = (2 ^ (3 + 1) - 1) * 8 = 15 * 8 | ||
// = 120 | ||
``` |
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,5 @@ | ||
test: | ||
cargo test --lib --target x86_64-unknown-linux-gnu --jobs 1 | ||
|
||
|
||
|
Oops, something went wrong.