sim: rx: switch syscalls to common nltvals

Rather than hand duplicate the syscall table, switch to the common
nltvals framework.  We have to tweak the constant names, but we get
everything else for free.  I made sure the constants have the same
values before & after too :).
This commit is contained in:
Mike Frysinger
2021-04-18 22:35:19 -04:00
parent f956ecde56
commit b3d4da0f12
7 changed files with 59 additions and 62 deletions

View File

@@ -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 ();