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:
authorJim Wilson <jimw@sifive.com>2017-12-26 23:26:19 +0300
committerJim Wilson <jimw@sifive.com>2017-12-26 23:26:19 +0300
commit347b08391132d61702f9004d7b74f742a49907f6 (patch)
tree651d9646075e6d670c868779eed0a19126e1ee39 /libgloss/riscv
parenta6633677b9152d02164a51ae9ba79cef9230e1d3 (diff)
RISC-V: Updated syscall to take 6 arguments
Diffstat (limited to 'libgloss/riscv')
-rw-r--r--libgloss/riscv/machine/syscall.h6
-rw-r--r--libgloss/riscv/syscalls.c42
2 files changed, 26 insertions, 22 deletions
diff --git a/libgloss/riscv/machine/syscall.h b/libgloss/riscv/machine/syscall.h
index 391dbaa71..cc7183273 100644
--- a/libgloss/riscv/machine/syscall.h
+++ b/libgloss/riscv/machine/syscall.h
@@ -57,12 +57,14 @@
extern long __syscall_error(long);
static inline long
-__internal_syscall(long n, long _a0, long _a1, long _a2, long _a3)
+__internal_syscall(long n, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
{
register long a0 asm("a0") = _a0;
register long a1 asm("a1") = _a1;
register long a2 asm("a2") = _a2;
register long a3 asm("a3") = _a3;
+ register long a4 asm("a4") = _a4;
+ register long a5 asm("a5") = _a5;
#ifdef __riscv_32e
register long syscall_id asm("t0") = n;
@@ -71,7 +73,7 @@ __internal_syscall(long n, long _a0, long _a1, long _a2, long _a3)
#endif
asm volatile ("scall"
- : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(syscall_id));
+ : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(syscall_id));
if (a0 < 0)
return __syscall_error (a0);
diff --git a/libgloss/riscv/syscalls.c b/libgloss/riscv/syscalls.c
index f9ec25dcd..19c69f083 100644
--- a/libgloss/riscv/syscalls.c
+++ b/libgloss/riscv/syscalls.c
@@ -69,8 +69,9 @@
#include <unistd.h>
#include <utime.h>
-#define syscall_errno(n, a, b, c, d) \
- __internal_syscall(n, (long)(a), (long)(b), (long)(c), (long)(d))
+#define syscall_errno(n, a, b, c, d, e, f) \
+ __internal_syscall(n, (long)(a), (long)(b), (long)(c), \
+ (long)(d), (long)(e), (long)(f))
long
__syscall_error(long a0)
@@ -83,35 +84,35 @@ __syscall_error(long a0)
int
_open(const char *name, int flags, int mode)
{
- return syscall_errno (SYS_open, name, flags, mode, 0);
+ return syscall_errno (SYS_open, name, flags, mode, 0, 0, 0);
}
/* Open file relative to given directory. */
int
_openat(int dirfd, const char *name, int flags, int mode)
{
- return syscall_errno (SYS_openat, dirfd, name, flags, mode);
+ return syscall_errno (SYS_openat, dirfd, name, flags, mode, 0, 0);
}
/* Set position in a file. */
off_t
_lseek(int file, off_t ptr, int dir)
{
- return syscall_errno (SYS_lseek, file, ptr, dir, 0);
+ return syscall_errno (SYS_lseek, file, ptr, dir, 0, 0, 0);
}
/* Read from a file. */
ssize_t
_read(int file, void *ptr, size_t len)
{
- return syscall_errno (SYS_read, file, ptr, len, 0);
+ return syscall_errno (SYS_read, file, ptr, len, 0, 0, 0);
}
/* Write to a file. */
ssize_t
_write(int file, const void *ptr, size_t len)
{
- return syscall_errno (SYS_write, file, ptr, len, 0);
+ return syscall_errno (SYS_write, file, ptr, len, 0, 0, 0);
}
struct kernel_stat
@@ -159,7 +160,7 @@ int
_fstat(int file, struct stat *st)
{
struct kernel_stat kst;
- int rv = syscall_errno (SYS_fstat, file, &kst, 0, 0);
+ int rv = syscall_errno (SYS_fstat, file, &kst, 0, 0, 0, 0);
conv_stat (st, &kst);
return rv;
}
@@ -169,7 +170,7 @@ int
_stat(const char *file, struct stat *st)
{
struct kernel_stat kst;
- int rv = syscall_errno (SYS_stat, file, &kst, 0, 0);
+ int rv = syscall_errno (SYS_stat, file, &kst, 0, 0, 0, 0);
conv_stat (st, &kst);
return rv;
}
@@ -179,7 +180,7 @@ int
_lstat(const char *file, struct stat *st)
{
struct kernel_stat kst;
- int rv = syscall_errno (SYS_lstat, file, &kst, 0, 0);
+ int rv = syscall_errno (SYS_lstat, file, &kst, 0, 0, 0, 0);
conv_stat (st, &kst);
return rv;
}
@@ -189,7 +190,7 @@ int
_fstatat(int dirfd, const char *file, struct stat *st, int flags)
{
struct kernel_stat kst;
- int rv = syscall_errno (SYS_fstatat, dirfd, file, &kst, flags);
+ int rv = syscall_errno (SYS_fstatat, dirfd, file, &kst, flags, 0, 0);
conv_stat (st, &kst);
return rv;
}
@@ -198,35 +199,35 @@ _fstatat(int dirfd, const char *file, struct stat *st, int flags)
int
_access(const char *file, int mode)
{
- return syscall_errno (SYS_access, file, mode, 0, 0);
+ return syscall_errno (SYS_access, file, mode, 0, 0, 0, 0);
}
/* Permissions of a file (by name) in a given directory. */
int
_faccessat(int dirfd, const char *file, int mode, int flags)
{
- return syscall_errno (SYS_faccessat, dirfd, file, mode, flags);
+ return syscall_errno (SYS_faccessat, dirfd, file, mode, flags, 0, 0);
}
/* Close a file. */
int
_close(int file)
{
- return syscall_errno (SYS_close, file, 0, 0, 0);
+ return syscall_errno (SYS_close, file, 0, 0, 0, 0, 0);
}
/* Establish a new name for an existing file. */
int
_link(const char *old_name, const char *new_name)
{
- return syscall_errno (SYS_link, old_name, new_name, 0, 0);
+ return syscall_errno (SYS_link, old_name, new_name, 0, 0, 0, 0);
}
/* Remove a file's directory entry. */
int
_unlink(const char *name)
{
- return syscall_errno (SYS_unlink, name, 0, 0, 0);
+ return syscall_errno (SYS_unlink, name, 0, 0, 0, 0, 0);
}
/* Transfer control to a new process. Minimal implementation for a
@@ -295,7 +296,7 @@ _isatty(int file)
int
_gettimeofday(struct timeval *tp, void *tz)
{
- return syscall_errno (SYS_gettimeofday, tp, 0, 0, 0);
+ return syscall_errno (SYS_gettimeofday, tp, 0, 0, 0, 0, 0);
}
/* Timing information for current process. From
@@ -396,13 +397,14 @@ _sbrk(ptrdiff_t incr)
if (heap_end == 0)
{
- long brk = syscall_errno (SYS_brk, 0, 0, 0, 0);
+ long brk = syscall_errno (SYS_brk, 0, 0, 0, 0, 0, 0);
if (brk == -1)
return (void *)-1;
heap_end = brk;
}
- if (syscall_errno (SYS_brk, heap_end + incr, 0, 0, 0) != heap_end + incr)
+ if (syscall_errno (SYS_brk, heap_end + incr, 0, 0, 0, 0, 0)
+ != heap_end + incr)
return (void *)-1;
heap_end += incr;
@@ -414,6 +416,6 @@ _sbrk(ptrdiff_t incr)
void
_exit(int exit_status)
{
- syscall_errno (SYS_exit, exit_status, 0, 0, 0);
+ syscall_errno (SYS_exit, exit_status, 0, 0, 0, 0, 0);
while (1);
}