From ea30e748f7fb066f958ff064bcde7574dd1c6e68 Mon Sep 17 00:00:00 2001 From: "Manuel A. Fernandez Montecelo" Date: Fri, 9 Dec 2022 08:19:34 -0500 Subject: [PATCH] Add support for riscv64 --- src/main/java/com/kenai/jffi/Platform.java | 5 +++++ src/main/java/com/kenai/jffi/internal/StubLoader.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/kenai/jffi/Platform.java b/src/main/java/com/kenai/jffi/Platform.java index 3d44d57a..5881ac4a 100644 --- a/src/main/java/com/kenai/jffi/Platform.java +++ b/src/main/java/com/kenai/jffi/Platform.java @@ -110,6 +110,8 @@ public enum CPU { MIPSEL(32), /** MIPS64EL */ MIPS64EL(64), + /** RISCV64 */ + RISCV64(64), /** Unknown CPU */ UNKNOWN(64); @@ -255,6 +257,9 @@ private static CPU determineCPU() { } else if (Util.equalsIgnoreCase("mips64", archString, LOCALE) || Util.equalsIgnoreCase("mips64el", archString, LOCALE)) { return CPU.MIPS64EL; + + } else if (Util.equalsIgnoreCase("riscv64", archString, LOCALE)) { + return CPU.RISCV64; } diff --git a/src/main/java/com/kenai/jffi/internal/StubLoader.java b/src/main/java/com/kenai/jffi/internal/StubLoader.java index 3ca1d6d7..ac78a2ac 100644 --- a/src/main/java/com/kenai/jffi/internal/StubLoader.java +++ b/src/main/java/com/kenai/jffi/internal/StubLoader.java @@ -165,6 +165,8 @@ public enum CPU { MIPSEL, /** MIPS 64-bit little endian */ MIPS64EL, + /** RISC-V 64-bit little endian */ + RISCV64, /** Unknown CPU */ UNKNOWN; @@ -237,6 +239,8 @@ private static CPU determineCPU() { return CPU.MIPSEL; } else if (Util.equalsIgnoreCase("mips64", archString, LOCALE) || Util.equalsIgnoreCase("mips64el", archString, LOCALE)) { return CPU.MIPS64EL; + } else if (Util.equalsIgnoreCase("riscv64", archString, LOCALE)) { + return CPU.RISCV64; }