mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
os/plan9: fix order of register setting in syscall1
We need to set rbp last because the arguments are stored on the stack. If we clobber rbp first, then we will get a segfault when trying to access the function arguments. I believe I had already done this with the other syscall* functions, but not with syscall1, so this allows single argument syscalls like close to work.
This commit is contained in:
parent
34d44e0c1c
commit
c842deea75
1 changed files with 2 additions and 2 deletions
|
|
@ -9,8 +9,8 @@ pub fn syscall1(sys: plan9.SYS, arg0: usize) usize {
|
|||
\\pop %%r11
|
||||
\\pop %%r11
|
||||
: [ret] "={rax}" (-> usize),
|
||||
: [syscall_number] "{rbp}" (@enumToInt(sys)),
|
||||
[arg0] "{r8}" (arg0),
|
||||
: [arg0] "{r8}" (arg0),
|
||||
[syscall_number] "{rbp}" (@enumToInt(sys)),
|
||||
: "rcx", "rax", "rbp", "r11", "memory"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue