Skip to content
Permalink
Browse files
8284949: riscv: Add Zero support for the 32-bit RISC-V architecture
Co-authored-by: Junfeng Xie <xiejunfeng3@huawei.com>
Reviewed-by: erikj, stuefe, ihse, yadongwang
  • Loading branch information
2 people authored and magicus committed Apr 21, 2022
1 parent 994f2e9 commit fa04d1f832ff201248f935939fa255988053a1d0
Showing 4 changed files with 23 additions and 3 deletions.
@@ -144,7 +144,8 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
test "x$OPENJDK_TARGET_CPU" = xmips ||
test "x$OPENJDK_TARGET_CPU" = xmipsel ||
test "x$OPENJDK_TARGET_CPU" = xppc ||
test "x$OPENJDK_TARGET_CPU" = xsh); then
test "x$OPENJDK_TARGET_CPU" = xsh ||
test "x$OPENJDK_TARGET_CPU" = xriscv32); then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
fi
fi
@@ -126,6 +126,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
riscv32)
VAR_CPU=riscv32
VAR_CPU_ARCH=riscv
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
riscv64)
VAR_CPU=riscv64
VAR_CPU_ARCH=riscv
@@ -561,6 +567,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
HOTSPOT_$1_CPU_DEFINE=PPC64
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
HOTSPOT_$1_CPU_DEFINE=PPC64
elif test "x$OPENJDK_$1_CPU" = xriscv32; then
HOTSPOT_$1_CPU_DEFINE=RISCV32
elif test "x$OPENJDK_$1_CPU" = xriscv64; then
HOTSPOT_$1_CPU_DEFINE=RISCV64
@@ -1628,7 +1628,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"},
{EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"},
{EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"},
{EM_RISCV, EM_RISCV, ELFCLASS64, ELFDATA2LSB, (char*)"RISC-V"},
#ifdef _LP64
{EM_RISCV, EM_RISCV, ELFCLASS64, ELFDATA2LSB, (char*)"RISCV64"},
#else
{EM_RISCV, EM_RISCV, ELFCLASS32, ELFDATA2LSB, (char*)"RISCV32"},
#endif
{EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LoongArch"},
};

@@ -2476,7 +2480,7 @@ void os::get_summary_cpu_info(char* cpuinfo, size_t length) {
#elif defined(PPC)
strncpy(cpuinfo, "PPC64", length);
#elif defined(RISCV)
strncpy(cpuinfo, "RISCV64", length);
strncpy(cpuinfo, LP64_ONLY("RISCV64") NOT_LP64("RISCV32"), length);
#elif defined(S390)
strncpy(cpuinfo, "S390", length);
#elif defined(SPARC)
@@ -38,6 +38,13 @@

#define guarantee_with_errno(cond, msg) check_with_errno(guarantee, cond, msg)

// 32-bit RISC-V has no SYS_futex syscall.
#ifdef RISCV32
#if !defined(SYS_futex) && defined(SYS_futex_time64)
#define SYS_futex SYS_futex_time64
#endif
#endif

static int futex(volatile int *addr, int futex_op, int op_arg) {
return syscall(SYS_futex, addr, futex_op, op_arg, NULL, NULL, 0);
}

1 comment on commit fa04d1f

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on fa04d1f Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.