1 --- a/basis-library/mlton/platform.sig
2 +++ b/basis-library/mlton/platform.sig
6 datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | m68k |
7 - MIPS | MIPS64 | PowerPC | PowerPC64 | S390 | Sparc | X86
8 + MIPS | MIPS64 | PowerPC | PowerPC64 | RISCV64 | S390 | Sparc | X86
10 val fromString: string -> t option
12 --- a/basis-library/mlton/platform.sml
13 +++ b/basis-library/mlton/platform.sml
17 (PowerPC64, "PowerPC64"),
18 + (RISCV64, "RISCV64"),
22 --- a/basis-library/primitive/prim-mlton.sml
23 +++ b/basis-library/primitive/prim-mlton.sml
34 | "powerpc" => PowerPC
35 | "powerpc64" => PowerPC64
36 + | "riscv64" => RISCV64
52 --- a/doc/guide/src/MLtonPlatform.adoc
53 +++ b/doc/guide/src/MLtonPlatform.adoc
57 datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | m68k
58 - | MIPS | PowerPC | PowerPC64 | S390 | Sparc | X86
59 + | MIPS | PowerPC | PowerPC64 | RISCV64 | S390 | Sparc | X86
61 val fromString: string -> t option
63 --- a/lib/stubs/mlton-stubs/mlton.sml
64 +++ b/lib/stubs/mlton-stubs/mlton.sml
68 datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | m68k |
69 - MIPS | MIPS64 | PowerPC | PowerPC64 | S390 | Sparc | X86
70 + MIPS | MIPS64 | PowerPC | PowerPC64 | RISCV64 | S390 | Sparc | X86
72 val all = [(Alpha, "Alpha"),
77 (PowerPC64, "PowerPC64"),
78 + (RISCV64, "RISCV64"),
82 --- a/lib/stubs/mlton-stubs/platform.sig
83 +++ b/lib/stubs/mlton-stubs/platform.sig
87 datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | m68k |
88 - MIPS | MIPS64 | PowerPC | PowerPC64 | S390 | Sparc | X86
89 + MIPS | MIPS64 | PowerPC | PowerPC64 | RISCV64 | S390 | Sparc | X86
91 val fromString: string -> t option
93 --- a/mlton/main/main.fun
94 +++ b/mlton/main/main.fun
106 #include "platform/powerpc64.h"
107 #elif (defined (__ppc__)) || (defined (__powerpc__))
108 #include "platform/powerpc.h"
109 +#elif (defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64)
110 +#include "platform/riscv64.h"
111 #elif (defined (__s390__))
112 #include "platform/s390.h"
113 #elif (defined (__sparc__))
114 --- a/runtime/platform/linux.c
115 +++ b/runtime/platform/linux.c
117 #elif (defined (__ppc__)) || (defined (__powerpc__))
118 ucontext_t* ucp = (ucontext_t*)context;
119 GC_handleSigProf ((code_pointer) ucp->uc_mcontext.regs->nip);
120 +#elif (defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64)
121 + ucontext_t* ucp = (ucontext_t*)context;
122 + GC_handleSigProf ((code_pointer) ucp->uc_mcontext.__gregs[REG_PC]);
123 #elif (defined (__sparc__))
124 struct sigcontext* scp = (struct sigcontext*)context;
127 +++ b/runtime/platform/riscv64.h
129 +#define MLton_Platform_Arch_host "riscv64"