From db2528e820b70c456d541c26e881c534fb4e100b Mon Sep 17 00:00:00 2001 From: Byeongkeun Ahn <7p54ks3@naver.com> Date: Wed, 9 Oct 2024 02:39:35 +0900 Subject: [PATCH] Update linux.rs --- basm-std/src/platform/os/linux.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/basm-std/src/platform/os/linux.rs b/basm-std/src/platform/os/linux.rs index 2854edff..67038e42 100644 --- a/basm-std/src/platform/os/linux.rs +++ b/basm-std/src/platform/os/linux.rs @@ -2,7 +2,11 @@ use super::super::allocator; use super::super::malloc::{dlmalloc, dlmalloc_linux}; pub mod syscall { + #[cfg(not(target_arch = "x86"))] use core::arch::asm; + #[cfg(target_arch = "x86")] + use core::arch::naked_asm; + pub const PROT_READ: i32 = 0x01; pub const PROT_WRITE: i32 = 0x02; pub const MAP_PRIVATE: i32 = 0x02; @@ -140,7 +144,7 @@ pub mod syscall { arg5: usize, ) -> usize { unsafe { - asm!( + naked_asm!( "push ebp", "push ebx", "push esi", @@ -157,8 +161,7 @@ pub mod syscall { "pop esi", "pop ebx", "pop ebp", - "ret", - options(noreturn) + "ret" ); } }