mini size fixes

This commit is contained in:
koniifer 2024-11-26 22:02:54 +00:00
parent 5d152811b2
commit f6a8a78b6c
4 changed files with 13 additions and 10 deletions

View file

@ -1,7 +1,5 @@
//! Environment call handling routines //! Environment call handling routines
use log::log;
use {alloc::boxed::Box, core::cell::LazyCell, hbvm::mem::Address}; use {alloc::boxed::Box, core::cell::LazyCell, hbvm::mem::Address};
use crate::{ use crate::{
@ -244,13 +242,16 @@ pub fn handler(vm: &mut Vm, pid: &usize) {
vm.registers[3] = x vm.registers[3] = x
} }
} }
6 => { // Wait till interrupt 6 => {
// Wait till interrupt
use crate::kmain::EXECUTOR; use crate::kmain::EXECUTOR;
let interrupt_type = vm.registers[3].cast::<u8>(); let interrupt_type = vm.registers[3].cast::<u8>();
info!("Interrupt subscribled: {}", interrupt_type); info!("Interrupt subscribled: {}", interrupt_type);
unsafe{ unsafe {
EXECUTOR.pause(pid.clone()); EXECUTOR.pause(pid.clone());
LazyCell::<Executor>::get_mut(&mut EXECUTOR).unwrap().interrupt_subscribe(pid.clone(), interrupt_type); LazyCell::<Executor>::get_mut(&mut EXECUTOR)
.unwrap()
.interrupt_subscribe(pid.clone(), interrupt_type);
} }
} }
_ => { _ => {

View file

@ -16,13 +16,13 @@ pub fn test_main() {
unsafe { unsafe {
let mut current_test = &__ktest_start as *const fn(); let mut current_test = &__ktest_start as *const fn();
let mut current = 1; 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 { while current_test < test_end {
let test_fn = *current_test; let test_fn = *current_test;
debug!("Running test {}", current); debug!("Running test {}", current);
test_fn(); test_fn();
debug!("Test {} passed", current); debug!("Test {} passed", current);
@ -35,4 +35,4 @@ pub fn test_main() {
#[ktest] #[ktest]
pub fn trivial_assertion() { pub fn trivial_assertion() {
assert_eq!(1, 1); assert_eq!(1, 1);
} }

View file

@ -35,9 +35,10 @@ mod task;
mod utils; mod utils;
// #[cfg(feature = "tests")] // #[cfg(feature = "tests")]
#[allow(improper_ctypes, non_upper_case_globals)]
mod ktest; mod ktest;
use {alloc::string::ToString, versioning::Version}; use versioning::Version;
/// Kernel's version /// Kernel's version
pub const VERSION: Version = Version { pub const VERSION: Version = Version {
@ -49,6 +50,7 @@ pub const VERSION: Version = Version {
#[panic_handler] #[panic_handler]
#[cfg(target_os = "none")] #[cfg(target_os = "none")]
fn panic(info: &core::panic::PanicInfo) -> ! { fn panic(info: &core::panic::PanicInfo) -> ! {
use alloc::string::ToString;
arch::register_dump(); arch::register_dump();
if let Some(loc) = info.location() { if let Some(loc) = info.location() {

View file

@ -1,7 +1,7 @@
sleep := @use("../../../libraries/stn/src/sleep.hb") sleep := @use("../../../libraries/stn/src/sleep.hb")
log := @use("../../../libraries/stn/src/log.hb") log := @use("../../../libraries/stn/src/log.hb")
main := fn(): int { main := fn(): void {
log.info("BEFORE\0") log.info("BEFORE\0")
sleep.sleep_until_interrupt(32) sleep.sleep_until_interrupt(32)
log.info("AFTER\0") log.info("AFTER\0")