| author | |
| committer | |
| log | c842deea757a3de7565b6b06f5e6c0b5cc883827 |
| tree | c644349a804231edd0b065ba90dbf06d2263cf46 |
| parent | 34d44e0c1c2cdfc5916dd5c56914f181f87e8d85 |
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.1 files changed, 2 insertions(+), 2 deletions(-)
lib/std/os/plan9/x86_64.zig+2-2| ... | ... | @@ -9,8 +9,8 @@ pub fn syscall1(sys: plan9.SYS, arg0: usize) usize { |
| 9 | 9 | \\pop %%r11 |
| 10 | 10 | \\pop %%r11 |
| 11 | 11 | : [ret] "={rax}" (-> usize), |
| 12 | : [syscall_number] "{rbp}" (@enumToInt(sys)), | |
| 13 | [arg0] "{r8}" (arg0), | |
| 12 | : [arg0] "{r8}" (arg0), | |
| 13 | [syscall_number] "{rbp}" (@enumToInt(sys)), | |
| 14 | 14 | : "rcx", "rax", "rbp", "r11", "memory" |
| 15 | 15 | ); |
| 16 | 16 | } |