Use naked_asm instead in naked functions

This commit is contained in:
pjht 2024-11-07 15:21:25 -06:00
parent 4e71a2cd5a
commit 96d7de8434
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A
2 changed files with 12 additions and 13 deletions

18
Cargo.lock generated
View File

@ -1,12 +1,12 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "compiler_builtins"
version = "0.1.131"
version = "0.1.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d18d2ba094b78965890b2912f45dc8cb6bb3aff315ef54755ec33223b6454502"
checksum = "7925a77545f37a18e152a4aeaeb9a220309022067cafcfa2ecebe9ec55d36ccb"
[[package]]
name = "gimli"
@ -21,21 +21,21 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.159"
version = "0.2.162"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
[[package]]
name = "rustc-std-workspace-alloc"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff66d57013a5686e1917ed6a025d54dd591fcda71a41fe07edf4d16726aefa86"
checksum = "f9d441c3b2ebf55cebf796bfdc265d67fa09db17b7bb6bd4be75c509e1e8fec3"
[[package]]
name = "rustc-std-workspace-core"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1956f5517128a2b6f23ab2dadf1a976f4f5b27962e7724c2bf3d45e539ec098c"
checksum = "aa9c45b374136f52f2d6311062c7146bff20fec063c3f5d46a410bd937746955"
[[package]]
name = "spin"

View File

@ -1,4 +1,4 @@
use core::arch::asm;
use core::arch::{asm, naked_asm};
use core::fmt;
use core::ops;
use gimli::{Register, X86_64};
@ -61,7 +61,7 @@ impl ops::IndexMut<gimli::Register> for Context {
pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), ptr: *mut ()) {
// No need to save caller-saved registers here.
unsafe {
asm!(
naked_asm!(
"
sub rsp, 0x98
mov [rsp + 0x18], rbx
@ -88,8 +88,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
call rax
add rsp, 0x98
ret
",
options(noreturn)
"
);
}
}