From c93b43b4b7a251fbe3eff46d91e4cb8aa5a8db51 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Mon, 24 Jun 2024 14:53:58 +0200 Subject: [PATCH] Build on i686, remove unnecessary #[no_mangle]. --- redox-rt/src/arch/i686.rs | 14 ++++++-------- redox-rt/src/arch/x86_64.rs | 14 ++++++-------- redox-rt/src/signal.rs | 4 ++-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/redox-rt/src/arch/i686.rs b/redox-rt/src/arch/i686.rs index bab929a1..27060616 100644 --- a/redox-rt/src/arch/i686.rs +++ b/redox-rt/src/arch/i686.rs @@ -44,13 +44,11 @@ pub fn copy_env_regs(cur_pid_fd: usize, new_pid_fd: usize) -> Result<()> { Ok(()) } -#[no_mangle] -unsafe extern "cdecl" fn __relibc_internal_fork_impl(initial_rsp: *mut usize) -> usize { +unsafe extern "cdecl" fn fork_impl(initial_rsp: *mut usize) -> usize { Error::mux(fork_inner(initial_rsp)) } -#[no_mangle] -unsafe extern "cdecl" fn __relibc_internal_fork_hook(cur_filetable_fd: usize, new_pid_fd: usize) { +unsafe extern "cdecl" fn child_hook(cur_filetable_fd: usize, new_pid_fd: usize) { let _ = syscall::close(cur_filetable_fd); let _ = syscall::close(new_pid_fd); } @@ -71,14 +69,14 @@ asmfunction!(__relibc_internal_fork_wrapper -> usize: [" fnstcw [esp+24] push esp - call __relibc_internal_fork_impl + call {fork_impl} pop esp jmp 2f -"] <= []); +"] <= [fork_impl = sym fork_impl]); asmfunction!(__relibc_internal_fork_ret: [" // Arguments already on the stack - call __relibc_internal_fork_hook + call {child_hook} //TODO ldmxcsr [esp+16] fldcw [esp+24] @@ -97,7 +95,7 @@ asmfunction!(__relibc_internal_fork_ret: [" pop ebp ret -"] <= []); +"] <= [child_hook = sym child_hook]); asmfunction!(__relibc_internal_sigentry: [" sub esp, 512 fxsave [esp] diff --git a/redox-rt/src/arch/x86_64.rs b/redox-rt/src/arch/x86_64.rs index 2b54b5c5..a5b2e7e7 100644 --- a/redox-rt/src/arch/x86_64.rs +++ b/redox-rt/src/arch/x86_64.rs @@ -49,13 +49,11 @@ pub fn copy_env_regs(cur_pid_fd: usize, new_pid_fd: usize) -> Result<()> { Ok(()) } -#[no_mangle] -unsafe extern "sysv64" fn __relibc_internal_fork_impl(initial_rsp: *mut usize) -> usize { +unsafe extern "sysv64" fn fork_impl(initial_rsp: *mut usize) -> usize { Error::mux(fork_inner(initial_rsp)) } -#[no_mangle] -unsafe extern "sysv64" fn __relibc_internal_fork_hook(cur_filetable_fd: usize, new_pid_fd: usize) { +unsafe extern "sysv64" fn child_hook(cur_filetable_fd: usize, new_pid_fd: usize) { let _ = syscall::close(cur_filetable_fd); let _ = syscall::close(new_pid_fd); } @@ -77,18 +75,18 @@ asmfunction!(__relibc_internal_fork_wrapper -> usize: [" fnstcw [rsp+24] mov rdi, rsp - call __relibc_internal_fork_impl + call {fork_impl} add rsp, 80 pop rbp ret -"] <= []); +"] <= [fork_impl = sym fork_impl]); asmfunction!(__relibc_internal_fork_ret: [" mov rdi, [rsp] mov rsi, [rsp + 8] - call __relibc_internal_fork_hook + call {child_hook} ldmxcsr [rsp+16] fldcw [rsp+24] @@ -105,7 +103,7 @@ asmfunction!(__relibc_internal_fork_ret: [" pop rbp ret -"] <= []); +"] <= [child_hook = sym child_hook]); asmfunction!(__relibc_internal_rlct_clone_ret: [" # Load registers pop rax diff --git a/redox-rt/src/signal.rs b/redox-rt/src/signal.rs index 7b72dd5e..6171630b 100644 --- a/redox-rt/src/signal.rs +++ b/redox-rt/src/signal.rs @@ -1,8 +1,8 @@ use core::cell::{Cell, UnsafeCell}; use core::ffi::c_int; -use core::sync::atomic::{AtomicU64, Ordering}; +use core::sync::atomic::Ordering; -use syscall::{Error, IntRegisters, Result, SetSighandlerData, SigProcControl, Sigcontrol, SigcontrolFlags, EINVAL, SIGCHLD, SIGCONT, SIGKILL, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGW0_NOCLDSTOP_BIT, SIGW0_TSTP_IS_STOP_BIT, SIGW0_TTIN_IS_STOP_BIT, SIGW0_TTOU_IS_STOP_BIT, SIGWINCH}; +use syscall::{Error, IntRegisters, Result, SetSighandlerData, SigProcControl, Sigcontrol, SigcontrolFlags, EINVAL, SIGCHLD, SIGCONT, SIGKILL, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGW0_NOCLDSTOP_BIT, SIGW0_TSTP_IS_STOP_BIT, SIGW0_TTIN_IS_STOP_BIT, SIGW0_TTOU_IS_STOP_BIT, SIGWINCH, data::AtomicU64}; use crate::{arch::*, Tcb}; use crate::sync::Mutex; -- GitLab