diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 7f3be729e..e11aa7546 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -109,8 +109,17 @@ pub fn handler(vm: &mut Vm) { info!("Recieve {:?} from Buffer({})", msg, r2); } 5 => { - let r2 = vm.registers[2].cast::(); - vm.registers[3] = hbvm::value::Value( unsafe { x86_in(r2 as u16) } as u64); + #[cfg(target_arch = "x86_64")] + { + let r2 = vm.registers[2].cast::(); + unsafe fn x86_in(address: u16) -> u32 { + x86_64::instructions::port::Port::new(address).read() + } + unsafe fn x86_out(address: u16, value: u32) { + x86_64::instructions::port::Port::new(address).write(value); + } + vm.registers[3] = hbvm::value::Value(unsafe { x86_in(r2 as u16) } as u64); + } } // 5 _ => { @@ -119,13 +128,6 @@ pub fn handler(vm: &mut Vm) { } } -unsafe fn x86_in(address: u16) -> u32{ - x86_64::instructions::port::Port::new(address).read() -} -unsafe fn x86_out(address: u16, value: u32){ - x86_64::instructions::port::Port::new(address).write(value); -} - fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { // let message_length = 8 + 8 + 8; // log::info!("Mem Addr 0x{:x?} length {}", mem_addr, length); @@ -139,7 +141,7 @@ fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogE } let log_level = msg_vec.pop().unwrap(); match String::from_utf8(msg_vec) { - Ok (strr) => { + Ok(strr) => { // use LogLevel::*; let ll = match log_level { 0 | 48 => error!("{}", strr), diff --git a/sysdata/limine.cfg b/sysdata/limine.cfg index 65f7457c1..1e6458c32 100644 --- a/sysdata/limine.cfg +++ b/sysdata/limine.cfg @@ -28,7 +28,7 @@ TERM_BACKDROP=008080 MODULE_CMDLINE="" MODULE_PATH=boot:///keyboard_driver.hbf - MODULE_CMDLINE="" + MODULE_CMDLINE="arch=${ARCH}" MODULE_PATH=boot:///vfs_test.hbf MODULE_CMDLINE="" diff --git a/sysdata/test-programs/hblib/std.rhai b/sysdata/test-programs/hblib/std.rhai index 4c16d5257..6aa63c418 100644 --- a/sysdata/test-programs/hblib/std.rhai +++ b/sysdata/test-programs/hblib/std.rhai @@ -29,7 +29,6 @@ fn ipc_make_bound_buffer(length) { private fn log(log_level, string){ // This is NOT the final format let str = data::str(string + log_level); - // 1 byte for the log level // 8 bytes for the length to the message // 8 bytes for the pointer to the string diff --git a/sysdata/test-programs/limine_framebuffer_driver.rhai b/sysdata/test-programs/limine_framebuffer_driver.rhai index 7b1a6f57b..de642ebcc 100644 --- a/sysdata/test-programs/limine_framebuffer_driver.rhai +++ b/sysdata/test-programs/limine_framebuffer_driver.rhai @@ -72,7 +72,7 @@ fn clear() { } // Define main -fn main(){ +fn main() { // Log the arguments { cp(r3, r1);