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.
This commit is contained in:
parent
9246fbeced
commit
7f4230bdc8
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
|
|
@ -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 =
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue