From c564d8a9f97d92e245095f290f698dba1e9c9431 Mon Sep 17 00:00:00 2001 From: Phillip Stanley-Marbell Date: Mon, 2 Dec 2019 17:06:35 +0000 Subject: [PATCH] More embedded target tweaks. --- sim/network-hitachi-sh.c | 18 ++++++++++-------- sim/syscalls.c | 27 +++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/sim/network-hitachi-sh.c b/sim/network-hitachi-sh.c index 0f2c5aa4..316cfb31 100755 --- a/sim/network-hitachi-sh.c +++ b/sim/network-hitachi-sh.c @@ -40,14 +40,6 @@ #include #include #include -#include "sf.h" -#include "mextern.h" - -static int lookup_id(Engine *, uchar*); -static int seg_enqueue(Engine *E, State *S, int whichifc); -static uchar * fifo_dequeue(Engine *, State *S, Fifo fifo_name, int whichifc); -static void netsegcircbuf(Engine *, Segbuf *segbuf); -static void seg_dequeue(Netsegment *curseg, int whichbuf); enum { @@ -62,6 +54,16 @@ enum Etxunderrun, }; +#include "sf.h" +#include "mextern.h" + +static int lookup_id(Engine *, uchar*); +static int seg_enqueue(Engine *E, State *S, int whichifc); +static uchar * fifo_dequeue(Engine *, State *S, Fifo fifo_name, int whichifc); +static void netsegcircbuf(Engine *, Segbuf *segbuf); +static void seg_dequeue(Netsegment *curseg, int whichbuf); + + /* */ /* The fifo_enqueue() and fifo_dequeue() functions just update */ /* the FIFO indeces. */ diff --git a/sim/syscalls.c b/sim/syscalls.c index 4e249d98..10b24345 100755 --- a/sim/syscalls.c +++ b/sim/syscalls.c @@ -38,7 +38,9 @@ #include #include #include -#include +#ifndef SF_EMBEDDED +# include +#endif #include #include #include @@ -65,16 +67,21 @@ sim_syscall(Engine *E, State *S, ulong type, ulong arg1, ulong arg2, ulong arg3) { case SYS_exit: { +#ifndef SF_EMBEDDED struct tms t; - - //TODO: should just call m_off and get rid of most of this crud +#endif + /* + * TODO: should just call m_off and get rid of most of this crud + */ E->verbose = 1; if (SF_DEBUG) { mprint(E, S, nodeinfo, "SYSCALL: SYS_exit\n"); } +#ifndef SF_EMBEDDED times(&t); +#endif S->ufinish = musercputimeusecs(); S->finishclk = S->ICLK; mprint(E, S, nodeinfo, "\n\nNODE %d exiting...\n", S->NODE_ID); @@ -115,7 +122,7 @@ sim_syscall(Engine *E, State *S, ulong type, ulong arg1, ulong arg2, ulong arg3) case SYS_fork: { /* Not Implemented */ - //if (SF_DEBUG) + if (SF_DEBUG) { mprint(E, S, nodeinfo, "SYSCALL: SYS_fork: NOT IMPLEMENTED!!!\n"); } @@ -559,14 +566,22 @@ ulong sys_chmod(State *S, const char *path, short mode) { /* For now, just pass it on */ +#ifndef SF_EMBEDDED return chmod((char *)&S->MEM[(ulong)path - S->MEMBASE], mode); +#else + return 0; +#endif } ulong sys_chown(State *S, const char *path, short owner, short group) { /* For now, just pass it on */ +#ifndef SF_EMBEDDED return chown((char *)&S->MEM[(ulong)path - S->MEMBASE], owner, group); +#else + return 0; +#endif } ulong @@ -599,6 +614,10 @@ ulong sys_utime(State *S, const char *path, const struct utimbuf *times) { /* For now, just pass it on */ +#ifndef SF_EMBEDDED return utime((char *)&S->MEM[(ulong)path - S->MEMBASE],\ (const struct utimbuf *)&S->MEM[(ulong)times - S->MEMBASE]); +#else + return 0; +#endif }