aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-11-28 00:18:18 -0500
committerMike Frysinger <vapier@gentoo.org>2021-11-28 13:23:58 -0500
commite38330f8b00e641e397260e9cecb2070ac2d1477 (patch)
treec90b41f37cd4f9fd1139c8336ac0042d84d862da /sim
parent64ae70dde5bc8916800bbdb570d6281b700f7e84 (diff)
downloadfsf-binutils-gdb-e38330f8b00e641e397260e9cecb2070ac2d1477.zip
fsf-binutils-gdb-e38330f8b00e641e397260e9cecb2070ac2d1477.tar.gz
fsf-binutils-gdb-e38330f8b00e641e397260e9cecb2070ac2d1477.tar.bz2
sim: iq2000/lm32/m32c/moxie/rx: switch to new target-newlib-syscall.h
Use the new target-newlib-syscall.h to provide the target syscall defines. These code paths are written specifically for the newlib ABI rather than being generalized, so switching them to the defines rather than trying to go through the dynamic callback conversion seems like the best trade-off for now. Might have to reconsider this in the future.
Diffstat (limited to 'sim')
-rw-r--r--sim/iq2000/iq2000.c16
-rw-r--r--sim/lm32/traps.c4
-rw-r--r--sim/m32c/syscalls.c18
-rw-r--r--sim/moxie/interp.c12
-rw-r--r--sim/rx/syscalls.c20
5 files changed, 35 insertions, 35 deletions
diff --git a/sim/iq2000/iq2000.c b/sim/iq2000/iq2000.c
index 362cc4a..88de5ac 100644
--- a/sim/iq2000/iq2000.c
+++ b/sim/iq2000/iq2000.c
@@ -27,7 +27,7 @@
#include "sim-signal.h"
#include "cgen-mem.h"
#include "cgen-ops.h"
-#include "targ-vals.h"
+#include "target-newlib-syscall.h"
#include <stdlib.h>
enum
@@ -80,7 +80,7 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
exit (1);
}
- case TARGET_SYS_write:
+ case TARGET_NEWLIB_SYS_write:
buf = zalloc (PARM3);
sim_read (CPU_STATE (current_cpu), CPU2DATA(PARM2), buf, PARM3);
SET_H_GR (ret_reg,
@@ -89,18 +89,18 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
free (buf);
break;
- case TARGET_SYS_lseek:
+ case TARGET_NEWLIB_SYS_lseek:
SET_H_GR (ret_reg,
sim_io_lseek (CPU_STATE (current_cpu),
PARM1, PARM2, PARM3));
break;
- case TARGET_SYS_exit:
+ case TARGET_NEWLIB_SYS_exit:
sim_engine_halt (CPU_STATE (current_cpu), current_cpu,
NULL, pc, sim_exited, PARM1);
break;
- case TARGET_SYS_read:
+ case TARGET_NEWLIB_SYS_read:
buf = zalloc (PARM3);
SET_H_GR (ret_reg,
sim_io_read (CPU_STATE (current_cpu),
@@ -109,7 +109,7 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
free (buf);
break;
- case TARGET_SYS_open:
+ case TARGET_NEWLIB_SYS_open:
buf = fetch_str (current_cpu, pc, PARM1);
SET_H_GR (ret_reg,
sim_io_open (CPU_STATE (current_cpu),
@@ -117,12 +117,12 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
free (buf);
break;
- case TARGET_SYS_close:
+ case TARGET_NEWLIB_SYS_close:
SET_H_GR (ret_reg,
sim_io_close (CPU_STATE (current_cpu), PARM1));
break;
- case TARGET_SYS_time:
+ case TARGET_NEWLIB_SYS_time:
SET_H_GR (ret_reg, time (0));
break;
diff --git a/sim/lm32/traps.c b/sim/lm32/traps.c
index 77b4acc..87d2191 100644
--- a/sim/lm32/traps.c
+++ b/sim/lm32/traps.c
@@ -28,7 +28,7 @@
#include "sim-signal.h"
#include "sim-syscall.h"
#include "lm32-sim.h"
-#include "targ-vals.h"
+#include "target-newlib-syscall.h"
/* Handle invalid instructions. */
@@ -133,7 +133,7 @@ lm32bf_scall_insn (SIM_CPU * current_cpu, IADDR pc)
host_callback *cb = STATE_CALLBACK (sd);
if ((STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
- || (GET_H_GR (8) == TARGET_SYS_exit))
+ || (GET_H_GR (8) == TARGET_NEWLIB_SYS_exit))
{
/* Delegate system call to host O/S. */
long result, result2;
diff --git a/sim/m32c/syscalls.c b/sim/m32c/syscalls.c
index e8d9d2e..e613e51 100644
--- a/sim/m32c/syscalls.c
+++ b/sim/m32c/syscalls.c
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "cpu.h"
#include "mem.h"
#include "syscalls.h"
-#include "targ-vals.h"
+#include "target-newlib-syscall.h"
/* The current syscall callbacks we're using. */
static struct host_callback_struct *callbacks;
@@ -185,7 +185,7 @@ m32c_syscall (int id)
printf ("\033[31m/* SYSCALL(%d) = %s */\033[0m\n", id, callnames[id]);
switch (id)
{
- case TARGET_SYS_exit:
+ case TARGET_NEWLIB_SYS_exit:
{
int ec = arg (2);
if (verbose)
@@ -194,7 +194,7 @@ m32c_syscall (int id)
}
break;
- case TARGET_SYS_open:
+ case TARGET_NEWLIB_SYS_open:
{
int path = arg (PTRSZ);
int oflags = arg (2);
@@ -229,7 +229,7 @@ m32c_syscall (int id)
}
break;
- case TARGET_SYS_close:
+ case TARGET_NEWLIB_SYS_close:
{
int fd = arg (2);
@@ -245,7 +245,7 @@ m32c_syscall (int id)
}
break;
- case TARGET_SYS_read:
+ case TARGET_NEWLIB_SYS_read:
{
int fd = arg (2);
int addr = arg (PTRSZ);
@@ -265,7 +265,7 @@ m32c_syscall (int id)
}
break;
- case TARGET_SYS_write:
+ case TARGET_NEWLIB_SYS_write:
{
int fd = arg (2);
int addr = arg (PTRSZ);
@@ -288,11 +288,11 @@ m32c_syscall (int id)
}
break;
- case TARGET_SYS_getpid:
+ case TARGET_NEWLIB_SYS_getpid:
put_reg (r0, 42);
break;
- case TARGET_SYS_gettimeofday:
+ case TARGET_NEWLIB_SYS_gettimeofday:
{
int tvaddr = arg (PTRSZ);
struct timeval tv;
@@ -307,7 +307,7 @@ m32c_syscall (int id)
}
break;
- case TARGET_SYS_kill:
+ case TARGET_NEWLIB_SYS_kill:
{
int pid = arg (2);
int sig = arg (2);
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index 3aa6a3b..228e23c 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-options.h"
#include "sim-io.h"
#include "sim-signal.h"
-#include "targ-vals.h"
+#include "target-newlib-syscall.h"
typedef int word;
typedef unsigned int uword;
@@ -935,13 +935,13 @@ sim_engine_run (SIM_DESC sd,
cpu.asregs.sregs[3] = inum;
switch (inum)
{
- case TARGET_SYS_exit:
+ case TARGET_NEWLIB_SYS_exit:
{
sim_engine_halt (sd, scpu, NULL, pc, sim_exited,
cpu.asregs.regs[2]);
break;
}
- case TARGET_SYS_open:
+ case TARGET_NEWLIB_SYS_open:
{
char fname[1024];
int mode = (int) convert_target_flags ((unsigned) cpu.asregs.regs[3]);
@@ -954,7 +954,7 @@ sim_engine_run (SIM_DESC sd,
cpu.asregs.regs[2] = fd;
break;
}
- case TARGET_SYS_read:
+ case TARGET_NEWLIB_SYS_read:
{
int fd = cpu.asregs.regs[2];
unsigned len = (unsigned) cpu.asregs.regs[4];
@@ -965,7 +965,7 @@ sim_engine_run (SIM_DESC sd,
free (buf);
break;
}
- case TARGET_SYS_write:
+ case TARGET_NEWLIB_SYS_write:
{
char *str;
/* String length is at 0x12($fp) */
@@ -978,7 +978,7 @@ sim_engine_run (SIM_DESC sd,
cpu.asregs.regs[2] = count;
break;
}
- case TARGET_SYS_unlink:
+ case TARGET_NEWLIB_SYS_unlink:
{
char fname[1024];
int fd;
diff --git a/sim/rx/syscalls.c b/sim/rx/syscalls.c
index 1981b5d..a18c104 100644
--- a/sim/rx/syscalls.c
+++ b/sim/rx/syscalls.c
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "cpu.h"
#include "mem.h"
#include "syscalls.h"
-#include "targ-vals.h"
+#include "target-newlib-syscall.h"
/* The current syscall callbacks we're using. */
static struct host_callback_struct *callbacks;
@@ -146,10 +146,10 @@ rx_syscall (int id)
argp = 0;
stackp = 4;
if (trace)
- printf ("\033[31m/* SYSCALL(%d) = %s */\033[0m\n", id, id <= TARGET_SYS_link ? callnames[id] : "unknown");
+ printf ("\033[31m/* SYSCALL(%d) = %s */\033[0m\n", id, id <= TARGET_NEWLIB_SYS_link ? callnames[id] : "unknown");
switch (id)
{
- case TARGET_SYS_exit:
+ case TARGET_NEWLIB_SYS_exit:
{
int ec = arg ();
if (verbose)
@@ -158,7 +158,7 @@ rx_syscall (int id)
}
break;
- case TARGET_SYS_open:
+ case TARGET_NEWLIB_SYS_open:
{
int oflags, cflags;
int path = arg ();
@@ -200,7 +200,7 @@ rx_syscall (int id)
}
break;
- case TARGET_SYS_close:
+ case TARGET_NEWLIB_SYS_close:
{
int fd = arg ();
@@ -216,7 +216,7 @@ rx_syscall (int id)
}
break;
- case TARGET_SYS_read:
+ case TARGET_NEWLIB_SYS_read:
{
int fd = arg ();
int addr = arg ();
@@ -236,7 +236,7 @@ rx_syscall (int id)
}
break;
- case TARGET_SYS_write:
+ case TARGET_NEWLIB_SYS_write:
{
int fd = arg ();
int addr = arg ();
@@ -259,11 +259,11 @@ rx_syscall (int id)
}
break;
- case TARGET_SYS_getpid:
+ case TARGET_NEWLIB_SYS_getpid:
put_reg (1, 42);
break;
- case TARGET_SYS_gettimeofday:
+ case TARGET_NEWLIB_SYS_gettimeofday:
{
int tvaddr = arg ();
struct timeval tv;
@@ -278,7 +278,7 @@ rx_syscall (int id)
}
break;
- case TARGET_SYS_kill:
+ case TARGET_NEWLIB_SYS_kill:
{
int pid = arg ();
int sig = arg ();