mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 08:38:10 +08:00
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 :).
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2021-04-18 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
* gennltvals.py (TARGETS): Add moxie.
|
||||||
|
* nltvals.def: Regenerate.
|
||||||
|
|
||||||
2021-04-18 Mike Frysinger <vapier@gentoo.org>
|
2021-04-18 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* gennltvals.py (TARGET_DIRS, TARGETS): Add sh.
|
* gennltvals.py (TARGET_DIRS, TARGETS): Add sh.
|
||||||
|
@ -68,6 +68,7 @@ TARGETS = {
|
|||||||
'mcore',
|
'mcore',
|
||||||
'mn10200',
|
'mn10200',
|
||||||
'mn10300',
|
'mn10300',
|
||||||
|
'moxie',
|
||||||
'msp430',
|
'msp430',
|
||||||
'pru',
|
'pru',
|
||||||
'riscv',
|
'riscv',
|
||||||
|
@ -546,6 +546,37 @@
|
|||||||
/* end mn10300 sys target macros */
|
/* end mn10300 sys target macros */
|
||||||
#endif
|
#endif
|
||||||
#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 NL_TARGET_msp430
|
||||||
#ifdef sys_defs
|
#ifdef sys_defs
|
||||||
/* from syscall.h */
|
/* from syscall.h */
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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>
|
2021-04-18 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* configure: Regenerate.
|
* configure: Regenerate.
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# 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
|
## COMMON_PRE_CONFIG_FRAG
|
||||||
|
|
||||||
DTC = @DTC@
|
DTC = @DTC@
|
||||||
|
@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
#include "sim-base.h"
|
#include "sim-base.h"
|
||||||
#include "sim-options.h"
|
#include "sim-options.h"
|
||||||
#include "sim-io.h"
|
#include "sim-io.h"
|
||||||
|
#include "targ-vals.h"
|
||||||
|
|
||||||
typedef int word;
|
typedef int word;
|
||||||
typedef unsigned int uword;
|
typedef unsigned int uword;
|
||||||
@ -932,13 +933,13 @@ sim_engine_run (SIM_DESC sd,
|
|||||||
cpu.asregs.sregs[3] = inum;
|
cpu.asregs.sregs[3] = inum;
|
||||||
switch (inum)
|
switch (inum)
|
||||||
{
|
{
|
||||||
case 0x1: /* SYS_exit */
|
case TARGET_SYS_exit:
|
||||||
{
|
{
|
||||||
sim_engine_halt (sd, scpu, NULL, pc, sim_exited,
|
sim_engine_halt (sd, scpu, NULL, pc, sim_exited,
|
||||||
cpu.asregs.regs[2]);
|
cpu.asregs.regs[2]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2: /* SYS_open */
|
case TARGET_SYS_open:
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
int mode = (int) convert_target_flags ((unsigned) cpu.asregs.regs[3]);
|
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;
|
cpu.asregs.regs[2] = fd;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x4: /* SYS_read */
|
case TARGET_SYS_read:
|
||||||
{
|
{
|
||||||
int fd = cpu.asregs.regs[2];
|
int fd = cpu.asregs.regs[2];
|
||||||
unsigned len = (unsigned) cpu.asregs.regs[4];
|
unsigned len = (unsigned) cpu.asregs.regs[4];
|
||||||
@ -962,7 +963,7 @@ sim_engine_run (SIM_DESC sd,
|
|||||||
free (buf);
|
free (buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x5: /* SYS_write */
|
case TARGET_SYS_write:
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
/* String length is at 0x12($fp) */
|
/* String length is at 0x12($fp) */
|
||||||
@ -975,7 +976,7 @@ sim_engine_run (SIM_DESC sd,
|
|||||||
cpu.asregs.regs[2] = count;
|
cpu.asregs.regs[2] = count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x7: /* SYS_unlink */
|
case TARGET_SYS_unlink:
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
int fd;
|
int fd;
|
||||||
|
Reference in New Issue
Block a user