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:
Jacob G-W 2023-06-09 20:32:33 -04:00 committed by Veikka Tuominen
parent 34d44e0c1c
commit c842deea75

View file

@ -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"
);
}