From f6a8a78b6c5dbda0d1c86e61547abffb1be30622 Mon Sep 17 00:00:00 2001 From: koniifer Date: Tue, 26 Nov 2024 22:02:54 +0000 Subject: [PATCH] mini size fixes --- kernel/src/holeybytes/ecah.rs | 11 ++++++----- kernel/src/ktest.rs | 6 +++--- kernel/src/lib.rs | 4 +++- sysdata/programs/timer_test/src/main.hb | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index b1561f9..2a4d2e1 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -1,7 +1,5 @@ //! Environment call handling routines -use log::log; - use {alloc::boxed::Box, core::cell::LazyCell, hbvm::mem::Address}; use crate::{ @@ -244,13 +242,16 @@ pub fn handler(vm: &mut Vm, pid: &usize) { vm.registers[3] = x } } - 6 => { // Wait till interrupt + 6 => { + // Wait till interrupt use crate::kmain::EXECUTOR; let interrupt_type = vm.registers[3].cast::(); info!("Interrupt subscribled: {}", interrupt_type); - unsafe{ + unsafe { EXECUTOR.pause(pid.clone()); - LazyCell::::get_mut(&mut EXECUTOR).unwrap().interrupt_subscribe(pid.clone(), interrupt_type); + LazyCell::::get_mut(&mut EXECUTOR) + .unwrap() + .interrupt_subscribe(pid.clone(), interrupt_type); } } _ => { diff --git a/kernel/src/ktest.rs b/kernel/src/ktest.rs index 43a2a11..bd5ec7f 100644 --- a/kernel/src/ktest.rs +++ b/kernel/src/ktest.rs @@ -16,13 +16,13 @@ pub fn test_main() { unsafe { let mut current_test = &__ktest_start as *const fn(); let mut current = 1; - let test_end = &__ktest_end as *const fn(); + let test_end = &__ktest_end as *const fn(); while current_test < test_end { let test_fn = *current_test; debug!("Running test {}", current); - + test_fn(); debug!("Test {} passed", current); @@ -35,4 +35,4 @@ pub fn test_main() { #[ktest] pub fn trivial_assertion() { assert_eq!(1, 1); -} \ No newline at end of file +} diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index cf68a83..3f2be11 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -35,9 +35,10 @@ mod task; mod utils; // #[cfg(feature = "tests")] +#[allow(improper_ctypes, non_upper_case_globals)] mod ktest; -use {alloc::string::ToString, versioning::Version}; +use versioning::Version; /// Kernel's version pub const VERSION: Version = Version { @@ -49,6 +50,7 @@ pub const VERSION: Version = Version { #[panic_handler] #[cfg(target_os = "none")] fn panic(info: &core::panic::PanicInfo) -> ! { + use alloc::string::ToString; arch::register_dump(); if let Some(loc) = info.location() { diff --git a/sysdata/programs/timer_test/src/main.hb b/sysdata/programs/timer_test/src/main.hb index b2142ea..a491de4 100644 --- a/sysdata/programs/timer_test/src/main.hb +++ b/sysdata/programs/timer_test/src/main.hb @@ -1,7 +1,7 @@ sleep := @use("../../../libraries/stn/src/sleep.hb") log := @use("../../../libraries/stn/src/log.hb") -main := fn(): int { +main := fn(): void { log.info("BEFORE\0") sleep.sleep_until_interrupt(32) log.info("AFTER\0")