aboutsummaryrefslogtreecommitdiff
path: root/sim/moxie
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-04-18 22:48:31 -0400
committerMike Frysinger <vapier@gentoo.org>2021-04-18 23:03:38 -0400
commitf3d25569f113248ae34ac35e950378a90d332e64 (patch)
treed405b6cb96cbc4e8824c3adbd88b9500c127d5b1 /sim/moxie
parentb7c5246bbfad67b60a820db5e548e665171645ec (diff)
downloadgdb-f3d25569f113248ae34ac35e950378a90d332e64.zip
gdb-f3d25569f113248ae34ac35e950378a90d332e64.tar.gz
gdb-f3d25569f113248ae34ac35e950378a90d332e64.tar.bz2
sim: moxie: switch syscalls to common nltvals
Rather than hand duplicate the syscall constants, switch to the common nltvals framework. I made sure the constants have the same values before & after too :).
Diffstat (limited to 'sim/moxie')
-rw-r--r--sim/moxie/ChangeLog6
-rw-r--r--sim/moxie/Makefile.in3
-rw-r--r--sim/moxie/interp.c11
3 files changed, 15 insertions, 5 deletions
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog
index b6e91a2..9621907 100644
--- a/sim/moxie/ChangeLog
+++ b/sim/moxie/ChangeLog
@@ -1,5 +1,11 @@
2021-04-18 Mike Frysinger <vapier@gentoo.org>
+ * Makefile.in (NL_TARGET): Define.
+ * interp.c: Include targ-vals.h.
+ (sim_engine_run): Change numeric literals to SYS_ constants.
+
+2021-04-18 Mike Frysinger <vapier@gentoo.org>
+
* configure: Regenerate.
2021-04-12 Mike Frysinger <vapier@gentoo.org>
diff --git a/sim/moxie/Makefile.in b/sim/moxie/Makefile.in
index bd58074..3d96188 100644
--- a/sim/moxie/Makefile.in
+++ b/sim/moxie/Makefile.in
@@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This selects the newlib/libgloss syscall definitions.
+NL_TARGET = -DNL_TARGET_moxie
+
## COMMON_PRE_CONFIG_FRAG
DTC = @DTC@
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index 5da13f7..417ff9e 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-base.h"
#include "sim-options.h"
#include "sim-io.h"
+#include "targ-vals.h"
typedef int word;
typedef unsigned int uword;
@@ -932,13 +933,13 @@ sim_engine_run (SIM_DESC sd,
cpu.asregs.sregs[3] = inum;
switch (inum)
{
- case 0x1: /* SYS_exit */
+ case TARGET_SYS_exit:
{
sim_engine_halt (sd, scpu, NULL, pc, sim_exited,
cpu.asregs.regs[2]);
break;
}
- case 0x2: /* SYS_open */
+ case TARGET_SYS_open:
{
char fname[1024];
int mode = (int) convert_target_flags ((unsigned) cpu.asregs.regs[3]);
@@ -951,7 +952,7 @@ sim_engine_run (SIM_DESC sd,
cpu.asregs.regs[2] = fd;
break;
}
- case 0x4: /* SYS_read */
+ case TARGET_SYS_read:
{
int fd = cpu.asregs.regs[2];
unsigned len = (unsigned) cpu.asregs.regs[4];
@@ -962,7 +963,7 @@ sim_engine_run (SIM_DESC sd,
free (buf);
break;
}
- case 0x5: /* SYS_write */
+ case TARGET_SYS_write:
{
char *str;
/* String length is at 0x12($fp) */
@@ -975,7 +976,7 @@ sim_engine_run (SIM_DESC sd,
cpu.asregs.regs[2] = count;
break;
}
- case 0x7: /* SYS_unlink */
+ case TARGET_SYS_unlink:
{
char fname[1024];
int fd;