This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH v8 05/12] C-SKY: Linux Syscall Interface
- From: Mao Han <han_mao at c-sky dot com>
- To: libc-alpha at sourceware dot org
- Cc: c-sky_gcc_upstream at c-sky dot com, gnu-csky at mentor dot com, Mao Han <han_mao at c-sky dot com>
- Date: Thu, 20 Dec 2018 11:02:41 +0800
- Subject: [PATCH v8 05/12] C-SKY: Linux Syscall Interface
- References: <cover.1545194586.git.han_mao@c-sky.com>
- References: <cover.1545194586.git.han_mao@c-sky.com>
This patch contains the Linux system call interface.
* sysdeps/unix/sysv/linux/csky/abiv2/____longjmp_chk.S: New file.
* sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise.
* sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S: Likewise.
* sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.
* sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S: Likewise.
* sysdeps/unix/sysv/linux/csky/abiv2/syscall.S: Likewise.
* sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S: Likewise.
* sysdeps/unix/sysv/linux/csky/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/csky/pt-vfork.S: Likewise.
---
.../unix/sysv/linux/csky/abiv2/____longjmp_chk.S | 81 ++++++++++++++++++
sysdeps/unix/sysv/linux/csky/abiv2/clone.S | 95 +++++++++++++++++++++
sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S | 73 ++++++++++++++++
sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S | 96 ++++++++++++++++++++++
sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S | 78 ++++++++++++++++++
sysdeps/unix/sysv/linux/csky/abiv2/syscall.S | 69 ++++++++++++++++
sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S | 65 +++++++++++++++
sysdeps/unix/sysv/linux/csky/pt-vfork.S | 1 +
sysdeps/unix/sysv/linux/csky/syscalls.list | 2 +
9 files changed, 560 insertions(+)
create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/____longjmp_chk.S
create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/clone.S
create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S
create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S
create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S
create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/syscall.S
create mode 100644 sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S
create mode 100644 sysdeps/unix/sysv/linux/csky/pt-vfork.S
create mode 100644 sysdeps/unix/sysv/linux/csky/syscalls.list
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/____longjmp_chk.S b/sysdeps/unix/sysv/linux/csky/abiv2/____longjmp_chk.S
new file mode 100644
index 0000000..88cb310
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/____longjmp_chk.S
@@ -0,0 +1,81 @@
+/* longjmp with sp check for C-SKY ABIV2.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ .section .rodata.str1.8,"aMS",@progbits,1
+ .align 2
+ .type longjmp_msg,@object
+longjmp_msg:
+ .string "longjmp causes uninitialized stack frame"
+ .size longjmp_msg, .-longjmp_msg
+
+ .text
+#define __longjmp ____longjmp_chk
+
+#ifdef __PIC__
+# define CALL_FAIL \
+ subi sp, 8; \
+ stw gb, (sp, 0); \
+ grs gb, .Lgetpc1; \
+.Lgetpc1: \
+ lrw t0, .Lgetpc1@GOTPC; \
+ addu gb, gb, t0; \
+ lrw a0, longjmp_msg@GOTOFF; \
+ addu a0, a0, gb; \
+ lrw t0, (HIDDEN_JUMPTARGET (__fortify_fail))@PLT; \
+ ldr.w t0, (gb, t0 << 0); \
+ jsr t0; \
+ ldw gb, (sp, 0); \
+ addi sp, 8;
+#else /* __PIC__ */
+# define CALL_FAIL \
+ lrw a0, longjmp_msg; \
+ jsri HIDDEN_JUMPTARGET (__fortify_fail);
+#endif /* __PIC__ */
+
+# define CHECK_SP(reg) \
+ cmplt sp, reg; \
+ bt .Lok1; \
+ mov r9, a0; \
+ mov t0, r7; \
+ lrw r7, __NR_sigaltstack; \
+ movi a0, 0; \
+ subi sp, 12; /* sizeof (stack_t) */ \
+ mov a1, sp; \
+ trap 0; \
+ mov r7, t0; \
+ cmpnei a0, 0; \
+ bt .Lok; \
+ ldw a1, (sp, 4); \
+ btsti a1, 1; \
+ bt .Lfail; \
+ ldw a1, (sp, 0); \
+ ldw a3, (sp, 8); \
+ add a1, a3; \
+ sub a1, reg; \
+ cmphs a1, a3; \
+ bt .Lok; \
+.Lfail: \
+ addi sp, 12; \
+ CALL_FAIL \
+.Lok: \
+ mov a0, r9; \
+.Lok1:
+
+#include <__longjmp.S>
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/clone.S b/sysdeps/unix/sysv/linux/csky/abiv2/clone.S
new file mode 100644
index 0000000..4d01e1b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/clone.S
@@ -0,0 +1,95 @@
+/* Wrapper around clone system call. C-SKY ABIV2 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* clone() is even more special than fork() as it mucks with stacks
+ and invokes a function in the right context after its all over. */
+
+#include <sysdep.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+
+/* int clone (int (*fn) (void *arg), void *child_stack, int flags, void *arg,
+ pid_t *ptid, struct user_desc *tls, pid_t *ctid) */
+
+ .text
+ENTRY (__clone)
+ /* Sanity check arguments. */
+ cmpnei a0, 0 /* No NULL function pointers. */
+ bf __error_arg
+ cmpnei a1, 0 /* No NULL stack pointers. */
+ bf __error_arg
+
+ subi a1, 8
+ stw a0, (a1, 0) /* Insert the function into the new stack. */
+ stw a3, (a1, 4) /* Insert the args into the new stack. */
+
+ mov t1, r7 /* Save r7. */
+ mov t2, r4 /* Save r4. */
+
+ /* The syscall expects the args to be in different slots. */
+ mov a0, a2
+ ldw a2, (sp, 0)
+ ldw a3, (sp, 8)
+ ldw r4, (sp, 4)
+ lrw r7, __NR_clone
+ trap 0
+
+ mov r7, t1 /* Restore r7. */
+ mov r4, t2 /* Restore r4. */
+ btsti a0, 31 /* Check if return is less than zero. */
+ bt __do_syscall_error
+ cmpnei a0, 0
+ bf __child
+ rts
+
+__error_arg:
+ lrw a0, -EINVAL
+
+__do_syscall_error:
+#ifdef __PIC__
+ subi sp, 8
+ stw gb, (sp, 0)
+ stw r15, (sp, 4)
+ grs gb, .Lgetpc
+.Lgetpc:
+ lrw t0, .Lgetpc@GOTPC
+ addu gb, gb, t0
+ lrw t0, __syscall_error@PLT
+ ldr.w t0, (gb, t0 << 0)
+ jsr t0
+ ldw gb, (sp, 0)
+ ldw r15, (sp, 4)
+ addi sp, 8
+#else
+ jmpi __syscall_error
+#endif /* __PIC__ */
+ rts
+PSEUDO_END (__clone)
+
+__child:
+ ldw a0, (sp, 4) /* Restore args from new sp. */
+ ldw a1, (sp, 0) /* Restore function from new sp. */
+ addi sp, 8
+ jsr a1
+
+ /* exit */
+ lrw r7, __NR_exit
+ trap 0
+
+libc_hidden_def (__clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S b/sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S
new file mode 100644
index 0000000..9071c1b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/getcontext.S
@@ -0,0 +1,73 @@
+/* Save current context. C-SKY ABIV2 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int getcontext (ucontext_t *ucp) */
+
+ENTRY (__getcontext)
+ /* No need to save r2-r7 or a0-a3. */
+ mov t0, a0
+
+ addi a0, MCONTEXT_CSKY_R4
+
+ stm r4-r13, (a0) /* Save r4-r13. */
+ stw sp, (t0, MCONTEXT_CSKY_SP) /* Save sp. */
+ stw r15, (t0, MCONTEXT_CSKY_LR) /* Save lr. */
+ stw r15, (t0, MCONTEXT_CSKY_PC) /* Return to PC. */
+ addi a0, t0, MCONTEXT_CSKY_R16
+ stm r16-r31, (a0) /* Save r16-r31. */
+ movi a0, 0
+ stw a0, (t0, MCONTEXT_CSKY_A0) /* Return zero. */
+
+ subi sp, 8
+ stw t0, (sp, 0) /* Save t0 after "save sp". */
+
+ /* __sigprocmask (SIG_BLOCK, NULL, &(ucontext->uc_sigmask)) */
+ movi a0, SIG_BLOCK
+ movi a1, 0
+ addi a2, t0, UCONTEXT_SIGMASK
+
+ /* Do sigprocmask syscall. */
+#ifdef __PIC__
+ subi sp, 8
+ stw gb, (sp, 0)
+ grs gb, .Lgetpc
+.Lgetpc:
+ lrw a3, .Lgetpc@GOTPC
+ addu gb, gb, a3
+ lrw a3, __sigprocmask@PLT
+ ldr.w a3, (gb, a3 << 0)
+ jsr a3
+ ldw gb, (sp, 0)
+ addi sp, 8
+#else
+ jsri __sigprocmask
+#endif
+
+ ldw t0, (sp, 0)
+ addi sp, 8
+ /* Restore r15 for sigprocmask changes. */
+ ldw r15, (t0, MCONTEXT_CSKY_LR)
+ movi a0, 0 /* Return 0. */
+ jmp r15
+END (__getcontext)
+
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S b/sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S
new file mode 100644
index 0000000..827f0aa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S
@@ -0,0 +1,96 @@
+/* Set saved user context to current context. C-SKY ABIV2 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int setcontext (const ucontext_t *ucp) */
+
+ENTRY (__setcontext)
+ mov t0, a0
+ subi sp, 8
+ stw a0, (sp, 0)
+
+ /* Set sigmask. */
+ movi a0, SIG_SETMASK
+ addi a1, t0, UCONTEXT_SIGMASK
+ movi a2, 0
+
+ /* Do sigprocmask syscall. */
+#ifdef __PIC__
+ subi sp, 8
+ stw gb, (sp, 0)
+ grs gb, .Lgetpc1
+.Lgetpc1:
+ lrw a3, .Lgetpc1@GOTPC
+ addu gb, gb, a3
+ lrw a3, __sigprocmask@PLT
+ ldr.w a3, (gb, a3 << 0)
+ jsr a3
+ ldw gb, (sp, 0)
+ addi sp, 8
+#else
+ jsri __sigprocmask
+#endif /* __PIC__ */
+
+ ldw t0, (sp, 0)
+ addi sp, 8
+ /* Set r0-r11. Load a0-a3, for makecontext requires. */
+ addi t1, t0, MCONTEXT_CSKY_A0
+ ldm r0-r11, (t1)
+ ldw sp, (t0, MCONTEXT_CSKY_SP) /* Load sp. */
+ ldw r15, (t0, MCONTEXT_CSKY_LR) /* Load lr. */
+ ldw t0, (t0, MCONTEXT_CSKY_PC) /* Load start addr. */
+ jmp t0
+END (setcontext)
+weak_alias (__setcontext, setcontext)
+
+ENTRY (__startcontext)
+ mov a0, r9
+ cmpnei r9, 0 /* r9 was set in makecontext. */
+ bf 1f /* null, then exit. */
+
+ /* Call setcontext. */
+#ifdef __PIC__
+ grs t1, .Lgetpc2
+.Lgetpc2:
+ lrw t0, .Lgetpc2@GOTPC
+ addu t1, t1, t0
+ lrw t0, __setcontext@GOT
+ ldr.w t0, (t1, t0 << 0)
+#else
+ lrw t0, __setcontext
+#endif
+ jsr t0
+
+1:
+ /* Call _exit. */
+#ifdef __PIC__
+ grs t1, .Lgetpc3
+.Lgetpc3:
+ lrw t0, .Lgetpc3@GOTPC
+ addu t1, t1, t0
+ lrw t0, _exit@GOT
+ ldr.w t0, (t1, t0 << 0)
+#else
+ lrw t0, _exit
+#endif
+ jsr t0
+
+END (__startcontext)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S b/sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S
new file mode 100644
index 0000000..cc3c48d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/swapcontext.S
@@ -0,0 +1,78 @@
+/* Save and set current context. C-SKY ABIV2 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
+
+ENTRY (swapcontext)
+ /* Save params and lr. */
+ subi sp, 16
+ stw a0, (sp, 0)
+ stw a1, (sp, 4)
+ stw r15, (sp, 8)
+
+ /* Call getcontext. */
+#ifdef __PIC__
+ grs t1, .Lgetpc1
+.Lgetpc1:
+ lrw t0, .Lgetpc1@GOTPC
+ addu t1, t1, t0
+ lrw t0, __getcontext@GOT
+ ldr.w t0, (t1, t0 << 0)
+ jsr t0
+#else /* !__PIC__ */
+ jsri __getcontext
+#endif
+
+ mov a3, a0 /* Save return value. */
+
+ /* Restore params and lr. */
+ ldw a0, (sp, 0)
+ ldw a1, (sp, 4)
+ ldw r15, (sp, 8)
+ addi sp, 16
+
+ cmpnei a3, 0
+ bt error_exit
+
+ /* Fix up LR and the PC. */
+ stw sp, (a0, MCONTEXT_CSKY_SP)
+ stw r15, (a0, MCONTEXT_CSKY_LR)
+ stw r15, (a0, MCONTEXT_CSKY_PC)
+
+ /* Set setcontext's arg. */
+ mov a0, a1
+
+#ifdef __PIC__
+ grs t1, .Lgetpc2
+.Lgetpc2:
+ lrw a3, .Lgetpc2@GOTPC
+ addu t1, t1, a3
+ lrw a3, __setcontext@GOT
+ ldr.w a3, (t1, a3 << 0)
+#else /* __PIC__ */
+ lrw a3, __setcontext
+#endif /* __PIC__ */
+ jmp a3
+
+error_exit:
+ jmp r15
+END (swapcontext)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/syscall.S b/sysdeps/unix/sysv/linux/csky/abiv2/syscall.S
new file mode 100644
index 0000000..539f4e9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/syscall.S
@@ -0,0 +1,69 @@
+/* System call interface. C-SKY ABIV2 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+/* long syscall(long sysnum, long a, long b, long c, long d, long e, long f) */
+
+ENTRY (syscall)
+ subi sp, 8
+ stw r4, (sp, 0)
+ stw r5, (sp, 4)
+ mov t0, r7
+
+ /* Put system call number in r7, adjust shift for arguments
+ and load extra arguments from stack. */
+ mov r7, a0
+ mov a0, a1
+ mov a1, a2
+ mov a2, a3
+ ldw a3, (sp, 8)
+ ldw r4, (sp, 12)
+ ldw r5, (sp, 16)
+ trap 0
+
+ /* Restore temp registers. */
+ mov r7, t0
+ ldw r4, (sp, 0)
+ ldw r5, (sp, 4)
+ addi sp, 8
+
+ /* Check return value. */
+ lrw t0, 0xfffff000
+ cmphs a0, t0
+ bf 1f
+#ifdef __PIC__
+ subi sp, 8
+ stw gb, (sp, 0)
+ stw lr, (sp, 4)
+ grs gb, .Lgetpc
+.Lgetpc:
+ lrw t0, .Lgetpc@GOTPC
+ addu gb, gb, t0
+ lrw t0, __syscall_error@PLT
+ ldr.w t0, (gb, t0 << 0)
+ jsr t0
+ ldw gb, (sp, 0)
+ ldw lr, (sp, 4)
+ addi sp, 8
+#else
+ jmpi __syscall_error
+#endif /* __PIC__ */
+1:
+ rts
+PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S b/sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S
new file mode 100644
index 0000000..280c41a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/sysdep.S
@@ -0,0 +1,65 @@
+/* syscall error handlers. C-SKY ABIV2 version.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+/* The syscall stubs jump here when they detect an error.
+ The code for Linux is almost identical to the canonical Unix
+ code, except that the error number in R0 is negated. */
+
+#undef CALL_MCOUNT
+#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers R0. */
+
+ .text
+ENTRY (__syscall_error)
+ movi a1, 0
+ rsub a0, a0, a1
+
+#if !IS_IN (rtld)
+ mov a1, a0
+ mov a0, tls
+
+ grs t1, .Lgetpc1
+.Lgetpc1:
+ lrw t0, errno@gottpoff
+ add t1, t1, t0
+ ldw t1, (t1)
+ add t1, a0
+ stw a1, (t1)
+ bmaski a0, 0
+ rts
+#elif RTLD_PRIVATE_ERRNO /* !IS_IN (rtld) */
+# ifdef __PIC__
+ grs t1, .Lgetpc2
+.Lgetpc2:
+ lrw t0, .Lgetpc2@GOTPC
+ addu t1, t1, t0
+ lrw t0, rtld_errno@PLT
+ ldr.w t0, (t1, t0 << 0)
+# else
+ lrw t0, rtld_errno
+# endif /* __PIC__ */
+ stw a0, (t0)
+ bmaski a0, 0
+ rts
+#else
+# error "Unsupported non-TLS case"
+#endif /* RTLD_PRIVATE_ERRNO */
+
+#undef __syscall_error
+END (__syscall_error)
diff --git a/sysdeps/unix/sysv/linux/csky/pt-vfork.S b/sysdeps/unix/sysv/linux/csky/pt-vfork.S
new file mode 100644
index 0000000..1cc8931
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/pt-vfork.S
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/unix/sysv/linux/csky/syscalls.list b/sysdeps/unix/sysv/linux/csky/syscalls.list
new file mode 100644
index 0000000..2a8feb1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/csky/syscalls.list
@@ -0,0 +1,2 @@
+# File name Caller Syscall name Args Strong name Weak names
+cacheflush - cacheflush i:pii _flush_cache cacheflush
--
2.7.4