Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgloss: arc: Add clock() system call to libnsim #65

Open
wants to merge 1 commit into
base: arc-2024.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions libgloss/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ arc_libiotdk_uart_a_LIBADD =
arc_libiotdk_uart_a_OBJECTS = $(am_arc_libiotdk_uart_a_OBJECTS)
arc_libnsim_a_AR = $(AR) $(ARFLAGS)
arc_libnsim_a_LIBADD =
@CONFIG_ARC_TRUE@am_arc_libnsim_a_OBJECTS = arc/libcfunc.$(OBJEXT) \
@CONFIG_ARC_TRUE@ arc/mcount.$(OBJEXT) \
@CONFIG_ARC_TRUE@am_arc_libnsim_a_OBJECTS = arc/arc-timer.$(OBJEXT) \
@CONFIG_ARC_TRUE@ arc/libcfunc.$(OBJEXT) arc/mcount.$(OBJEXT) \
@CONFIG_ARC_TRUE@ arc/nsim-syscalls.$(OBJEXT) \
@CONFIG_ARC_TRUE@ arc/sbrk.$(OBJEXT)
arc_libnsim_a_OBJECTS = $(am_arc_libnsim_a_OBJECTS)
Expand Down Expand Up @@ -696,6 +696,7 @@ arc64_libhl_a_OBJECTS = $(am_arc64_libhl_a_OBJECTS)
arc64_libnsim_a_AR = $(AR) $(ARFLAGS)
arc64_libnsim_a_LIBADD =
@CONFIG_ARC64_TRUE@am_arc64_libnsim_a_OBJECTS = \
@CONFIG_ARC64_TRUE@ arc/arc64_libnsim_a-arc-timer.$(OBJEXT) \
@CONFIG_ARC64_TRUE@ arc/arc64_libnsim_a-libcfunc.$(OBJEXT) \
@CONFIG_ARC64_TRUE@ arc/arc64_libnsim_a-nsim-syscalls.$(OBJEXT) \
@CONFIG_ARC64_TRUE@ arc/arc64_libnsim_a-sbrk.$(OBJEXT)
Expand Down Expand Up @@ -2176,6 +2177,7 @@ TEXINFO_TEX = ../texinfo/texinfo.tex
@CONFIG_AARCH64_TRUE@ aarch64/cpu-init/rdimon-aem-v8-r.o

