Skip to content

Commit

Permalink
RISCV64_LINUX support.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaykrell committed Feb 27, 2021
1 parent d3e2e72 commit 5eca40e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions m3-libs/libm3/src/os/POSIX/m3makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ local readonly DefaultArch = {
"MIPS64" : "mips64",
"PPC": "ppc",
"PPC64": "ppc64",
"RISCV64" : "riscv64",
"SPARC" : "sparc",
"SPARC64" : "sparc64",
"VAX" : "vax",
Expand Down
2 changes: 2 additions & 0 deletions m3-libs/m3core/src/runtime/POSIX/RTSignalC.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ static WORD_T GetPC(void* xcontext)
#elif defined(__s390__)
#error untested __linux target
context->uc_mcontext.sregs.regs.psw.addr
#elif defined(__riscv) || defined(__riscv64)
context->uc_mcontext.__gregs[REG_PC]
#else
#error unknown __linux target
#endif
Expand Down
6 changes: 6 additions & 0 deletions m3-sys/cminstall/src/config-no-install/RISCV64.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
readonly TARGET_ARCH = "RISCV64"
readonly TARGET_ENDIAN = "LITTLE" % { "BIG" OR "LITTLE" }
readonly WORD_SIZE = "64BITS" % { "32BITS" or "64BITS" }
readonly M3_BACKEND_MODE = "C"

M3_PARALLEL_BACK = 4
8 changes: 8 additions & 0 deletions m3-sys/cminstall/src/config-no-install/RISCV64_LINUX
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
readonly TARGET = "RISCV64_LINUX" % code generation target
% readonly GNU_PLATFORM = "riscv64-linux" % "cpu-os" string for GNU

readonly SYSTEM_CC = "g++ -g -fPIC" % C compiler
readonly SYSTEM_ASM = "as" % Assembler

include("RISCV64.common")
include("Linux.common")
3 changes: 2 additions & 1 deletion m3-sys/m3middle/src/Target.m3
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ PROCEDURE Init (system: TEXT; in_OS_name: TEXT; backend_mode: M3BackendMode_t):

| Systems.ARM64_DARWIN,
Systems.ARM64_LINUX,
Systems.ARM64_NT =>
Systems.ARM64_NT,
Systems.RISCV64_LINUX =>
EVAL 0;

| Systems.ARM_LINUX,
Expand Down
2 changes: 1 addition & 1 deletion scripts/python/pylib.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def _GetAllTargets():

for proc in ["ALPHA", "ALPHA32", "ALPHA64", "AMD64", "ARM", "ARMEL", "ARM64",
"IA64", "I386", "PPC", "PPC32", "PPC64", "SPARC", "SPARC32",
"SPARC64", "MIPS32", "MIPS64EL", "MIPS64", "PA32", "PA64", "SH"]:
"SPARC64", "MIPS32", "MIPS64EL", "MIPS64", "PA32", "PA64", "RISCV64", "SH"]:
for os in ["AIX", "CE", "CYGWIN", "DARWIN", "FREEBSD", "HPUX", "INTERIX", "IRIX",
"LINUX", "MINGW", "NETBSD", "NT", "OPENBSD", "OSF", "SOLARIS", "VMS"]:
# "BEOS", "MSDOS" (DJGPP), "OS2" (EMX), "PLAN9"
Expand Down

0 comments on commit 5eca40e

Please sign in to comment.