From a926baefaf269ca80a80a7763b7232d0c22c8b8e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 12 Apr 2025 08:14:38 -0600 Subject: [PATCH] aarch64 fp_load/fp_save do not need to be naked There is a bug with LLVM and Rust causing naked functions to not support target_enable directives. https://github.com/rust-lang/rust/issues/136280 --- src/context/arch/aarch64.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/context/arch/aarch64.rs b/src/context/arch/aarch64.rs index 844164cf86..2d71fce0ba 100644 --- a/src/context/arch/aarch64.rs +++ b/src/context/arch/aarch64.rs @@ -204,9 +204,8 @@ pub unsafe fn empty_cr3() -> rmm::PhysicalAddress { } #[target_feature(enable = "neon")] -#[naked] unsafe extern "C" fn fp_save(float_regs: &mut FloatRegisters) { - core::arch::naked_asm!( + core::arch::asm!( "stp q0, q1, [x0, {0} + 16 * 0]", "stp q2, q3, [x0, {0} + 16 * 2]", "stp q4, q5, [x0, {0} + 16 * 4]", @@ -228,7 +227,6 @@ unsafe extern "C" fn fp_save(float_regs: &mut FloatRegisters) { "str x9, [x0]", "mrs x9, fpsr", "str x9, [x0, {2} - {1}]", - "ret", const mem::offset_of!(FloatRegisters, fp_simd_regs), const mem::offset_of!(FloatRegisters, fpcr), const mem::offset_of!(FloatRegisters, fpsr), @@ -236,9 +234,8 @@ unsafe extern "C" fn fp_save(float_regs: &mut FloatRegisters) { } #[target_feature(enable = "neon")] -#[naked] unsafe extern "C" fn fp_load(float_regs: &mut FloatRegisters) { - core::arch::naked_asm!( + core::arch::asm!( "ldp q0, q1, [x0, {0} + 16 * 0]", "ldp q2, q3, [x0, {0} + 16 * 2]", "ldp q4, q5, [x0, {0} + 16 * 4]", @@ -260,7 +257,6 @@ unsafe extern "C" fn fp_load(float_regs: &mut FloatRegisters) { "msr fpcr, x9", "ldr x9, [x0, {2} - {1}]", "msr fpsr, x9", - "ret", const mem::offset_of!(FloatRegisters, fp_simd_regs), const mem::offset_of!(FloatRegisters, fpcr), const mem::offset_of!(FloatRegisters, fpsr),