Fix bugs and capture IPC dump

This commit is contained in:
pjht 2024-08-06 19:46:06 -05:00
parent f3e8f3e564
commit 9181d4fab8
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E
5 changed files with 85 additions and 13 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ sysroot/*
!sysroot/test_file.txt
initrd_path
kernel_path
out_dir_path

83
Cargo.lock generated
View File

@ -151,6 +151,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
[[package]]
name = "az"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
[[package]]
name = "bincode"
version = "1.3.3"
@ -240,12 +246,27 @@ version = "0.11.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a35ba5100c2431e20b924c8103c2cf8adb919ed9880f625e8770c3cb9d1b06aa"
[[package]]
name = "buddy_system_allocator"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d44d578cadd17312c75e7d0ef489361f160ace58f7139aa32001fee1a51b89b5"
dependencies = [
"spin",
]
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cast"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -291,6 +312,17 @@ version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "derive-try-from-primitive"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302ccf094df1151173bb6f5a2282fcd2f45accd5eae1bdf82dcbfefbc501ad5c"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "elf"
version = "0.7.4"
@ -492,7 +524,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.55",
]
[[package]]
@ -570,6 +602,15 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "humansize"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
dependencies = [
"libm",
]
[[package]]
name = "instant"
version = "0.1.12"
@ -609,14 +650,20 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
name = "kernel"
version = "0.1.0"
dependencies = [
"az",
"bootloader_api",
"buddy_system_allocator",
"cast",
"crossbeam-queue",
"derive-try-from-primitive",
"elf",
"hashbrown",
"humansize",
"intrusive-collections",
"linked_list_allocator",
"pic8259",
"replace_with",
"saturating_cast",
"slab",
"spin",
"static_assertions",
@ -633,6 +680,12 @@ version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libm"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
[[package]]
name = "linked_list_allocator"
version = "0.10.5"
@ -766,7 +819,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.55",
]
[[package]]
@ -901,6 +954,12 @@ version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
[[package]]
name = "saturating_cast"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fc4972f129a0ea378b69fa7c186d63255606e362ad00795f00b869dea5265eb"
[[package]]
name = "scopeguard"
version = "1.2.0"
@ -933,7 +992,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.55",
]
[[package]]
@ -1005,6 +1064,17 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.55"
@ -1063,7 +1133,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.55",
]
[[package]]
@ -1316,7 +1386,8 @@ dependencies = [
[[package]]
name = "x86_64"
version = "0.15.1"
source = "git+https://gitea.pterpstra.com/mikros/x86_64#8debcc3504d7e5c39c10b28f2a0661b19ee3a6f0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bc79523af8abf92fb1a970c3e086c5a343f6bcc1a0eb890f575cbb3b45743df"
dependencies = [
"bit_field",
"bitflags 2.5.0",
@ -1341,5 +1412,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.55",
]

View File

@ -1,7 +1,7 @@
[package]
name = "os"
version = "0.1.0"
edition = "2021"
resolver = "2"
[build-dependencies]
@ -23,6 +23,3 @@ debug = 2
# [workspace]
# members = ["kernel", "init", "test_proc", "toolchain_test"]
# exclude = ["x86_64", "rust"]
#
[patch.crates-io]
x86_64 = { git = "https://gitea.pterpstra.com/mikros/x86_64" }

View File

@ -12,7 +12,7 @@ fn main() {
let out_dir = std::env::var_os("OUT_DIR").unwrap();
let mut initrd_path = out_dir.clone();
initrd_path.push("initrd.tar");
initrd_path.push("/initrd.tar");
Command::new("sh")
.arg("-c")
.arg(format!("cd sysroot; tar cvf {:?} *", initrd_path))
@ -27,7 +27,7 @@ fn main() {
// create an UEFI disk image (optional)
let mut uefi_path = out_dir.clone();
uefi_path.push("uefi.img");
uefi_path.push("/uefi.img");
UefiBoot::new(&kernel)
.set_ramdisk(Path::new(&initrd_path))
.create_disk_image(Path::new(&uefi_path))
@ -35,7 +35,7 @@ fn main() {
// create a BIOS disk image (optional)
let mut bios_path = out_dir.clone();
bios_path.push("bios.img");
bios_path.push("/bios.img");
BiosBoot::new(&kernel)
.set_ramdisk(Path::new(&initrd_path))
.create_disk_image(Path::new(&bios_path))
@ -46,4 +46,5 @@ fn main() {
std::fs::write("kernel_path", kernel.as_os_str().as_bytes()).unwrap();
std::fs::write("initrd_path", initrd_path.as_os_str().as_bytes()).unwrap();
std::fs::write("out_dir_path", out_dir.as_bytes()).unwrap();
}

View File

@ -17,6 +17,8 @@ fn main() {
cmd.arg("-drive").arg("format=raw,file=ext2.img,if=ide,index=1");
// cmd.arg("-s");
// cmd.arg("-S");
cmd.arg("-serial").arg("mon:stdio");
cmd.arg("-serial").arg("file:capture.pcapng");
let mut child = cmd.spawn().unwrap();
child.wait().unwrap();
}