From 331cbf5da138ad4b38582c61e87c3e6f9dc0d0ef Mon Sep 17 00:00:00 2001 From: mlokr Date: Tue, 10 Sep 2024 21:52:57 +0200 Subject: [PATCH] fixing arm compilation errors --- Cargo.lock | 10 +++++----- kernel/src/arch/aarch64/logging.rs | 5 ++++- kernel/src/arch/riscv64/mod.rs | 2 +- kernel/src/holeybytes/ecah.rs | 3 +++ sysdata/programs/fb_driver/src/lib.hb | 4 ++-- sysdata/programs/serial_driver_test/src/main.hb | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77c8bf64..6cb6c3a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -442,17 +442,17 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9af7bf559f139937529ea7747cd275ed163fb1fa" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#dc418bd5e0b962ec9413af72e5d624e17febcbf2" [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07" +source = "git+https://git.ablecorp.us/ableos/holey-bytes#dc418bd5e0b962ec9413af72e5d624e17febcbf2" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9af7bf559f139937529ea7747cd275ed163fb1fa" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#dc418bd5e0b962ec9413af72e5d624e17febcbf2" dependencies = [ "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -460,7 +460,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9af7bf559f139937529ea7747cd275ed163fb1fa" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#dc418bd5e0b962ec9413af72e5d624e17febcbf2" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -468,7 +468,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5d81c2bcb3c471cc07" +source = "git+https://git.ablecorp.us/ableos/holey-bytes#dc418bd5e0b962ec9413af72e5d624e17febcbf2" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes)", ] diff --git a/kernel/src/arch/aarch64/logging.rs b/kernel/src/arch/aarch64/logging.rs index 5db9bc05..0f968b7e 100644 --- a/kernel/src/arch/aarch64/logging.rs +++ b/kernel/src/arch/aarch64/logging.rs @@ -1,5 +1,5 @@ use {crate::logger::TERMINAL_LOGGER, core::fmt::Write, spin::Mutex}; -const SERIAL_CONSOLE: Mutex = Mutex::new(SerialConsole { +pub static SERIAL_CONSOLE: Mutex = Mutex::new(SerialConsole { uart: 0x09000000 as *mut u8, }); @@ -17,6 +17,9 @@ impl core::fmt::Write for SerialConsole { } } +unsafe impl Sync for SerialConsole {} +unsafe impl Send for SerialConsole {} + pub fn log(args: core::fmt::Arguments<'_>) -> core::fmt::Result { SERIAL_CONSOLE.lock().write_fmt(args)?; TERMINAL_LOGGER.lock().write_fmt(args)?; diff --git a/kernel/src/arch/riscv64/mod.rs b/kernel/src/arch/riscv64/mod.rs index 2caa6c3b..b78a0e20 100644 --- a/kernel/src/arch/riscv64/mod.rs +++ b/kernel/src/arch/riscv64/mod.rs @@ -45,7 +45,7 @@ extern "C" { static USABLE_MEMORY_SIZE: usize; } -static SERIAL_CONSOLE: Once> = Once::new(); +pub static SERIAL_CONSOLE: Once> = Once::new(); #[no_mangle] unsafe extern "C" fn _kernel_start() -> ! { diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 2937205a..0f488cce 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -88,6 +88,7 @@ pub fn handler(vm: &mut Vm) { } // } + #[cfg(target_arch = "x86_64")] 3 => { unsafe fn x86_in(address: u16) -> u8 { x86_64::instructions::port::Port::new(address).read() @@ -131,6 +132,8 @@ pub fn handler(vm: &mut Vm) { _ => {} } } + #[cfg(not(target_arch = "x86_64"))] + 3 => unimplemented!("TODO: implement whatever buffer 3 does for no x86_64"), buffer_id => { let mut buffs = IPC_BUFFERS.lock(); match buffs.get_mut(&buffer_id) { diff --git a/sysdata/programs/fb_driver/src/lib.hb b/sysdata/programs/fb_driver/src/lib.hb index ddfc3e41..8b6addb0 100644 --- a/sysdata/programs/fb_driver/src/lib.hb +++ b/sysdata/programs/fb_driver/src/lib.hb @@ -17,12 +17,12 @@ Point := struct {x: int, y: int} Transform := struct {width: int, height: int} Rect := struct {p1: Point, p2: Point} -front_buffer_ptr := @as(^ColorBGRA, @bitcast(18446603339442421760)) +front_buffer_ptr := @as(^ColorBGRA, @bitcast(0 - 140734267129856)) front_buffer_copy := @as(^[ColorBGRA; COPY_PIXELS], @bitcast(front_buffer_ptr)) get_front_buffer := fn(): Buffer { // trying to return front_buffer_ptr or front_buffer_copy causes reg id leak - return Buffer.{write: @as(^ColorBGRA, @bitcast(18446603339442421760)), copy: @as(^[ColorBGRA; COPY_PIXELS], @bitcast(18446603339442421760))} + return Buffer.{write: @as(^ColorBGRA, @bitcast(0 - 140734267129856)), copy: @as(^[ColorBGRA; COPY_PIXELS], @bitcast(0 - 140734267129856))} } /* this is separate to create_raw_buffer because returning a Buffer from create_raw_buffer causes reg id leak */ diff --git a/sysdata/programs/serial_driver_test/src/main.hb b/sysdata/programs/serial_driver_test/src/main.hb index c1f67618..6a22fbd9 100644 --- a/sysdata/programs/serial_driver_test/src/main.hb +++ b/sysdata/programs/serial_driver_test/src/main.hb @@ -1,7 +1,7 @@ stn := @use("../../../libraries/stn/src/lib.hb"); .{string, memory, buffer} := stn -frame_buffer := @as(^u8, @bitcast(18446603339442421760)) +frame_buffer := @as(^u8, @bitcast(0 - 140734267129856)) log_info := fn(): void { a := buffer.search("XNumber\0")