Stop using naked functions for restore_context

This commit is contained in:
Gary Guo 2023-12-30 21:36:11 +00:00
parent 96888d814f
commit 06699c21b0
5 changed files with 12 additions and 12 deletions

View File

@ -94,8 +94,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
}
}
#[naked]
pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
pub unsafe fn restore_context(ctx: &Context) -> ! {
unsafe {
asm!(
"
@ -136,6 +135,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
ldp x0, x1, [x0, 0x00]
ret
",
in("x0") ctx,
options(noreturn)
);
}

View File

@ -214,8 +214,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
}
}
#[naked]
pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
pub unsafe fn restore_context(ctx: &Context) -> ! {
#[cfg(target_feature = "d")]
unsafe {
asm!(
@ -225,6 +224,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
lw a0, 0x28(a0)
ret
",
in("a0") ctx,
options(noreturn)
);
}
@ -236,6 +236,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
lw a0, 0x28(a0)
ret
",
in("a0") ctx,
options(noreturn)
);
}

View File

@ -214,8 +214,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
}
}
#[naked]
pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
pub unsafe fn restore_context(ctx: &Context) -> ! {
#[cfg(target_feature = "d")]
unsafe {
asm!(
@ -225,6 +224,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
ld a0, 0x50(a0)
ret
",
in("a0") ctx,
options(noreturn)
);
}
@ -236,6 +236,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
ld a0, 0x50(a0)
ret
",
in("a0") ctx,
options(noreturn)
);
}

View File

@ -96,13 +96,10 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
}
}
#[naked]
pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
pub unsafe fn restore_context(ctx: &Context) -> ! {
unsafe {
asm!(
"
mov edx, [esp + 4]
/* Restore stack */
mov esp, [edx + 16]
@ -130,6 +127,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
ret
",
in("edx") ctx,
options(noreturn)
);
}

View File

@ -94,8 +94,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
}
}
#[naked]
pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
pub unsafe fn restore_context(ctx: &Context) -> ! {
unsafe {
asm!(
"
@ -134,6 +133,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
ret
",
in("rdi") ctx,
options(noreturn)
);
}