From cc6f792a03eacf0abac993964f68444713159430 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Fri, 19 Mar 2021 11:06:56 +0100 Subject: [PATCH] Use options(noreturn) in all naked functions. --- src/context/arch/x86_64.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/context/arch/x86_64.rs b/src/context/arch/x86_64.rs index a333a69..ceffbb0 100644 --- a/src/context/arch/x86_64.rs +++ b/src/context/arch/x86_64.rs @@ -216,12 +216,14 @@ pub unsafe extern "C" fn switch_to(_prev: &mut Context, _next: &mut Context) { // the calling function, `context::switch`. Thus, we have to execute this Rust hook by // ourselves, which will unlock the contexts before the later switch. - call {switch_hook} + // Note that switch_finish_hook will be responsible for executing `ret`. + jmp {switch_hook} ", true = const(AbiCompatBool::True as u8), switch_hook = sym crate::context::switch_finish_hook, + options(noreturn), ); } @@ -275,8 +277,10 @@ unsafe extern fn signal_handler_wrapper() { pop rcx pop rax add rsp, 16 + ret ", inner = sym inner, + options(noreturn), ); }