From d385f36cbf11048d4222d203e02108f3d85cb82c Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Fri, 1 Nov 2024 02:13:22 +0900 Subject: [PATCH] x11bridge: Gate off aarch64-specific code on !aarch64 Signed-off-by: Asahi Lina --- .../muvm/src/x11bridge/bin/muvm-x11bridge.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/muvm/src/x11bridge/bin/muvm-x11bridge.rs b/crates/muvm/src/x11bridge/bin/muvm-x11bridge.rs index 74c7105..74335b2 100644 --- a/crates/muvm/src/x11bridge/bin/muvm-x11bridge.rs +++ b/crates/muvm/src/x11bridge/bin/muvm-x11bridge.rs @@ -639,12 +639,15 @@ impl Drop for FutexWatcherThread { } } +#[allow(dead_code)] struct RemoteCaller { pid: Pid, regs: user_regs_struct, } impl RemoteCaller { + // This is arch-specific, so gate it off of x86_64 builds done for CI purposes + #[cfg(target_arch = "aarch64")] fn with(pid: Pid, f: F) -> Result where F: FnOnce(&RemoteCaller) -> Result, @@ -710,6 +713,9 @@ impl RemoteCaller { ) .map(|x| x as i32) } + + // This is arch-specific, so gate it off of x86_64 builds done for CI purposes + #[cfg(target_arch = "aarch64")] fn syscall(&self, syscall_no: c_long, args: [c_ulonglong; 6]) -> Result { let mut regs = self.regs; regs.regs[..6].copy_from_slice(&args); @@ -723,6 +729,18 @@ impl RemoteCaller { regs = ptrace::getregs(self.pid)?; Ok(regs.regs[0]) } + + #[cfg(not(target_arch = "aarch64"))] + fn with(_pid: Pid, _f: F) -> Result + where + F: FnOnce(&RemoteCaller) -> Result, + { + Err(Errno::EOPNOTSUPP.into()) + } + #[cfg(not(target_arch = "aarch64"))] + fn syscall(&self, _syscall_no: c_long, _args: [c_ulonglong; 6]) -> Result { + Err(Errno::EOPNOTSUPP.into()) + } } fn wait_for_stop(pid: Pid) -> Result<()> { @@ -1178,6 +1196,8 @@ impl Client { // Allow everything in /dev/shm (including paths with trailing '(deleted)') let shmem_file = if filename.starts_with(SHM_DIR) { File::from(memfd) + } else if cfg!(not(target_arch = "aarch64")) { + return Err(Errno::EOPNOTSUPP.into()); } else { let (fd, shmem_path) = mkstemp(SHM_TEMPLATE)?; let mut shmem_file = unsafe { File::from_raw_fd(fd) };