Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2014-03-22 00:16:14 +0400
committerJeff Johnston <jjohnstn@redhat.com>2014-03-22 00:16:14 +0400
commit9246fbeced54764200564131ab1fad7e7819e91f (patch)
treea68687ead3b627c5efbf79c0a2da5155b433ec84 /libgloss/nds32
parent5805cb1f8c1644bb888b03538af2aec30ca27da0 (diff)
2014-03-21 Sabrini Ni <sabrinanitw@gmail.com>
* nds32/syscall_extra.h: Define macro. * nds32/syscall_argv.S: Use define macro. * nds32/syscall_argvlen.S: Ditto. * nds32/syscall_chdir.S: Ditto. * nds32/syscall_chmod.S: Ditto. * nds32/syscall_close.S: Ditto. * nds32/syscall_fstat.S: Ditto. * nds32/syscall_getpid.S: Ditto. * nds32/syscall_gettimeofday.S: Ditto. * nds32/syscall_isatty.S: Ditto. * nds32/syscall_kill.S: Ditto. * nds32/syscall_link.S: Ditto. * nds32/syscall_lseek.S: Ditto. * nds32/syscall_open.S: Ditto. * nds32/syscall_read.S: Ditto. * nds32/syscall_rename.S: Ditto. * nds32/syscall_stat.S: Ditto. * nds32/syscall_system.S: Ditto. * nds32/syscall_time.S: Ditto. * nds32/syscall_times.S: Ditto. * nds32/syscall_unlink.S: Ditto. * nds32/syscall_utime.S: Ditto. * nds32/syscall_write.S: Ditto.
Diffstat (limited to 'libgloss/nds32')
-rw-r--r--libgloss/nds32/syscall_argv.S20
-rw-r--r--libgloss/nds32/syscall_argvlen.S20
-rw-r--r--libgloss/nds32/syscall_chdir.S20
-rw-r--r--libgloss/nds32/syscall_chmod.S20
-rw-r--r--libgloss/nds32/syscall_close.S20
-rw-r--r--libgloss/nds32/syscall_extra.h23
-rw-r--r--libgloss/nds32/syscall_fstat.S20
-rw-r--r--libgloss/nds32/syscall_getpid.S20
-rw-r--r--libgloss/nds32/syscall_gettimeofday.S20
-rw-r--r--libgloss/nds32/syscall_isatty.S20
-rw-r--r--libgloss/nds32/syscall_kill.S20
-rw-r--r--libgloss/nds32/syscall_link.S20
-rw-r--r--libgloss/nds32/syscall_lseek.S20
-rw-r--r--libgloss/nds32/syscall_open.S20
-rw-r--r--libgloss/nds32/syscall_read.S23
-rw-r--r--libgloss/nds32/syscall_rename.S20
-rw-r--r--libgloss/nds32/syscall_stat.S20
-rw-r--r--libgloss/nds32/syscall_system.S20
-rw-r--r--libgloss/nds32/syscall_time.S20
-rw-r--r--libgloss/nds32/syscall_times.S20
-rw-r--r--libgloss/nds32/syscall_unlink.S20
-rw-r--r--libgloss/nds32/syscall_utime.S20
-rw-r--r--libgloss/nds32/syscall_write.S20
23 files changed, 45 insertions, 421 deletions
diff --git a/libgloss/nds32/syscall_argv.S b/libgloss/nds32/syscall_argv.S
index f11247856..77278934a 100644
--- a/libgloss/nds32/syscall_argv.S
+++ b/libgloss/nds32/syscall_argv.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _argv
- .type _argv, @function
- .align 2
-_argv:
- /* Make syscall 'SYS_argv'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_argv
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _argv, .-_argv
+SYS_WRAPPER _argv, SYS_argv
diff --git a/libgloss/nds32/syscall_argvlen.S b/libgloss/nds32/syscall_argvlen.S
index dd2ca1912..c74d087de 100644
--- a/libgloss/nds32/syscall_argvlen.S
+++ b/libgloss/nds32/syscall_argvlen.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _argvlen
- .type _argvlen, @function
- .align 2
-_argvlen:
- /* Make syscall 'SYS_argvlen'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_argvlen
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _argvlen, .-_argvlen
+SYS_WRAPPER _argvlen, SYS_argvlen
diff --git a/libgloss/nds32/syscall_chdir.S b/libgloss/nds32/syscall_chdir.S
index 5309e2b9b..080e3dcef 100644
--- a/libgloss/nds32/syscall_chdir.S
+++ b/libgloss/nds32/syscall_chdir.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _chdir
- .type _chdir, @function
- .align 2
-_chdir:
- /* Make syscall 'SYS_chdir'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_chdir
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _chdir, .-_chdir
+SYS_WRAPPER _chdir, SYS_chdir
diff --git a/libgloss/nds32/syscall_chmod.S b/libgloss/nds32/syscall_chmod.S
index afd549b5a..5827ee144 100644
--- a/libgloss/nds32/syscall_chmod.S
+++ b/libgloss/nds32/syscall_chmod.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _chmod
- .type _chmod, @function
- .align 2
-_chmod:
- /* Make syscall 'SYS_chmod'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_chmod
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _chmod, .-_chmod
+SYS_WRAPPER _chmod, SYS_chmod
diff --git a/libgloss/nds32/syscall_close.S b/libgloss/nds32/syscall_close.S
index c1a7efa5a..82733a93e 100644
--- a/libgloss/nds32/syscall_close.S
+++ b/libgloss/nds32/syscall_close.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _close
- .type _close, @function
- .align 2
-_close:
- /* Make syscall 'SYS_close'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_close
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _close, .-_close
+SYS_WRAPPER _close, SYS_close
diff --git a/libgloss/nds32/syscall_extra.h b/libgloss/nds32/syscall_extra.h
index f2ab2d562..73d36b973 100644
--- a/libgloss/nds32/syscall_extra.h
+++ b/libgloss/nds32/syscall_extra.h
@@ -38,4 +38,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SYS_geterr 6001
+
+/* Define macros that generate assembly output. */
+.macro SYS_WRAPPER name num
+ .text
+ .global \name
+ .type \name, @function
+ .align 2
+\name:
+ /* Make syscall with arg=`\num'.
+ Reture value `-1' stored in $r0 means there is something wrong.
+ If there is something wrong, make syscall to get `SYS_geterr' to get
+ error code to see what exactly happens and store it in errno . */
+ syscall \num /* Make syscall with arg=`\num'. */
+ addi $r1, $r0, 1
+ bnez $r1, 1f /* Branch if success. */
+ syscall SYS_geterr /* There is something wrong. */
+ s.w $r0, errno /* Store error code into errno. */
+ move $r0, -1
+1:
+ ret
+ .size \name, .-\name
+.endm
+
#endif /* _SYSCALL_EXTRA_H */
diff --git a/libgloss/nds32/syscall_fstat.S b/libgloss/nds32/syscall_fstat.S
index a3ab279a6..855c982b8 100644
--- a/libgloss/nds32/syscall_fstat.S
+++ b/libgloss/nds32/syscall_fstat.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _fstat
- .type _fstat, @function
- .align 2
-_fstat:
- /* Make syscall 'SYS_fstat'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_fstat
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _fstat, .-_fstat
+SYS_WRAPPER _fstat, SYS_fstat
diff --git a/libgloss/nds32/syscall_getpid.S b/libgloss/nds32/syscall_getpid.S
index f1f25d80b..4bf9ba48f 100644
--- a/libgloss/nds32/syscall_getpid.S
+++ b/libgloss/nds32/syscall_getpid.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _getpid
- .type _getpid, @function
- .align 2
-_getpid:
- /* Make syscall 'SYS_getpid'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_getpid
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _getpid, .-_getpid
+SYS_WRAPPER _getpid, SYS_getpid
diff --git a/libgloss/nds32/syscall_gettimeofday.S b/libgloss/nds32/syscall_gettimeofday.S
index bd995a8f6..433d2b45d 100644
--- a/libgloss/nds32/syscall_gettimeofday.S
+++ b/libgloss/nds32/syscall_gettimeofday.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _gettimeofday
- .type _gettimeofday, @function
- .align 2
-_gettimeofday:
- /* Make syscall 'SYS_gettimeofday'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_gettimeofday
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _gettimeofday, .-_gettimeofday
+SYS_WRAPPER _gettimeofday, SYS_gettimeofday
diff --git a/libgloss/nds32/syscall_isatty.S b/libgloss/nds32/syscall_isatty.S
index e8f538d95..2dd7931ae 100644
--- a/libgloss/nds32/syscall_isatty.S
+++ b/libgloss/nds32/syscall_isatty.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _isatty
- .type _isatty, @function
- .align 2
-_isatty:
- /* Make syscall 'SYS_isatty'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_isatty
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _isatty, .-_isatty
+SYS_WRAPPER _isatty, SYS_isatty
diff --git a/libgloss/nds32/syscall_kill.S b/libgloss/nds32/syscall_kill.S
index e04c5b9c4..196bcef79 100644
--- a/libgloss/nds32/syscall_kill.S
+++ b/libgloss/nds32/syscall_kill.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _kill
- .type _kill, @function
- .align 2
-_kill:
- /* Make syscall 'SYS_kill'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_kill
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _kill, .-_kill
+SYS_WRAPPER _kill, SYS_kill
diff --git a/libgloss/nds32/syscall_link.S b/libgloss/nds32/syscall_link.S
index 044b632a0..bd4e23c5e 100644
--- a/libgloss/nds32/syscall_link.S
+++ b/libgloss/nds32/syscall_link.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _link
- .type _link, @function
- .align 2
-_link:
- /* Make syscall 'SYS_link'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_link
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _link, .-_link
+SYS_WRAPPER _link, SYS_link
diff --git a/libgloss/nds32/syscall_lseek.S b/libgloss/nds32/syscall_lseek.S
index 3515a4787..269f531c7 100644
--- a/libgloss/nds32/syscall_lseek.S
+++ b/libgloss/nds32/syscall_lseek.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _lseek
- .type _lseek, @function
- .align 2
-_lseek:
- /* Make syscall 'SYS_lseek'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_lseek
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _lseek, .-_lseek
+SYS_WRAPPER _lseek, SYS_lseek
diff --git a/libgloss/nds32/syscall_open.S b/libgloss/nds32/syscall_open.S
index d160b07d3..d9ba24858 100644
--- a/libgloss/nds32/syscall_open.S
+++ b/libgloss/nds32/syscall_open.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _open
- .type _open, @function
- .align 2
-_open:
- /* Make syscall 'SYS_open'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_open
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _open, .-_open
+SYS_WRAPPER _open, SYS_open
diff --git a/libgloss/nds32/syscall_read.S b/libgloss/nds32/syscall_read.S
index 5c485c547..6668d214f 100644
--- a/libgloss/nds32/syscall_read.S
+++ b/libgloss/nds32/syscall_read.S
@@ -32,25 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _read
- .type _read, @function
- .align 2
-_read:
- /* Make syscall 'SYS_read'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_read
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- /* Return value '11' stored in $r0 means we need to try again. */
- addi $r1, $r0, -11
- beqz $r1, _read
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _read, .-_read
+SYS_WRAPPER _read, SYS_read
diff --git a/libgloss/nds32/syscall_rename.S b/libgloss/nds32/syscall_rename.S
index 6b07cdad1..bf394bf55 100644
--- a/libgloss/nds32/syscall_rename.S
+++ b/libgloss/nds32/syscall_rename.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _rename
- .type _rename, @function
- .align 2
-_rename:
- /* Make syscall 'SYS_rename'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_rename
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _rename, .-_rename
+SYS_WRAPPER _rename, SYS_rename
diff --git a/libgloss/nds32/syscall_stat.S b/libgloss/nds32/syscall_stat.S
index b7679b4a6..06b35ecd0 100644
--- a/libgloss/nds32/syscall_stat.S
+++ b/libgloss/nds32/syscall_stat.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _stat
- .type _stat, @function
- .align 2
-_stat:
- /* Make syscall 'SYS_stat'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_stat
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _stat, .-_stat
+SYS_WRAPPER _stat, SYS_stat
diff --git a/libgloss/nds32/syscall_system.S b/libgloss/nds32/syscall_system.S
index ce4388a7a..648235e03 100644
--- a/libgloss/nds32/syscall_system.S
+++ b/libgloss/nds32/syscall_system.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _system
- .type _system, @function
- .align 2
-_system:
- /* Make syscall 'SYS_system'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_system
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _system, .-_system
+SYS_WRAPPER _system, SYS_system
diff --git a/libgloss/nds32/syscall_time.S b/libgloss/nds32/syscall_time.S
index 3fee97d63..9af57ac82 100644
--- a/libgloss/nds32/syscall_time.S
+++ b/libgloss/nds32/syscall_time.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _time
- .type _time, @function
- .align 2
-_time:
- /* Make syscall 'SYS_time'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_time
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _time, .-_time
+SYS_WRAPPER _time, SYS_time
diff --git a/libgloss/nds32/syscall_times.S b/libgloss/nds32/syscall_times.S
index 7e4a260d0..51c48afaa 100644
--- a/libgloss/nds32/syscall_times.S
+++ b/libgloss/nds32/syscall_times.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _times
- .type _times, @function
- .align 2
-_times:
- /* Make syscall 'SYS_times'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_times
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _times, .-_times
+SYS_WRAPPER _times, SYS_times
diff --git a/libgloss/nds32/syscall_unlink.S b/libgloss/nds32/syscall_unlink.S
index 17607062d..aa98efba4 100644
--- a/libgloss/nds32/syscall_unlink.S
+++ b/libgloss/nds32/syscall_unlink.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _unlink
- .type _unlink, @function
- .align 2
-_unlink:
- /* Make syscall 'SYS_unlink'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_unlink
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _unlink, .-_unlink
+SYS_WRAPPER _unlink, SYS_unlink
diff --git a/libgloss/nds32/syscall_utime.S b/libgloss/nds32/syscall_utime.S
index 7090d359e..b53a21f4d 100644
--- a/libgloss/nds32/syscall_utime.S
+++ b/libgloss/nds32/syscall_utime.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _utime
- .type _utime, @function
- .align 2
-_utime:
- /* Make syscall 'SYS_utime'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_utime
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _utime, .-_utime
+SYS_WRAPPER _utime, SYS_utime
diff --git a/libgloss/nds32/syscall_write.S b/libgloss/nds32/syscall_write.S
index 0b10f7e5f..d5f542b2a 100644
--- a/libgloss/nds32/syscall_write.S
+++ b/libgloss/nds32/syscall_write.S
@@ -32,22 +32,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.extern errno
-
- .section .text
- .global _write
- .type _write, @function
- .align 2
-_write:
- /* Make syscall 'SYS_write'.
- Reture value '-1' stored in $r0 means there is something wrong.
- If there is something wrong, make syscall 'SYS_geterr' to get
- error code to see what exactly happens and store it in errno . */
- syscall SYS_write
- addi $r1, $r0, 1
- bnez $r1, .Ldone
- syscall SYS_geterr
- s.w $r0, errno
- movi $r0, -1
-.Ldone:
- ret
- .size _write, .-_write
+SYS_WRAPPER _write, SYS_write