summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/unistd/mipsn32
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 13:54:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 13:54:38 +0000
commit8c1ab65c0f548d20b7f177bdb736daaf603340e1 (patch)
treedf55b7e75bf43f2bf500845b105afe3ac3a5157e /libc-top-half/musl/src/unistd/mipsn32
parentInitial commit. (diff)
downloadwasi-libc-8c1ab65c0f548d20b7f177bdb736daaf603340e1.tar.xz
wasi-libc-8c1ab65c0f548d20b7f177bdb736daaf603340e1.zip
Adding upstream version 0.0~git20221206.8b7148f.upstream/0.0_git20221206.8b7148f
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-top-half/musl/src/unistd/mipsn32')
-rw-r--r--libc-top-half/musl/src/unistd/mipsn32/lseek.c20
-rw-r--r--libc-top-half/musl/src/unistd/mipsn32/pipe.s19
2 files changed, 39 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/unistd/mipsn32/lseek.c b/libc-top-half/musl/src/unistd/mipsn32/lseek.c
new file mode 100644
index 0000000..60e74a5
--- /dev/null
+++ b/libc-top-half/musl/src/unistd/mipsn32/lseek.c
@@ -0,0 +1,20 @@
+#include <unistd.h>
+#include "syscall.h"
+
+off_t __lseek(int fd, off_t offset, int whence)
+{
+ register long long r4 __asm__("$4") = fd;
+ register long long r5 __asm__("$5") = offset;
+ register long long r6 __asm__("$6") = whence;
+ register long long r7 __asm__("$7");
+ register long long r2 __asm__("$2") = SYS_lseek;
+ __asm__ __volatile__ (
+ "syscall"
+ : "+&r"(r2), "=r"(r7)
+ : "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 ? __syscall_ret(-r2) : r2;
+}
+
+weak_alias(__lseek, lseek);
+weak_alias(__lseek, lseek64);
diff --git a/libc-top-half/musl/src/unistd/mipsn32/pipe.s b/libc-top-half/musl/src/unistd/mipsn32/pipe.s
new file mode 100644
index 0000000..80f882e
--- /dev/null
+++ b/libc-top-half/musl/src/unistd/mipsn32/pipe.s
@@ -0,0 +1,19 @@
+.set noreorder
+.global pipe
+.type pipe,@function
+pipe:
+ lui $3, %hi(%neg(%gp_rel(pipe)))
+ addiu $3, $3, %lo(%neg(%gp_rel(pipe)))
+ addu $3, $3, $25
+ li $2, 6021
+ syscall
+ beq $7, $0, 1f
+ nop
+ lw $25, %got_disp(__syscall_ret)($3)
+ jr $25
+ subu $4, $0, $2
+1: sw $2, 0($4)
+ sw $3, 4($4)
+ move $2, $0
+ jr $ra
+ nop