summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-09-20 00:09:09 -0700
committerOri Bernstein <ori@eigenstate.org>2017-09-20 00:09:09 -0700
commited37a0edd2a9c2f992d1f50c38203de7457e2a62 (patch)
treeecbaf2b5a3d70c5284c1c732074314caf6e8c5f9
parent0c522bb285e38a32f46afeadd554e6f0bc86e407 (diff)
downloadmc-ed37a0edd2a9c2f992d1f50c38203de7457e2a62.tar.gz
Fix tests on NetBSD
-rw-r--r--lib/sys/sys+netbsd-x64.myr3
-rw-r--r--lib/sys/syscall+netbsd-x64.s14
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/sys/sys+netbsd-x64.myr b/lib/sys/sys+netbsd-x64.myr
index c13d88a..02f9a76 100644
--- a/lib/sys/sys+netbsd-x64.myr
+++ b/lib/sys/sys+netbsd-x64.myr
@@ -1003,7 +1003,8 @@ const chdir = {dir; -> syscall(Syschdir, cstring(dir))}
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))}
diff --git a/lib/sys/syscall+netbsd-x64.s b/lib/sys/syscall+netbsd-x64.s
index d716798..3b25573 100644
--- a/lib/sys/syscall+netbsd-x64.s
+++ b/lib/sys/syscall+netbsd-x64.s
@@ -33,6 +33,20 @@ sys$syscall:
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: