From 15cdc4e0aa1154324d440db871f52c61181fd4a0 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Wed, 17 Jul 2024 16:04:17 +0200 Subject: [PATCH] Fix (modified) audiod. --- redox-rt/src/arch/x86_64.rs | 2 +- redox-rt/src/signal.rs | 3 ++- src/platform/redox/mod.rs | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/redox-rt/src/arch/x86_64.rs b/redox-rt/src/arch/x86_64.rs index 55a555509a..377bf79ed5 100644 --- a/redox-rt/src/arch/x86_64.rs +++ b/redox-rt/src/arch/x86_64.rs @@ -212,7 +212,7 @@ asmfunction!(__relibc_internal_sigentry: [" lock btr [rcx + {pctl_off_pending}], eax jnc 1b 2: - mov eax, edx + mov edx, eax shr edx, 5 lock btr fs:[{tcb_sc_off} + {sc_word} + edx * 4], eax add eax, 64 // indicate signal was targeted at thread diff --git a/redox-rt/src/signal.rs b/redox-rt/src/signal.rs index e83660b769..04b1ffddc6 100644 --- a/redox-rt/src/signal.rs +++ b/redox-rt/src/signal.rs @@ -42,7 +42,8 @@ pub struct SigStack { unsafe fn inner(stack: &mut SigStack) { let os = &Tcb::current().unwrap().os_specific; - let sig_idx = stack.sig_num; + let _targeted_thread_not_process = stack.sig_num >= 64; + stack.sig_num %= 64; // asm counts from 0 stack.sig_num += 1; diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index 0729cc9858..7e2e86b00b 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -802,9 +802,8 @@ impl Pal for Sys { os_tid: crate::pthread::OsTid, signal: usize, ) -> Result<(), crate::pthread::Errno> { - todo!(); - /*syscall::kill(os_tid.context_id, signal) - .map_err(|error| crate::pthread::Errno(error.errno))?;*/ + let killfd = FdGuard::new(syscall::dup(os_tid.thread_fd, b"signal")?); + syscall::write(*killfd, &(signal as u32).to_ne_bytes())?; Ok(()) } fn current_os_tid() -> crate::pthread::OsTid {