forked from AbleOS/ableos
Compare commits
5 commits
a5cab167c5
...
b427ae1c27
Author | SHA1 | Date | |
---|---|---|---|
able | b427ae1c27 | ||
able | a511e99606 | ||
able | d90016f28e | ||
able | c20376464e | ||
bbe29d54ab |
|
@ -1,2 +1,2 @@
|
||||||
[alias]
|
[alias]
|
||||||
repbuild = "run --manifest-path ./repbuild/Cargo.toml --"
|
repbuild = "run --manifest-path ./repbuild/Cargo.toml -r --"
|
||||||
|
|
188
Cargo.lock
generated
188
Cargo.lock
generated
|
@ -29,9 +29,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.7.7"
|
version = "0.7.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd"
|
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
@ -40,16 +40,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.8.6"
|
version = "0.8.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
|
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"const-random",
|
|
||||||
"getrandom",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"version_check",
|
"version_check",
|
||||||
"zerocopy 0.7.18",
|
"zerocopy 0.7.34",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -193,26 +191,6 @@ dependencies = [
|
||||||
"toml 0.5.9",
|
"toml 0.5.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "const-random"
|
|
||||||
version = "0.1.18"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
|
|
||||||
dependencies = [
|
|
||||||
"const-random-macro",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "const-random-macro"
|
|
||||||
version = "0.1.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
"once_cell",
|
|
||||||
"tiny-keccak",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -254,12 +232,6 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crunchy"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_more"
|
name = "derive_more"
|
||||||
version = "0.99.17"
|
version = "0.99.17"
|
||||||
|
@ -441,7 +413,7 @@ version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash 0.7.7",
|
"ahash 0.7.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -450,35 +422,42 @@ version = "0.14.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash 0.8.6",
|
"ahash 0.8.11",
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hbasm"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#796a826cc5e99af341e0e0980c6f0b933896549c"
|
|
||||||
dependencies = [
|
|
||||||
"paste",
|
|
||||||
"rhai",
|
|
||||||
"with_builtin_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes#247b2c6614ab81925e96744398632e3b7bb8b7ad"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hbbytecode"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hblang"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"paste",
|
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
"with_builtin_macros",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbvm"
|
name = "hbvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes#247b2c6614ab81925e96744398632e3b7bb8b7ad"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode",
|
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hbvm"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07"
|
||||||
|
dependencies = [
|
||||||
|
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -602,15 +581,6 @@ dependencies = [
|
||||||
"hashbrown 0.12.3",
|
"hashbrown 0.12.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "instant"
|
|
||||||
version = "0.1.12"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ipnet"
|
name = "ipnet"
|
||||||
version = "2.9.0"
|
version = "2.9.0"
|
||||||
|
@ -642,7 +612,7 @@ dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"hashbrown 0.14.2",
|
"hashbrown 0.14.2",
|
||||||
"hbvm",
|
"hbvm 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)",
|
||||||
"kiam",
|
"kiam",
|
||||||
"limine",
|
"limine",
|
||||||
"log",
|
"log",
|
||||||
|
@ -836,7 +806,7 @@ dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"error-stack",
|
"error-stack",
|
||||||
"fatfs",
|
"fatfs",
|
||||||
"hbasm",
|
"hblang",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"str-reader",
|
"str-reader",
|
||||||
"toml 0.5.11",
|
"toml 0.5.11",
|
||||||
|
@ -882,34 +852,6 @@ dependencies = [
|
||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rhai"
|
|
||||||
version = "1.18.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a7d88770120601ba1e548bb6bc2a05019e54ff01b51479e38e64ec3b59d4759"
|
|
||||||
dependencies = [
|
|
||||||
"ahash 0.8.6",
|
|
||||||
"bitflags 2.4.1",
|
|
||||||
"instant",
|
|
||||||
"num-traits",
|
|
||||||
"once_cell",
|
|
||||||
"rhai_codegen",
|
|
||||||
"smallvec",
|
|
||||||
"smartstring",
|
|
||||||
"thin-vec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rhai_codegen"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "59aecf17969c04b9c0c5d21f6bc9da9fec9dd4980e64d1871443a476589d8c86"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.38",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ring"
|
name = "ring"
|
||||||
version = "0.17.5"
|
version = "0.17.5"
|
||||||
|
@ -1062,23 +1004,6 @@ dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "smallvec"
|
|
||||||
version = "1.13.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "smartstring"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"static_assertions",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
version = "0.4.10"
|
version = "0.4.10"
|
||||||
|
@ -1108,12 +1033,6 @@ dependencies = [
|
||||||
"lock_api",
|
"lock_api",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "static_assertions"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "str-reader"
|
name = "str-reader"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
|
@ -1163,21 +1082,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thin-vec"
|
|
||||||
version = "0.2.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tiny-keccak"
|
|
||||||
version = "2.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
|
|
||||||
dependencies = [
|
|
||||||
"crunchy",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
|
@ -1566,26 +1470,6 @@ dependencies = [
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "with_builtin_macros"
|
|
||||||
version = "0.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a59d55032495429b87f9d69954c6c8602e4d3f3e0a747a12dea6b0b23de685da"
|
|
||||||
dependencies = [
|
|
||||||
"with_builtin_macros-proc_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "with_builtin_macros-proc_macros"
|
|
||||||
version = "0.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "15bd7679c15e22924f53aee34d4e448c45b674feb6129689af88593e129f8f42"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x2apic"
|
name = "x2apic"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
|
@ -1631,11 +1515,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.7.18"
|
version = "0.7.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ede7d7c7970ca2215b8c1ccf4d4f354c4733201dfaaba72d44ae5b37472e4901"
|
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zerocopy-derive 0.7.18",
|
"zerocopy-derive 0.7.34",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1651,9 +1535,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy-derive"
|
name = "zerocopy-derive"
|
||||||
version = "0.7.18"
|
version = "0.7.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4b27b1bb92570f989aac0ab7e9cbfbacdd65973f7ee920d9f0e71ebac878fd0b"
|
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -18,12 +18,12 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn handler(vm: &mut Vm) {
|
pub fn handler(vm: &mut Vm) {
|
||||||
let r1 = vm.registers[1].cast::<u64>();
|
let ecall_number = vm.registers[2].cast::<u64>();
|
||||||
|
|
||||||
// debug!("Ecall number {:?}", r1);
|
// debug!("Ecall number {:?}", ecall_number);
|
||||||
// trace!("Register dump: {:?}", vm.registers);
|
// trace!("Register dump: {:?}", vm.registers);
|
||||||
|
|
||||||
match r1 {
|
match ecall_number {
|
||||||
0 => {
|
0 => {
|
||||||
// TODO: explode computer
|
// TODO: explode computer
|
||||||
// hello world ecall
|
// hello world ecall
|
||||||
|
@ -34,7 +34,7 @@ pub fn handler(vm: &mut Vm) {
|
||||||
1 => {
|
1 => {
|
||||||
// Make buffer
|
// Make buffer
|
||||||
|
|
||||||
let bounded = match vm.registers[2].cast::<u64>() {
|
let bounded = match vm.registers[3].cast::<u64>() {
|
||||||
0 => false,
|
0 => false,
|
||||||
1 => true,
|
1 => true,
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -42,7 +42,7 @@ pub fn handler(vm: &mut Vm) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let length = vm.registers[3].cast::<u64>();
|
let length = vm.registers[4].cast::<u64>();
|
||||||
|
|
||||||
let mut buffs = IPC_BUFFERS.lock();
|
let mut buffs = IPC_BUFFERS.lock();
|
||||||
let abc;
|
let abc;
|
||||||
|
@ -65,13 +65,9 @@ pub fn handler(vm: &mut Vm) {
|
||||||
}
|
}
|
||||||
3 => {
|
3 => {
|
||||||
// Send a message to a buffer
|
// Send a message to a buffer
|
||||||
let r2 = vm.registers[2].cast::<u64>();
|
let buffer_id = vm.registers[3].cast::<u64>();
|
||||||
let r3 = vm.registers[3].cast::<u64>();
|
let mem_addr = vm.registers[4].cast::<u64>();
|
||||||
let r4 = vm.registers[4].cast::<u64>();
|
let length = vm.registers[5].cast::<u64>() as usize;
|
||||||
|
|
||||||
let buffer_id = r2;
|
|
||||||
let mem_addr = r3;
|
|
||||||
let length = r4 as usize;
|
|
||||||
trace!("IPC address: {:?}", mem_addr);
|
trace!("IPC address: {:?}", mem_addr);
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
|
@ -119,12 +115,12 @@ pub fn handler(vm: &mut Vm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
4 => {
|
4 => {
|
||||||
let r2 = vm.registers[2].cast::<u64>();
|
let buffer_id = vm.registers[3].cast::<u64>();
|
||||||
|
|
||||||
let mut buffs = IPC_BUFFERS.lock();
|
let mut buffs = IPC_BUFFERS.lock();
|
||||||
let mut buff = buffs.get_mut(&r2).unwrap();
|
let mut buff = buffs.get_mut(&buffer_id).unwrap();
|
||||||
let msg = buff.pop();
|
let msg = buff.pop();
|
||||||
info!("Recieve {:?} from Buffer({})", msg, r2);
|
info!("Recieve {:?} from Buffer({})", msg, buffer_id);
|
||||||
}
|
}
|
||||||
5 => {
|
5 => {
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
@ -141,7 +137,7 @@ pub fn handler(vm: &mut Vm) {
|
||||||
}
|
}
|
||||||
// 5
|
// 5
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("Syscall unknown {:?}{:?}", r1, vm.registers);
|
log::error!("Syscall unknown {:?}{:?}", ecall_number, vm.registers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
ptr_sub_ptr,
|
ptr_sub_ptr,
|
||||||
custom_test_frameworks,
|
custom_test_frameworks,
|
||||||
naked_functions,
|
naked_functions,
|
||||||
|
pointer_is_aligned_to
|
||||||
)]
|
)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![test_runner(crate::test_runner)]
|
#![test_runner(crate::test_runner)]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"llvm-target": "x86_64-unknown-none",
|
"llvm-target": "x86_64-unknown-none",
|
||||||
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
|
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"target-endian": "little",
|
"target-endian": "little",
|
||||||
"target-pointer-width": "64",
|
"target-pointer-width": "64",
|
||||||
|
|
|
@ -9,8 +9,8 @@ derive_more = "0.99"
|
||||||
error-stack = "0.4"
|
error-stack = "0.4"
|
||||||
fatfs = "0.3"
|
fatfs = "0.3"
|
||||||
toml = "0.5.2"
|
toml = "0.5.2"
|
||||||
hbasm.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
|
# hbasm.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
|
||||||
|
hblang.git = "https://git.ablecorp.us/AbleOS/holey-bytes.git"
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.11"
|
version = "0.11"
|
||||||
|
|
100
repbuild/src/dev.rs
Normal file
100
repbuild/src/dev.rs
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
use std::{
|
||||||
|
fs::{read_to_string, File},
|
||||||
|
io::{BufWriter, Write},
|
||||||
|
process::exit,
|
||||||
|
};
|
||||||
|
|
||||||
|
use error_stack::Report;
|
||||||
|
|
||||||
|
use crate::Error;
|
||||||
|
pub struct Package {
|
||||||
|
name: String,
|
||||||
|
binaries: Vec<String>,
|
||||||
|
build_cmd: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Package {
|
||||||
|
pub fn load_from_file(path: String) -> Self {
|
||||||
|
let contents = match std::fs::read_to_string(path.clone()) {
|
||||||
|
// If successful return the files text as `contents`.
|
||||||
|
// `c` is a local variable.
|
||||||
|
Ok(c) => c,
|
||||||
|
// Handle the `error` case.
|
||||||
|
Err(_) => {
|
||||||
|
// Write `msg` to `stderr`.
|
||||||
|
eprintln!("Could not read file `{}`", path);
|
||||||
|
// Exit the program with exit code `1`.
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
use toml::Value;
|
||||||
|
|
||||||
|
let mut data: Value = toml::from_str(&contents).unwrap();
|
||||||
|
let mut name = data
|
||||||
|
.get("package")
|
||||||
|
.unwrap()
|
||||||
|
.get("name")
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
name.pop();
|
||||||
|
name.remove(0);
|
||||||
|
|
||||||
|
let dependants = data.get("dependants").unwrap();
|
||||||
|
let bin_table = dependants.get("binaries").unwrap().as_table().unwrap();
|
||||||
|
let mut binaries = vec![];
|
||||||
|
|
||||||
|
for (count, (name, table)) in bin_table.into_iter().enumerate() {
|
||||||
|
// if count != 0 {
|
||||||
|
println!("{}", name);
|
||||||
|
binaries.push(name.clone());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
let build_table = data.get("build").unwrap();
|
||||||
|
|
||||||
|
let mut build_cmd: String = build_table.get("command").unwrap().as_str().unwrap().into();
|
||||||
|
build_cmd.remove(0);
|
||||||
|
// build_cmd.pop();
|
||||||
|
|
||||||
|
Self {
|
||||||
|
name,
|
||||||
|
binaries,
|
||||||
|
build_cmd,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn build(&self) {
|
||||||
|
if self.binaries.contains(&"hblang".to_string()) {
|
||||||
|
let file_order = self.build_cmd.split_ascii_whitespace();
|
||||||
|
let mut files = vec![];
|
||||||
|
for (count, file) in file_order.enumerate() {
|
||||||
|
if count != 0 {
|
||||||
|
println!("{}", file);
|
||||||
|
files.push(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut bundle = vec![];
|
||||||
|
for file in files {
|
||||||
|
let contents = read_to_string(file).unwrap();
|
||||||
|
bundle.push((file, contents));
|
||||||
|
}
|
||||||
|
|
||||||
|
use hblang::{codegen, parser};
|
||||||
|
let mut codegen = codegen::Codegen::default();
|
||||||
|
for (path, content) in bundle.iter() {
|
||||||
|
println!("A");
|
||||||
|
codegen.files = vec![parser::Ast::new(&path, &content, &parser::no_loader)];
|
||||||
|
codegen.generate();
|
||||||
|
}
|
||||||
|
let mut buf = BufWriter::new(Vec::new());
|
||||||
|
codegen.dump(&mut buf);
|
||||||
|
let bytes = buf.into_inner().unwrap();
|
||||||
|
match std::fs::create_dir("target/programs") {
|
||||||
|
Ok(_) => (),
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
|
||||||
|
Err(e) => panic!(),
|
||||||
|
}
|
||||||
|
let path = format!("target/test-programs/{}.hbf", self.name);
|
||||||
|
let mut file = File::create(path).unwrap();
|
||||||
|
file.write_all(&bytes).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
|
mod dev;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
derive_more::Display,
|
derive_more::Display,
|
||||||
|
dev::Package,
|
||||||
error_stack::{bail, report, Context, Report, Result, ResultExt},
|
error_stack::{bail, report, Context, Report, Result, ResultExt},
|
||||||
fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek},
|
fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek},
|
||||||
std::{
|
std::{
|
||||||
|
@ -114,8 +117,8 @@ fn assemble() -> Result<(), Error> {
|
||||||
.map_err(Report::from)
|
.map_err(Report::from)
|
||||||
.change_context(Error::Io)?;
|
.change_context(Error::Io)?;
|
||||||
|
|
||||||
hbasm::assembler(&mut out, |engine| engine.run_file(entry.path()))
|
// hbasm::assembler(&mut out, |engine| engine.run_file(entry.path()))
|
||||||
.map_err(|e| report!(Error::Assembler).attach_printable(e.to_string()))?;
|
// .map_err(|e| report!(Error::Assembler).attach_printable(e.to_string()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -136,6 +139,10 @@ fn get_fs() -> Result<FileSystem<impl ReadWriteSeek>, io::Error> {
|
||||||
|
|
||||||
let fs = FileSystem::new(img, FsOptions::new())?;
|
let fs = FileSystem::new(img, FsOptions::new())?;
|
||||||
|
|
||||||
|
// TODO: Do not hard code these here
|
||||||
|
let p = Package::load_from_file("sysdata/programs/tests/meta.toml".to_owned());
|
||||||
|
p.build();
|
||||||
|
|
||||||
// Read the contents of the file using a `match` block
|
// Read the contents of the file using a `match` block
|
||||||
// to return the `data: Ok(c)` as a `String`
|
// to return the `data: Ok(c)` as a `String`
|
||||||
// or handle any `errors: Err(_)`.
|
// or handle any `errors: Err(_)`.
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2023-09-17"
|
channel = "nightly-2024-05-17"
|
||||||
components = ["rust-src", "llvm-tools"]
|
components = ["rust-src", "llvm-tools"]
|
||||||
|
|
1
sysdata/libraries/stn/README.md
Normal file
1
sysdata/libraries/stn/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
The standard library for ableOS.
|
31
sysdata/libraries/stn/src/lib.hb
Normal file
31
sysdata/libraries/stn/src/lib.hb
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
char := struct {}
|
||||||
|
|
||||||
|
|
||||||
|
log := fn(log_level: int, message: ^char, message_length: int): int {
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
error := fn(message: ^char, message_length: int): int {
|
||||||
|
log(0, message, message_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
warn := fn(message: ^char, message_length: int): int {
|
||||||
|
log(1, message, message_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
info := fn(message: ^char, message_length: int): int {
|
||||||
|
log(2, message, message_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
debug := fn(message: ^char, message_length: int): int {
|
||||||
|
log(3, message, message_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
trace := fn(message: ^char, message_length: int): int {
|
||||||
|
log(4, message, message_length)
|
||||||
|
}
|
||||||
|
|
||||||
|
main := fn(): int {
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
# Dev
|
|
||||||
Dev is a (currently) hypothetical tool meant to be used to ease development and compilation on ableOS.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
A `meta.toml` file must be in the project root. A `src` folder and a `lib` folder must exist.
|
|
||||||
Binaries should be put into a folder named `bin`.
|
|
||||||
|
|
||||||
```
|
|
||||||
bin/
|
|
||||||
lib/
|
|
||||||
src/
|
|
||||||
```
|
|
||||||
|
|
||||||
The folders `lib/` and `bin/` should both be left out of source tracking.
|
|
|
@ -1,16 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "dev"
|
|
||||||
authors = ["able"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
file_service = "0.0.1"
|
|
||||||
|
|
||||||
[dependants.binaries]
|
|
||||||
susc.version = "1.0.0"
|
|
||||||
|
|
||||||
[build.debug]
|
|
||||||
command = "susc src/main.hbl"
|
|
||||||
|
|
||||||
[run.debug]
|
|
||||||
depends = ["build.debug"]
|
|
||||||
command = "bin/main.hbf"
|
|
|
@ -1,5 +0,0 @@
|
||||||
#include "lib/file_service.h"
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
File fhand = file_open("meta.toml");
|
|
||||||
}
|
|
4
sysdata/programs/diskio_driver/README.md
Normal file
4
sysdata/programs/diskio_driver/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# DiskIO Driver
|
||||||
|
The purpose of this driver is to read and write disk sectors as simply as possible.
|
||||||
|
|
||||||
|
This will be done by first getting a 'boot count'.
|
4
sysdata/programs/diskio_driver/src/main.hb
Normal file
4
sysdata/programs/diskio_driver/src/main.hb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
main := fn(): int {
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
0
sysdata/programs/fb_driver/README.md
Normal file
0
sysdata/programs/fb_driver/README.md
Normal file
11
sysdata/programs/fb_driver/meta.toml
Normal file
11
sysdata/programs/fb_driver/meta.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "dev"
|
||||||
|
authors = ["able"]
|
||||||
|
|
||||||
|
[dependants.libraries]
|
||||||
|
|
||||||
|
[dependants.binaries]
|
||||||
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
|
[build.debug]
|
||||||
|
command = "hblang libraries/stn/src/lib.hb src/main.hbl"
|
7
sysdata/programs/fb_driver/src/main.hb
Normal file
7
sysdata/programs/fb_driver/src/main.hb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
main := fn(): int {
|
||||||
|
loop {
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "fisp_test"
|
|
||||||
authors = ["able"]
|
|
||||||
|
|
||||||
[dependants.libraries]
|
|
||||||
[dependants.binaries]
|
|
||||||
# Refers to @FunkyEgg's lisp compiler for ableOS
|
|
||||||
fisp = ""
|
|
||||||
|
|
||||||
[build.debug]
|
|
||||||
command = "fisp src/main.fisp"
|
|
||||||
|
|
||||||
[run.debug]
|
|
||||||
depends = ["build.debug"]
|
|
||||||
command = "bin/main.hbf"
|
|
|
@ -1 +0,0 @@
|
||||||
(log info "Hello World\n")
|
|
2
sysdata/programs/kvstore/README.md
Normal file
2
sysdata/programs/kvstore/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# KVStore
|
||||||
|
This is a small single process in memory key value store.
|
37
sysdata/programs/kvstore/src/main.hb
Normal file
37
sysdata/programs/kvstore/src/main.hb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
Message := struct {
|
||||||
|
msg_type: u8,
|
||||||
|
key: String,
|
||||||
|
value: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
# Message Type
|
||||||
|
0 => Set Key type
|
||||||
|
1 => Get Key
|
||||||
|
*/
|
||||||
|
|
||||||
|
recv_msg:= fn(): Message {
|
||||||
|
return Message.{
|
||||||
|
msg_type: 0,
|
||||||
|
key: "",
|
||||||
|
value: "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main := fn(): int {
|
||||||
|
loop {
|
||||||
|
msg := recv_msg();
|
||||||
|
if msg.msg_type == 0 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if msg.msg_type == 1 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if 2 <= msg.msg_type {
|
||||||
|
error("Unexpected message type in the bagging area");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
2
sysdata/programs/serial_driver/README.md
Normal file
2
sysdata/programs/serial_driver/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Serial Driver
|
||||||
|
This program is a small serial driver for the emulated arm device in QEMU.
|
7
sysdata/programs/serial_driver/src/main.hb
Normal file
7
sysdata/programs/serial_driver/src/main.hb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
main:= fn(): int {
|
||||||
|
arch := "Arm";
|
||||||
|
ADDR := 0x09000000;
|
||||||
|
loop { }
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "htasm_test"
|
|
||||||
authors = ["able"]
|
|
||||||
|
|
||||||
# Similar to cargo libraries
|
|
||||||
[dependants.libraries]
|
|
||||||
# Similar to cargo install
|
|
||||||
[dependants.binaries]
|
|
||||||
htasm = ""
|
|
||||||
|
|
||||||
[build.debug]
|
|
||||||
command = "htasm src/main.S"
|
|
||||||
|
|
||||||
[run.debug]
|
|
||||||
depends = ["build.debug"]
|
|
||||||
command = "bin/main.hbf"
|
|
|
@ -1,10 +0,0 @@
|
||||||
jmp start
|
|
||||||
|
|
||||||
start:
|
|
||||||
li64 r1, 3
|
|
||||||
li64 r2, 1
|
|
||||||
lra16 r3, r0, hello_string
|
|
||||||
li64 r4, 0x14
|
|
||||||
|
|
||||||
string
|
|
||||||
.db "Hello, world!\n"
|
|
11
sysdata/programs/tests/meta.toml
Normal file
11
sysdata/programs/tests/meta.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "tests"
|
||||||
|
authors = ["able"]
|
||||||
|
|
||||||
|
[dependants.libraries]
|
||||||
|
|
||||||
|
[dependants.binaries]
|
||||||
|
hblang.version = "1.0.0"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
command = "hblang sysdata/libraries/stn/src/lib.hb sysdata/programs/tests/src/main.hb"
|
3
sysdata/programs/tests/src/main.hb
Normal file
3
sysdata/programs/tests/src/main.hb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
main := fn(): int {
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ The memory service uses the first byte in the message to identify the request ty
|
||||||
<!-- Currently this does not deallocate -->
|
<!-- Currently this does not deallocate -->
|
||||||
[U8] -> 1
|
[U8] -> 1
|
||||||
[U8] -> Page count
|
[U8] -> Page count
|
||||||
[U64] -> ptr to dealloc from
|
[U64] -> ptr to dealloc from
|
||||||
|
|
||||||
## Map Device Into Memory
|
## Map Device Into Memory
|
||||||
Typically only used for simple drivers such as vga.
|
Typically only used for simple drivers such as vga.
|
||||||
|
|
|
@ -17,29 +17,6 @@ resolution = "1024x768x24"
|
||||||
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules]
|
[boot.limine.ableos.modules]
|
||||||
[boot.limine.ableos.modules.failure]
|
[boot.limine.ableos.modules.tests]
|
||||||
path = "boot:///failure.hbf"
|
# TODO: Pull from the programs included here
|
||||||
|
path = "boot:///tests.hbf"
|
||||||
[boot.limine.ableos.modules.ecall]
|
|
||||||
path = "boot:///ecall.hbf"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.sds_test]
|
|
||||||
path = "boot:///sds_test.hbf"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.main]
|
|
||||||
path = "boot:///main.hbf"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.keyboard_driver]
|
|
||||||
path = "boot:///keyboard_driver.hbf"
|
|
||||||
cmd_line = "arch=${ARCH}"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.vfs_test]
|
|
||||||
path = "boot:///vfs_test.hbf"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.limine_framebuffer_driver]
|
|
||||||
path = "boot:///limine_framebuffer_driver.hbf"
|
|
||||||
cmd_line = "height=10 width=10 arch=${ARCH}"
|
|
||||||
|
|
||||||
[boot.limine.ableos.modules.serial_driver]
|
|
||||||
path = "boot:///serial_driver.hbf"
|
|
||||||
cmd_line = "arch=${ARCH}"
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
li64 (r1, 2);
|
|
||||||
eca ();
|
|
||||||
tx ();
|
|
|
@ -1 +0,0 @@
|
||||||
un();
|
|
|
@ -1,33 +0,0 @@
|
||||||
import "sysdata/test-programs/hblib/std" as std;
|
|
||||||
|
|
||||||
fn main(){
|
|
||||||
std::Error(":o) h0nk");
|
|
||||||
std::Warn("Your mom is a worm!");
|
|
||||||
std::Info("Hello, world!");
|
|
||||||
// std::Debug("XYZ");
|
|
||||||
// std::Trace("Trace Deez");
|
|
||||||
|
|
||||||
// let ADDR = 0xFFFF_FFFF_8100_0000;
|
|
||||||
// let ADDR_PLUS_ONE = ADDR + 1;
|
|
||||||
// let ADDR_PLUS_NINE = ADDR + 9;
|
|
||||||
|
|
||||||
// li64(r25, 1);
|
|
||||||
// st(r25, r0, ADDR, 1);
|
|
||||||
|
|
||||||
// li64(r25, 0);
|
|
||||||
// st(r25, r0, ADDR_PLUS_ONE, 8);
|
|
||||||
|
|
||||||
// li64(r25, 17);
|
|
||||||
// st(r25, r0, ADDR_PLUS_NINE, 1);
|
|
||||||
|
|
||||||
// li64(r1, 3);
|
|
||||||
// li64(r2, 2);
|
|
||||||
// li64(r3, ADDR);
|
|
||||||
// li64(r4, 0);
|
|
||||||
|
|
||||||
eca();
|
|
||||||
|
|
||||||
tx();
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
|
@ -1,11 +0,0 @@
|
||||||
/// Act as a shim of a virtual file system that recieves one message from buffer 2
|
|
||||||
import "sysdata/test-programs/hblib/std" as std;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
std::ipc_recv(2);
|
|
||||||
un();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main();
|
|
||||||
tx();
|
|
Loading…
Reference in a new issue