From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 3FD3B394FC26 for ; Mon, 19 Apr 2021 03:21:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3FD3B394FC26 Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 7A28533FE74 for ; Mon, 19 Apr 2021 03:21:03 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed 5/5] sim: moxie: switch syscalls to common nltvals Date: Sun, 18 Apr 2021 23:20:58 -0400 Message-Id: <20210419032058.18051-5-vapier@gentoo.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419032058.18051-1-vapier@gentoo.org> References: <20210419032058.18051-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2021 03:21:07 -0000 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 :). --- sim/common/ChangeLog | 5 +++++ sim/common/gennltvals.py | 1 + sim/common/nltvals.def | 31 +++++++++++++++++++++++++++++++ sim/moxie/ChangeLog | 6 ++++++ sim/moxie/Makefile.in | 3 +++ sim/moxie/interp.c | 11 ++++++----- 6 files changed, 52 insertions(+), 5 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 20a425731f52..d62a40d5db89 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2021-04-18 Mike Frysinger + + * gennltvals.py (TARGETS): Add moxie. + * nltvals.def: Regenerate. + 2021-04-18 Mike Frysinger * gennltvals.py (TARGET_DIRS, TARGETS): Add sh. diff --git a/sim/common/gennltvals.py b/sim/common/gennltvals.py index 5831607a17c7..cf23c3926994 100755 --- a/sim/common/gennltvals.py +++ b/sim/common/gennltvals.py @@ -68,6 +68,7 @@ TARGETS = { 'mcore', 'mn10200', 'mn10300', + 'moxie', 'msp430', 'pru', 'riscv', diff --git a/sim/common/nltvals.def b/sim/common/nltvals.def index 3b890af0639f..27f1b0d43b26 100644 --- a/sim/common/nltvals.def +++ b/sim/common/nltvals.def @@ -546,6 +546,37 @@ /* end mn10300 sys target macros */ #endif #endif +#ifdef NL_TARGET_moxie +#ifdef sys_defs +/* from syscall.h */ +/* begin moxie 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 moxie sys target macros */ +#endif +#endif #ifdef NL_TARGET_msp430 #ifdef sys_defs /* from syscall.h */ diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog index b6e91a24bda4..9621907dabb5 100644 --- a/sim/moxie/ChangeLog +++ b/sim/moxie/ChangeLog @@ -1,3 +1,9 @@ +2021-04-18 Mike Frysinger + + * 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 * configure: Regenerate. diff --git a/sim/moxie/Makefile.in b/sim/moxie/Makefile.in index bd58074491fc..3d9618846cc3 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 . +# 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 5da13f7808cb..417ff9ea5503 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -33,6 +33,7 @@ along with this program. If not, see . */ #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; -- 2.30.2