about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/unistd/mipsn32/lseek.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/unistd/mipsn32/lseek.c b/src/unistd/mipsn32/lseek.c
new file mode 100644
index 00000000..60e74a51
--- /dev/null
+++ b/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);