@CONFIG_ARC_TRUE@arc_libnsim_a_SOURCES = \
@CONFIG_ARC_TRUE@ arc/arc-timer.c \
@CONFIG_ARC_TRUE@ arc/libcfunc.c \
@CONFIG_ARC_TRUE@ arc/mcount.c \
@CONFIG_ARC_TRUE@ arc/nsim-syscalls.c \
Expand Down Expand Up @@ -2222,6 +2224,7 @@ TEXINFO_TEX = ../texinfo/texinfo.tex
@CONFIG_ARC_TRUE@arc_libemsdp_uart_a_SOURCES = arc/emsdp-uart-setup.c
@CONFIG_ARC64_TRUE@arc64_libnsim_a_CPPFLAGS = -I$(srcdir)/arc
@CONFIG_ARC64_TRUE@arc64_libnsim_a_SOURCES = \
@CONFIG_ARC64_TRUE@ arc/arc-timer.c \
@CONFIG_ARC64_TRUE@ arc/libcfunc.c \
@CONFIG_ARC64_TRUE@ arc/nsim-syscalls.c \
@CONFIG_ARC64_TRUE@ arc/sbrk.c
Expand Down Expand Up @@ -3383,6 +3386,8 @@ arc/libiotdk_uart.a: $(arc_libiotdk_uart_a_OBJECTS) $(arc_libiotdk_uart_a_DEPEND
$(AM_V_at)-rm -f arc/libiotdk_uart.a
$(AM_V_AR)$(arc_libiotdk_uart_a_AR) arc/libiotdk_uart.a $(arc_libiotdk_uart_a_OBJECTS) $(arc_libiotdk_uart_a_LIBADD)
$(AM_V_at)$(RANLIB) arc/libiotdk_uart.a
arc/arc-timer.$(OBJEXT): arc/$(am__dirstamp) \
arc/$(DEPDIR)/$(am__dirstamp)
arc/libcfunc.$(OBJEXT): arc/$(am__dirstamp) \
arc/$(DEPDIR)/$(am__dirstamp)
arc/mcount.$(OBJEXT): arc/$(am__dirstamp) \
Expand Down Expand Up @@ -3454,6 +3459,8 @@ arc64/libhl.a: $(arc64_libhl_a_OBJECTS) $(arc64_libhl_a_DEPENDENCIES) $(EXTRA_ar
$(AM_V_at)-rm -f arc64/libhl.a
$(AM_V_AR)$(arc64_libhl_a_AR) arc64/libhl.a $(arc64_libhl_a_OBJECTS) $(arc64_libhl_a_LIBADD)
$(AM_V_at)$(RANLIB) arc64/libhl.a
arc/arc64_libnsim_a-arc-timer.$(OBJEXT): arc/$(am__dirstamp) \
arc/$(DEPDIR)/$(am__dirstamp)
arc/arc64_libnsim_a-libcfunc.$(OBJEXT): arc/$(am__dirstamp) \
arc/$(DEPDIR)/$(am__dirstamp)
arc/arc64_libnsim_a-nsim-syscalls.$(OBJEXT): arc/$(am__dirstamp) \
Expand Down Expand Up @@ -5686,11 +5693,13 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@aarch64/$(DEPDIR)/aarch64_librdimon_a-syscalls.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@aarch64/$(DEPDIR)/aarch64_librdimon_a-truncate.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc-main-helper.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc-timer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libhl_a-arc-timer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libhl_a-hl-setup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libhl_a-hl-stub.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libhl_a-libcfunc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libhl_a-sbrk.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libnsim_a-arc-timer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libnsim_a-libcfunc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libnsim_a-nsim-syscalls.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arc/$(DEPDIR)/arc64_libnsim_a-sbrk.Po@am__quote@
Expand Down Expand Up @@ -7382,6 +7391,20 @@ arc/hl/arc64_libhl_a-hl_exit.obj: arc/hl/hl_exit.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(arc64_libhl_a_CPPFLAGS) $(CPPFLAGS) $(arc64_libhl_a_CFLAGS) $(CFLAGS) -c -o arc/hl/arc64_libhl_a-hl_exit.obj `if test -f 'arc/hl/hl_exit.c'; then $(CYGPATH_W) 'arc/hl/hl_exit.c'; else $(CYGPATH_W) '$(srcdir)/arc/hl/hl_exit.c'; fi`

arc/arc64_libnsim_a-arc-timer.o: arc/arc-timer.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(arc64_libnsim_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT arc/arc64_libnsim_a-arc-timer.o -MD -MP -MF arc/$(DEPDIR)/arc64_libnsim_a-arc-timer.Tpo -c -o arc/arc64_libnsim_a-arc-timer.o `test -f 'arc/arc-timer.c' || echo '$(srcdir)/'`arc/arc-timer.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) arc/$(DEPDIR)/arc64_libnsim_a-arc-timer.Tpo arc/$(DEPDIR)/arc64_libnsim_a-arc-timer.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='arc/arc-timer.c' object='arc/arc64_libnsim_a-arc-timer.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(arc64_libnsim_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o arc/arc64_libnsim_a-arc-timer.o `test -f 'arc/arc-timer.c' || echo '$(srcdir)/'`arc/arc-timer.c

arc/arc64_libnsim_a-arc-timer.obj: arc/arc-timer.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(arc64_libnsim_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT arc/arc64_libnsim_a-arc-timer.obj -MD -MP -MF arc/$(DEPDIR)/arc64_libnsim_a-arc-timer.Tpo -c -o arc/arc64_libnsim_a-arc-timer.obj `if test -f 'arc/arc-timer.c'; then $(CYGPATH_W) 'arc/arc-timer.c'; else $(CYGPATH_W) '$(srcdir)/arc/arc-timer.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) arc/$(DEPDIR)/arc64_libnsim_a-arc-timer.Tpo arc/$(DEPDIR)/arc64_libnsim_a-arc-timer.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='arc/arc-timer.c' object='arc/arc64_libnsim_a-arc-timer.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(arc64_libnsim_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o arc/arc64_libnsim_a-arc-timer.obj `if test -f 'arc/arc-timer.c'; then $(CYGPATH_W) 'arc/arc-timer.c'; else $(CYGPATH_W) '$(srcdir)/arc/arc-timer.c'; fi`

arc/arc64_libnsim_a-libcfunc.o: arc/libcfunc.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(arc64_libnsim_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT arc/arc64_libnsim_a-libcfunc.o -MD -MP -MF arc/$(DEPDIR)/arc64_libnsim_a-libcfunc.Tpo -c -o arc/arc64_libnsim_a-libcfunc.o `test -f 'arc/libcfunc.c' || echo '$(srcdir)/'`arc/libcfunc.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) arc/$(DEPDIR)/arc64_libnsim_a-libcfunc.Tpo arc/$(DEPDIR)/arc64_libnsim_a-libcfunc.Po
Expand Down
1 change: 1 addition & 0 deletions libgloss/arc/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
multilibtool_LIBRARIES += %D%/libnsim.a
%C%_libnsim_a_SOURCES = \
%D%/arc-timer.c \
%D%/libcfunc.c \
%D%/mcount.c \
%D%/nsim-syscalls.c \
Expand Down
10 changes: 10 additions & 0 deletions libgloss/arc/nsim-syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include "glue.h"
#include "nsim-syscall.h"
#include "arc-timer.h"

/* Those system calls are implemented in both nSIM and CGEN. */
_syscall3 (_ssize_t, read, int, fd, void *, buf, size_t, count)
Expand Down Expand Up @@ -216,6 +217,15 @@ _fstat (int fd, struct stat *buf)
return __res;
}

clock_t
_clock (void)
{
if (_arc_timer_default_present ())
return _arc_timer_default_read ();
else
return -1;
}

/* Some system calls are implemented in nSIM hostlink, but are available only
on Linux hosts. To minimize potential compatibility issues they are by
default disabled in libgloss build. */
Expand Down
1 change: 1 addition & 0 deletions libgloss/arc64/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
multilibtool_LIBRARIES += %D%/libnsim.a
%C%_libnsim_a_CPPFLAGS = -I$(srcdir)/arc
%C%_libnsim_a_SOURCES = \
arc/arc-timer.c \
arc/libcfunc.c \
arc/nsim-syscalls.c \
arc/sbrk.c
Expand Down