x86_64: remove returns from naked functions

This commit is contained in:
Jacob Young 2023-04-02 22:25:53 -04:00 committed by Jakub Konka
parent 1980f5479b
commit fde1ec5d0e
2 changed files with 17 additions and 6 deletions

View File

@ -125,36 +125,44 @@ pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *
pub fn restore() callconv(.Naked) void {
switch (@import("builtin").zig_backend) {
.stage2_c => return asm volatile (
.stage2_c => asm volatile (
\\ movl %[number], %%eax
\\ int $0x80
\\ ret
:
: [number] "i" (@enumToInt(SYS.sigreturn)),
: "memory"
),
else => return asm volatile ("int $0x80"
else => asm volatile (
\\ int $0x80
\\ ret
:
: [number] "{eax}" (@enumToInt(SYS.sigreturn)),
: "memory"
),
}
unreachable;
}
pub fn restore_rt() callconv(.Naked) void {
switch (@import("builtin").zig_backend) {
.stage2_c => return asm volatile (
.stage2_c => asm volatile (
\\ movl %[number], %%eax
\\ int $0x80
\\ ret
:
: [number] "i" (@enumToInt(SYS.rt_sigreturn)),
: "memory"
),
else => return asm volatile ("int $0x80"
else => asm volatile (
\\ int $0x80
\\ ret
:
: [number] "{eax}" (@enumToInt(SYS.rt_sigreturn)),
: "memory"
),
}
unreachable;
}
pub const O = struct {

View File

@ -109,7 +109,7 @@ pub const restore = restore_rt;
pub fn restore_rt() callconv(.Naked) void {
switch (@import("builtin").zig_backend) {
.stage2_c => return asm volatile (
.stage2_c => asm volatile (
\\ movl %[number], %%eax
\\ syscall
\\ retq
@ -117,12 +117,15 @@ pub fn restore_rt() callconv(.Naked) void {
: [number] "i" (@enumToInt(SYS.rt_sigreturn)),
: "rcx", "r11", "memory"
),
else => return asm volatile ("syscall"
else => asm volatile (
\\ syscall
\\ retq
:
: [number] "{rax}" (@enumToInt(SYS.rt_sigreturn)),
: "rcx", "r11", "memory"
),
}
unreachable;
}
pub const mode_t = usize;