aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog5
-rwxr-xr-xsim/common/gennltvals.py1
-rw-r--r--sim/common/nltvals.def31
-rw-r--r--sim/rx/ChangeLog8
-rw-r--r--sim/rx/Makefile.in5
-rw-r--r--sim/rx/syscall.h50
-rw-r--r--sim/rx/syscalls.c21
7 files changed, 59 insertions, 62 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 8806233..f0827b2 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,10 @@
2021-04-18 Mike Frysinger <vapier@gentoo.org>
+ * gennltvals.py (TARGETS): Add rx.
+ * nltvals.def: Regenerate.
+
+2021-04-18 Mike Frysinger <vapier@gentoo.org>
+
* gennltvals.py (TARGETS): Add m32c.
* nltvals.def: Regenerate.
diff --git a/sim/common/gennltvals.py b/sim/common/gennltvals.py
index 168ce4b..bf0aaa4 100755
--- a/sim/common/gennltvals.py
+++ b/sim/common/gennltvals.py
@@ -70,6 +70,7 @@ TARGETS = {
'msp430',
'pru',
'riscv',
+ 'rx',
'sparc',
'v850',
}
diff --git a/sim/common/nltvals.def b/sim/common/nltvals.def
index fb3144a..fbaee3a 100644
--- a/sim/common/nltvals.def
+++ b/sim/common/nltvals.def
@@ -657,6 +657,37 @@
/* end riscv sys target macros */
#endif
#endif
+#ifdef NL_TARGET_rx
+#ifdef sys_defs
+/* from syscall.h */
+/* begin rx sys target macros */
+ { "SYS_argc", 22 },
+ { "SYS_argn", 24 },
+ { "SYS_argnlen", 23 },
+ { "SYS_argv", 13 },
+ { "SYS_argvlen", 12 },
+ { "SYS_chdir", 14 },
+ { "SYS_chmod", 16 },
+ { "SYS_close", 3 },
+ { "SYS_exit", 1 },
+ { "SYS_fstat", 10 },
+ { "SYS_getpid", 8 },
+ { "SYS_gettimeofday", 19 },
+ { "SYS_kill", 9 },
+ { "SYS_link", 21 },
+ { "SYS_lseek", 6 },
+ { "SYS_open", 2 },
+ { "SYS_read", 4 },
+ { "SYS_reconfig", 25 },
+ { "SYS_stat", 15 },
+ { "SYS_time", 18 },
+ { "SYS_times", 20 },
+ { "SYS_unlink", 7 },
+ { "SYS_utime", 17 },
+ { "SYS_write", 5 },
+/* end rx sys target macros */
+#endif
+#endif
#ifdef NL_TARGET_sparc
#ifdef sys_defs
/* from syscall.h */
diff --git a/sim/rx/ChangeLog b/sim/rx/ChangeLog
index 618b0c0..6660671 100644
--- a/sim/rx/ChangeLog
+++ b/sim/rx/ChangeLog
@@ -1,5 +1,13 @@
2021-04-18 Mike Frysinger <vapier@gentoo.org>
+ * Makefile.in (NL_TARGET): Define.
+ (syscalls.o): Delete syscall.h.
+ * syscalls.c: Change syscall.h include to targ-vals.h.
+ (rx_syscall): Add TARGET_ prefix to all SYS_ constants.
+ * syscall.h: Removed.
+
+2021-04-18 Mike Frysinger <vapier@gentoo.org>
+
* configure: Regenerate.
2021-04-09 Luis Machado <luis.machado@linaro.org>
diff --git a/sim/rx/Makefile.in b/sim/rx/Makefile.in
index 4de0621..3c6094c 100644
--- a/sim/rx/Makefile.in
+++ b/sim/rx/Makefile.in
@@ -18,6 +18,9 @@
### You should have received a copy of the GNU General Public License
### along with the GNU simulators; if not, see <http://www.gnu.org/licenses/>.
+# This selects the newlib/libgloss syscall definitions.
+NL_TARGET = -DNL_TARGET_rx
+
## COMMON_PRE_CONFIG_FRAG
SIM_EXTRA_CFLAGS = -Wall
@@ -58,5 +61,5 @@ mem.o : mem.h cpu.h syscalls.h misc.h err.h
misc.o : cpu.h misc.h
reg.o : cpu.h trace.h
rx.o : $(srcdir)/../../include/opcode/rx.h cpu.h mem.h syscalls.h fpu.h
-syscalls.o : $(srcdir)/../../include/gdb/callback.h cpu.h mem.h syscalls.h syscall.h
+syscalls.o : $(srcdir)/../../include/gdb/callback.h cpu.h mem.h syscalls.h
trace.o : ../../bfd/bfd.h $(srcdir)/../../include/dis-asm.h cpu.h mem.h load.h
diff --git a/sim/rx/syscall.h b/sim/rx/syscall.h
deleted file mode 100644
index 0194e03..0000000
--- a/sim/rx/syscall.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copied from libgloss */
-/* General use syscall.h file.
- The more ports that use this file, the simpler sim/common/nltvals.def
- remains. */
-
-#ifndef LIBGLOSS_SYSCALL_H
-#define LIBGLOSS_SYSCALL_H
-
-/* Note: This file may be included by assembler source. */
-
-/* These should be as small as possible to allow a port to use a trap type
- instruction, which the system call # as the trap (the d10v for instance
- supports traps 0..31). An alternative would be to define one trap for doing
- system calls, and put the system call number in a register that is not used
- for the normal calling sequence (so that you don't have to shift down the
- arguments to add the system call number). Obviously, if these system call
- numbers are ever changed, all of the simulators and potentially user code
- will need to be updated. */
-
-/* There is no current need for the following: SYS_execv, SYS_creat, SYS_wait,
- etc. etc. Don't add them. */
-
-/* These are required by the ANSI C part of newlib (excluding system() of
- course). */
-#define SYS_exit 1
-#define SYS_open 2
-#define SYS_close 3
-#define SYS_read 4
-#define SYS_write 5
-#define SYS_lseek 6
-#define SYS_unlink 7
-#define SYS_getpid 8
-#define SYS_kill 9
-#define SYS_fstat 10
-/*#define SYS_sbrk 11 - not currently a system call, but reserved. */
-
-/* ARGV support. */
-#define SYS_argvlen 12
-#define SYS_argv 13
-
-/* These are extras added for one reason or another. */
-#define SYS_chdir 14
-#define SYS_stat 15
-#define SYS_chmod 16
-#define SYS_utime 17
-#define SYS_time 18
-#define SYS_gettimeofday 19
-#define SYS_times 20
-#define SYS_link 21
-#endif
diff --git a/sim/rx/syscalls.c b/sim/rx/syscalls.c
index 22778b3..0c75c7d 100644
--- a/sim/rx/syscalls.c
+++ b/sim/rx/syscalls.c
@@ -31,8 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "cpu.h"
#include "mem.h"
#include "syscalls.h"
-
-#include "syscall.h"
+#include "targ-vals.h"
/* The current syscall callbacks we're using. */
static struct host_callback_struct *callbacks;
@@ -146,10 +145,10 @@ rx_syscall (int id)
argp = 0;
stackp = 4;
if (trace)
- printf ("\033[31m/* SYSCALL(%d) = %s */\033[0m\n", id, id <= SYS_link ? callnames[id] : "unknown");
+ printf ("\033[31m/* SYSCALL(%d) = %s */\033[0m\n", id, id <= TARGET_SYS_link ? callnames[id] : "unknown");
switch (id)
{
- case SYS_exit:
+ case TARGET_SYS_exit:
{
int ec = arg ();
if (verbose)
@@ -158,7 +157,7 @@ rx_syscall (int id)
}
break;
- case SYS_open:
+ case TARGET_SYS_open:
{
int oflags, cflags;
int path = arg ();
@@ -200,7 +199,7 @@ rx_syscall (int id)
}
break;
- case SYS_close:
+ case TARGET_SYS_close:
{
int fd = arg ();
@@ -216,7 +215,7 @@ rx_syscall (int id)
}
break;
- case SYS_read:
+ case TARGET_SYS_read:
{
int fd = arg ();
int addr = arg ();
@@ -236,7 +235,7 @@ rx_syscall (int id)
}
break;
- case SYS_write:
+ case TARGET_SYS_write:
{
int fd = arg ();
int addr = arg ();
@@ -259,11 +258,11 @@ rx_syscall (int id)
}
break;
- case SYS_getpid:
+ case TARGET_SYS_getpid:
put_reg (1, 42);
break;
- case SYS_gettimeofday:
+ case TARGET_SYS_gettimeofday:
{
int tvaddr = arg ();
struct timeval tv;
@@ -278,7 +277,7 @@ rx_syscall (int id)
}
break;
- case SYS_kill:
+ case TARGET_SYS_kill:
{
int pid = arg ();
int sig = arg ();