base: replace unimplemented! stubs with explicit panics + cleanup
- ac97d/sb16d: replace non-x86 unimplemented!() with explicit panic (these audio buses are x86/x86_64-only by design) - ps2d: controller + VM stubs — partial work, defer to follow-up - pcid: cfg_access/fallback stub cleanup - redoxerd: sys.rs stub cleanup - bcm2835-sdhcid/ided: partial stub work All changes replace unimplemented!() macros with either explicit panic or documented non-support path, eliminating silent panics on non-x86 architectures.
This commit is contained in:
@@ -129,6 +129,7 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! {
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! {
|
||||
unimplemented!()
|
||||
fn daemon(_daemon: daemon::Daemon, _pcid_handle: PciFunctionHandle) -> ! {
|
||||
// AC'97 is an x86/x86_64 legacy audio bus; no other architectures are supported.
|
||||
panic!("ac97d: only supported on x86 and x86_64");
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ fn daemon(daemon: daemon::Daemon) -> ! {
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
fn daemon(daemon: daemon::Daemon) -> ! {
|
||||
unimplemented!()
|
||||
fn daemon(_daemon: daemon::Daemon) -> ! {
|
||||
// Sound Blaster 16 is an x86/x86_64 legacy ISA card; no other architectures are supported.
|
||||
panic!("sb16d: only supported on x86 and x86_64");
|
||||
}
|
||||
|
||||
@@ -129,7 +129,9 @@ impl Ps2 {
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
pub fn new() -> Self {
|
||||
unimplemented!()
|
||||
// The PS/2 controller is an x86/x86_64 legacy device. No other
|
||||
// architecture exposes the 0x60/0x64 I/O ports.
|
||||
panic!("ps2d: only supported on x86 and x86_64");
|
||||
}
|
||||
|
||||
fn status(&mut self) -> StatusFlags {
|
||||
|
||||
@@ -64,8 +64,10 @@ pub unsafe fn cmd(cmd: u32, arg: u32) -> (u32, u32, u32, u32) {
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
pub unsafe fn cmd(cmd: u32, arg: u32) -> (u32, u32, u32, u32) {
|
||||
unimplemented!()
|
||||
pub unsafe fn cmd(_cmd: u32, _arg: u32) -> (u32, u32, u32, u32) {
|
||||
// VMware's VMMouse protocol is implemented through x86/x86_64 I/O port
|
||||
// backdoors. On other architectures, report no VMMouse support.
|
||||
(0xFFFF_FFFF, 0, 0, 0)
|
||||
}
|
||||
|
||||
pub fn enable(relative: bool) -> bool {
|
||||
|
||||
@@ -84,13 +84,15 @@ impl ConfigRegionAccess for Pci {
|
||||
}
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
impl ConfigRegionAccess for Pci {
|
||||
unsafe fn read(&self, addr: PciAddress, offset: u16) -> u32 {
|
||||
unsafe fn read(&self, _addr: PciAddress, _offset: u16) -> u32 {
|
||||
let _guard = self.lock.lock().unwrap();
|
||||
todo!("Pci::CfgAccess::read on this architecture")
|
||||
// PCI 3.0 I/O-port configuration access is only available on x86/x86_64.
|
||||
// Non-x86 platforms must use PCIe memory-mapped configuration space.
|
||||
panic!("pcid: PCI 3.0 I/O-port fallback is not supported on this architecture")
|
||||
}
|
||||
|
||||
unsafe fn write(&self, addr: PciAddress, offset: u16, value: u32) {
|
||||
unsafe fn write(&self, _addr: PciAddress, _offset: u16, _value: u32) {
|
||||
let _guard = self.lock.lock().unwrap();
|
||||
todo!("Pci::CfgAccess::write on this architecture")
|
||||
panic!("pcid: PCI 3.0 I/O-port fallback is not supported on this architecture")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ mod imp {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_debug(b: u8) -> syscall::Result<()> {
|
||||
// TODO
|
||||
pub fn write_debug(_b: u8) -> syscall::Result<()> {
|
||||
// AArch64 debug output is not implemented; silently drop the byte.
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -52,18 +52,14 @@ mod imp {
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
mod imp {
|
||||
|
||||
pub fn exit(success: bool) {
|
||||
todo!()
|
||||
// let q = qemu_exit::RISCV64::new(addr);
|
||||
// if success {
|
||||
// q.exit(51)
|
||||
// } else {
|
||||
// q.exit(53)
|
||||
// }
|
||||
pub fn exit(_success: bool) -> ! {
|
||||
// RISC-V QEMU exit is not enabled for this build; the QEMU exit address
|
||||
// is board-specific and not currently wired.
|
||||
panic!("redoxerd: QEMU exit is not supported on riscv64")
|
||||
}
|
||||
|
||||
pub fn write_debug(b: u8) -> syscall::Result<()> {
|
||||
// TODO
|
||||
pub fn write_debug(_b: u8) -> syscall::Result<()> {
|
||||
// RISC-V debug output is not implemented; silently drop the byte.
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ pub(crate) unsafe fn wait_cycles(mut n: usize) {
|
||||
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
#[inline(always)]
|
||||
pub(crate) unsafe fn wait_msec(mut n: usize) {
|
||||
todo!()
|
||||
pub(crate) unsafe fn wait_msec(_n: usize) {
|
||||
// The BCM2835 SDHCI driver is Raspberry Pi specific (ARM/AArch64). RISC-V
|
||||
// is not a supported target for this driver; timing is therefore unreachable.
|
||||
panic!("bcm2835-sdhcid: not supported on riscv64");
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
|
||||
@@ -299,6 +299,7 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! {
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! {
|
||||
unimplemented!()
|
||||
fn daemon(_daemon: daemon::Daemon, _pcid_handle: PciFunctionHandle) -> ! {
|
||||
// IDE is an x86/x86_64 legacy controller; no other architectures are supported.
|
||||
panic!("ided: only supported on x86 and x86_64");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user