aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2014-03-21 20:20:53 +0000
committerJeff Johnston <jjohnstn@redhat.com>2014-03-21 20:20:53 +0000
commit7f4230bdc8cd47571764354da759866cc89b9037 (patch)
tree529e4ee9c162638f4992a05efce7a4e50837ad35
parent9246fbeced54764200564131ab1fad7e7819e91f (diff)
downloadnewlib-7f4230bdc8cd47571764354da759866cc89b9037.zip
newlib-7f4230bdc8cd47571764354da759866cc89b9037.tar.gz
newlib-7f4230bdc8cd47571764354da759866cc89b9037.tar.bz2
2014-03-21 Sabrini Ni <sabrinanitw@gmail.com>
* nds32/Makefile.in: Add syscall_error_handler.o. * nds32/syscall_error_handler.S: New. * nds32/syscall_extra.h: Reduce code size.
-rw-r--r--libgloss/ChangeLog6
-rw-r--r--libgloss/nds32/Makefile.in2
-rw-r--r--libgloss/nds32/syscall_error_handler.S48
-rw-r--r--libgloss/nds32/syscall_extra.h10
4 files changed, 57 insertions, 9 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog
index a6965cd..4cd4168 100644
--- a/libgloss/ChangeLog
+++ b/libgloss/ChangeLog
@@ -1,5 +1,11 @@
2014-03-21 Sabrini Ni <sabrinanitw@gmail.com>
+ * nds32/Makefile.in: Add syscall_error_handler.o.
+ * nds32/syscall_error_handler.S: New.
+ * nds32/syscall_extra.h: Reduce code size.
+
+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.
diff --git a/libgloss/nds32/Makefile.in b/libgloss/nds32/Makefile.in
index 6345957..976e9ad 100644
--- a/libgloss/nds32/Makefile.in
+++ b/libgloss/nds32/Makefile.in
@@ -72,7 +72,7 @@ SYSCALLS1 = syscall_exit.o syscall_open.o syscall_close.o syscall_read.o syscall
SYSCALLS2 = syscall_lseek.o syscall_unlink.o syscall_getpid.o syscall_kill.o syscall_fstat.o
SYSCALLS3 = syscall_argvlen.o syscall_argv.o syscall_chdir.o syscall_stat.o syscall_chmod.o
SYSCALLS4 = syscall_utime.o syscall_time.o syscall_gettimeofday.o syscall_times.o syscall_link.o
-SYSCALLS5 = syscall_rename.o syscall_isatty.o syscall_system.o syscall_sbrk.o
+SYSCALLS5 = syscall_rename.o syscall_isatty.o syscall_system.o syscall_sbrk.o syscall_error_handler.o
SYSCALLS = $(SYSCALLS1) $(SYSCALLS2) $(SYSCALLS3) $(SYSCALLS4) $(SYSCALLS5)
GENERIC_LIBOBJS =
diff --git a/libgloss/nds32/syscall_error_handler.S b/libgloss/nds32/syscall_error_handler.S
new file mode 100644
index 0000000..dbb5f68
--- /dev/null
+++ b/libgloss/nds32/syscall_error_handler.S
@@ -0,0 +1,48 @@
+/*
+Copyright (c) 2013 Andes Technology Corporation.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ The name of the company may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include "../syscall.h"
+#include "syscall_extra.h"
+
+
+ .extern errno
+ .text
+ .global __syscall_error_handler
+ .type __syscall_error_handler, @function
+ .hidden __syscall_error_handler
+ .align 2
+__syscall_error_handler:
+ 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 __syscall_error_handler, .-__syscall_error_handler
diff --git a/libgloss/nds32/syscall_extra.h b/libgloss/nds32/syscall_extra.h
index 73d36b9..7af4a45 100644
--- a/libgloss/nds32/syscall_extra.h
+++ b/libgloss/nds32/syscall_extra.h
@@ -51,14 +51,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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
+ j __syscall_error_handler
+ .size \name, .-\name
.endm
#endif /* _SYSCALL_EXTRA_H */