Skip to content

Commit

Permalink
Merge pull request #148 from physical-computation/issue-147
Browse files Browse the repository at this point in the history
More embedded target tweaks.
  • Loading branch information
phillipstanleymarbell authored Dec 2, 2019
2 parents b912d0a + c564d8a commit 88ec086
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
18 changes: 10 additions & 8 deletions sim/network-hitachi-sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
#include <string.h>
#include <math.h>
#include <float.h>
#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
{
Expand All @@ -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. */
Expand Down
27 changes: 23 additions & 4 deletions sim/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/times.h>
#ifndef SF_EMBEDDED
# include <sys/times.h>
#endif
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
Expand All @@ -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);
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit 88ec086

Please sign in to comment.