From 04d5c5fee89bfb842fbc23de897fa40293e85b30 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Thu, 11 Dec 2025 18:47:46 +0700 Subject: [PATCH] Fix cargo check for aarch64 --- drivers/audio/ac97d/src/main.rs | 7 +++++++ drivers/audio/sb16d/src/main.rs | 7 +++++++ drivers/input/ps2d/src/controller.rs | 23 ++++++++++++++++++++++- drivers/input/ps2d/src/vm.rs | 6 ++++++ drivers/storage/ahcid/src/main.rs | 2 +- drivers/storage/ided/src/main.rs | 8 ++++++++ drivers/vboxd/src/main.rs | 11 ++++++----- 7 files changed, 57 insertions(+), 7 deletions(-) diff --git a/drivers/audio/ac97d/src/main.rs b/drivers/audio/ac97d/src/main.rs index 9d9e785199..d3c6c87fab 100644 --- a/drivers/audio/ac97d/src/main.rs +++ b/drivers/audio/ac97d/src/main.rs @@ -15,12 +15,14 @@ use redox_scheme::wrappers::ReadinessBased; use redox_scheme::Socket; use std::cell::RefCell; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub mod device; fn main() { pcid_interface::pci_daemon(daemon); } +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { let pci_config = pcid_handle.config(); @@ -135,3 +137,8 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { std::process::exit(0); } + +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { + unimplemented!() +} diff --git a/drivers/audio/sb16d/src/main.rs b/drivers/audio/sb16d/src/main.rs index 7701f55b87..4636293823 100644 --- a/drivers/audio/sb16d/src/main.rs +++ b/drivers/audio/sb16d/src/main.rs @@ -8,12 +8,14 @@ use std::{env, usize}; use event::{user_data, EventQueue}; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub mod device; fn main() { daemon::Daemon::new(daemon); } +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn daemon(daemon: daemon::Daemon) -> ! { let mut args = env::args().skip(1); @@ -113,3 +115,8 @@ fn daemon(daemon: daemon::Daemon) -> ! { std::process::exit(0); } + +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +fn daemon(daemon: daemon::Daemon) -> ! { + unimplemented!() +} diff --git a/drivers/input/ps2d/src/controller.rs b/drivers/input/ps2d/src/controller.rs index ae2326062e..a145e0d5bf 100644 --- a/drivers/input/ps2d/src/controller.rs +++ b/drivers/input/ps2d/src/controller.rs @@ -1,7 +1,14 @@ use common::{ - io::{Io, Pio, ReadOnly, WriteOnly}, + io::{Io, ReadOnly, WriteOnly}, timeout::Timeout, }; + +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +use common::io::Pio; + +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +use common::io::Mmio; + use log::{debug, error, trace}; use std::fmt; @@ -102,13 +109,22 @@ const DEFAULT_TIMEOUT: u64 = 50_000; // Reset timeout in microseconds const RESET_TIMEOUT: u64 = 500_000; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub struct Ps2 { data: Pio, status: ReadOnly>, command: WriteOnly>, } +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +pub struct Ps2 { + data: Mmio, + status: ReadOnly>, + command: WriteOnly>, +} + impl Ps2 { + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn new() -> Self { Ps2 { data: Pio::new(0x60), @@ -117,6 +133,11 @@ impl Ps2 { } } + #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] + pub fn new() -> Self { + unimplemented!() + } + fn status(&mut self) -> StatusFlags { StatusFlags::from_bits_truncate(self.status.read()) } diff --git a/drivers/input/ps2d/src/vm.rs b/drivers/input/ps2d/src/vm.rs index 8832dc0ac9..aea6c7ad9d 100644 --- a/drivers/input/ps2d/src/vm.rs +++ b/drivers/input/ps2d/src/vm.rs @@ -29,6 +29,7 @@ pub const LEFT_BUTTON: u32 = 0x20; pub const RIGHT_BUTTON: u32 = 0x10; pub const MIDDLE_BUTTON: u32 = 0x08; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub unsafe fn cmd(cmd: u32, arg: u32) -> (u32, u32, u32, u32) { let a: u32; let b: u32; @@ -62,6 +63,11 @@ pub unsafe fn cmd(cmd: u32, arg: u32) -> (u32, u32, u32, u32) { (a, b, c, d) } +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +pub unsafe fn cmd(cmd: u32, arg: u32) -> (u32, u32, u32, u32) { + unimplemented!() +} + pub fn enable(relative: bool) -> bool { trace!("ps2d: Enable vmmouse"); diff --git a/drivers/storage/ahcid/src/main.rs b/drivers/storage/ahcid/src/main.rs index 45415732bf..1f130a2974 100644 --- a/drivers/storage/ahcid/src/main.rs +++ b/drivers/storage/ahcid/src/main.rs @@ -1,4 +1,4 @@ -#![cfg_attr(target_arch = "aarch64", feature(stdsimd))] // Required for yield instruction +// #![cfg_attr(target_arch = "aarch64", feature(stdsimd))] // Required for yield instruction use std::io::{Read, Write}; use std::os::fd::AsRawFd; diff --git a/drivers/storage/ided/src/main.rs b/drivers/storage/ided/src/main.rs index e94998a713..4197217dcd 100644 --- a/drivers/storage/ided/src/main.rs +++ b/drivers/storage/ided/src/main.rs @@ -13,14 +13,17 @@ use std::{ time::Duration, }; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] use crate::ide::{AtaCommand, AtaDisk, Channel}; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub mod ide; fn main() { pcid_interface::pci_daemon(daemon); } +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { let pci_config = pcid_handle.config(); @@ -294,3 +297,8 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { std::process::exit(0); } + +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { + unimplemented!() +} diff --git a/drivers/vboxd/src/main.rs b/drivers/vboxd/src/main.rs index 710f6afa06..bcb9bb157d 100644 --- a/drivers/vboxd/src/main.rs +++ b/drivers/vboxd/src/main.rs @@ -6,13 +6,12 @@ use std::io::{Read, Write}; use std::os::unix::io::AsRawFd; use std::{iter, mem}; -use common::io::{Io, Mmio, Pio}; +use common::io::{Io, Mmio}; use pcid_interface::PciFunctionHandle; use common::dma::Dma; -use crate::bga::Bga; - +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] mod bga; const VBOX_REQUEST_HEADER_VERSION: u32 = 0x10001; @@ -236,9 +235,11 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { let mut irq_file = irq.irq_handle("vboxd"); - let mut port = Pio::::new(bar0 as u16); let address = unsafe { pcid_handle.map_bar(1) }.ptr.as_ptr(); + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { + let mut port = common::io::Pio::::new(bar0 as u16); + let vmmdev = unsafe { &mut *(address as *mut VboxVmmDev) }; let mut guest_info = VboxGuestInfo::new().expect("vboxd: failed to map GuestInfo"); @@ -278,7 +279,7 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { libredox::call::setrens(0, 0).expect("vboxd: failed to enter null namespace"); - let mut bga = Bga::new(); + let mut bga = crate::bga::Bga::new(); let get_mouse = VboxGetMouse::new().expect("vboxd: failed to map GetMouse"); let display_change = VboxDisplayChange::new().expect("vboxd: failed to map DisplayChange"); let ack_events = VboxAckEvents::new().expect("vboxd: failed to map AckEvents");