Skip to content

Commit

Permalink
arc: libgloss: Add support of ARCv3 targets
Browse files Browse the repository at this point in the history
Sources for ARCv1/2 targets are going to be used for ARCv3
targets. Thus, it's necessary to adjust it for ARCv3.

Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
  • Loading branch information
kolerov committed May 29, 2024
1 parent f72d9da commit 313ea5f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libgloss/arc/hl-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
*/

#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/times.h>
Expand Down Expand Up @@ -44,6 +45,19 @@ _getpid (void)
return __MYPID;
}

/* We do not have 64-bit compatible hostlink fstat. */
#if defined (__ARC64__)
int
_fstat (int fd, struct stat *st)
{
memset (st, 0, sizeof (*st));
st->st_mode = S_IFCHR;
st->st_blksize = 1024;

return 0;
}
#endif


/* hostlink backend has only fstat(), so use fstat() in stat(). */
int
Expand Down
9 changes: 9 additions & 0 deletions libgloss/arc/hl/hl_gw.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
*/

#include <stdint.h>
#include "hl_gw.h"

#define HL_VERSION 1
Expand Down Expand Up @@ -134,7 +135,15 @@ _hl_send (volatile __uncached void *p)

_hl_pkt_init (pkt_hdr, _hl_payload_used (p));

#if defined (__ARC64__)
/*
* Here we pass only low 4 bytes of the packet address (pkt_hdr).
* The high part of the address is obtained from __HOSTLINK__ address.
*/
hdr->buf_addr = (uintptr_t) pkt_hdr & 0xFFFFFFFF;
#else
hdr->buf_addr = (uint32_t) pkt_hdr;
#endif
hdr->payload_size = _hl_payload_size ();
hdr->host2target_addr = HL_NOADDRESS;
hdr->version = HL_VERSION;
Expand Down
10 changes: 10 additions & 0 deletions libgloss/arc/hl/hl_toolchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
#define _HL_TOOLCHAIN_H

#ifndef __uncached
#if defined (__ARC64__)
/* TODO: Uncached attribute is not implemented for ARCv3 yet. */
#define __uncached
#else
#define __uncached __attribute__((uncached))
#endif
#endif /* __uncached */

#ifndef __aligned
Expand All @@ -43,7 +48,12 @@
#endif /* __noreturn */

#ifndef __longcall
#if defined (__ARC64__)
/* TODO: Long call attribute is not implemented for ARCv3 yet. */
#define __longcall
#else
#define __longcall __attribute__((long_call))
#endif
#endif /* __longcall */

#define HL_MAX_DCACHE_LINE 256
Expand Down
5 changes: 5 additions & 0 deletions libgloss/arc/nsim-syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ _open (const char * pathname, int flags, int mode)
}

/* Should be provided by crt0.S. */
#if defined (__ARC64__)
/* TODO: long_call is not implemented yet in GCC. Fix this when implemented. */
extern void __attribute__((noreturn)) _exit_halt (int ret);
#else
extern void __attribute__((noreturn, long_call)) _exit_halt (int ret);
#endif

void
__attribute__((noreturn))
Expand Down

0 comments on commit 313ea5f

Please sign in to comment.