ref: ed37a0edd2a9c2f992d1f50c38203de7457e2a62
parent: 0c522bb285e38a32f46afeadd554e6f0bc86e407
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 19 20:09:09 EDT 2017
Fix tests on NetBSD
--- a/lib/sys/sys+netbsd-x64.myr
+++ b/lib/sys/sys+netbsd-x64.myr
@@ -1003,7 +1003,8 @@
const __getcwd = {buf; -> syscall(Sys__getcwd, a(buf), a(buf.len))}
/* file stuff */
-const pipe = {fds; -> syscall(Syspipe, fds)}
+extern const __netbsd_pipe : (fds : fd[2]# -> int64)
+const pipe = {fds; -> __netbsd_pipe(fds)}
const dup = {fd; -> (syscall(Sysdup, a(fd)) : fd)}
const dup2 = {src, dst; -> (syscall(Sysdup2, a(src), a(dst)) : fd)}
const fcntl = {fd, cmd, args; -> syscall(Sysfcntl, a(fd), a(cmd), a(args))}
--- a/lib/sys/syscall+netbsd-x64.s
+++ b/lib/sys/syscall+netbsd-x64.s
@@ -33,6 +33,20 @@
addq $16,%rsp
ret
+.globl sys$__netbsd_pipe
+sys$__netbsd_pipe:
+ movq $0x2a,%rax
+ syscall
+
+ jae .pipesuccess
+ negq %rax
+
+.pipesuccess:
+ movl %eax,(%rdi)
+ movl %edx,4(%rdi)
+ xorq %rax,%rax
+ ret
+
/* __tfork_thread(tfp : tforkparams#, sz : size, fn : void#, arg : void#-> tid) */
.globl sys$__tfork_thread
sys$__tfork_thread: