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.
This commit is contained in:
Jeff Johnston 2014-03-21 20:16:14 +00:00
parent 5805cb1f8c
commit 9246fbeced
24 changed files with 71 additions and 421 deletions

View File

@ -1,3 +1,29 @@
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.
2014-02-27 Joey Ye <joey.ye@arm.com>
* libnosys/sbrk.c (_sbrk): Remove TWS

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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