From 1a2b60b53bd3a9bb807a4f43af2b5fd9c8ada32c Mon Sep 17 00:00:00 2001 From: mlokr Date: Wed, 4 Sep 2024 19:14:30 +0200 Subject: [PATCH] foo --- Cargo.lock | 6 +++--- kernel/src/holeybytes/ecah.rs | 3 ++- .../kernel_services/service_definition_service.rs | 3 +++ repbuild/src/dev.rs | 14 +++++++++++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6a454e..0fadff6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -444,7 +444,7 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#894f73ca35199f524dff6160c57c0916169fbaf6" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#d9aab2191b57d4c9fa5a57e70c38039e605ad741" [[package]] name = "hbbytecode" @@ -454,7 +454,7 @@ source = "git+https://git.ablecorp.us/ableos/holey-bytes#894f73ca35199f524dff616 [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#894f73ca35199f524dff6160c57c0916169fbaf6" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#d9aab2191b57d4c9fa5a57e70c38039e605ad741" dependencies = [ "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#894f73ca35199f524dff6160c57c0916169fbaf6" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#d9aab2191b57d4c9fa5a57e70c38039e605ad741" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 548ddeb..f4f162c 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -74,7 +74,7 @@ pub fn handler(vm: &mut Vm) { match buffer_id { 0 => match sds_msg_handler(vm, mem_addr, length) { Ok(()) => {} - Err(err) => log::error!("Improper sds format"), + Err(err) => log::error!("Improper sds format: {err:?}"), }, 1 => match log_msg_handler(vm, mem_addr, length) { Ok(()) => {} @@ -285,6 +285,7 @@ fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogE #[derive(Debug)] pub enum LogError { + NoMessages, InvalidLogFormat, } use {alloc::vec, log::Record}; diff --git a/kernel/src/holeybytes/kernel_services/service_definition_service.rs b/kernel/src/holeybytes/kernel_services/service_definition_service.rs index 1a12447..547ac33 100644 --- a/kernel/src/holeybytes/kernel_services/service_definition_service.rs +++ b/kernel/src/holeybytes/kernel_services/service_definition_service.rs @@ -23,6 +23,9 @@ pub static SERVICES: Lazy> = Lazy::new(|| { pub fn sds_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { let mut msg_vec = block_read(mem_addr, length); + if msg_vec.is_empty() { + return Err(LogError::NoMessages); + } let sds_event_type: ServiceEventType = msg_vec[0].into(); msg_vec.remove(0); diff --git a/repbuild/src/dev.rs b/repbuild/src/dev.rs index 5c92480..67768e8 100644 --- a/repbuild/src/dev.rs +++ b/repbuild/src/dev.rs @@ -85,9 +85,17 @@ impl Package { Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (), Err(e) => panic!("{}", e), } - let path = format!("target/programs/{}.hbf", self.name); - let mut file = File::create(path).unwrap(); - file.write_all(&bytes).unwrap(); + std::fs::write(format!("target/programs/{}.hbf", self.name), &bytes).unwrap(); + bytes.clear(); + let _ = hblang::run_compiler( + &path, + Options { + dump_asm: true, + ..Default::default() + }, + &mut bytes, + ); + std::fs::write(format!("target/programs/{}.hba", self.name), &bytes).unwrap(); } } }