From ea30e748f7fb066f958ff064bcde7574dd1c6e68 Mon Sep 17 00:00:00 2001
From: "Manuel A. Fernandez Montecelo" <mafm@debian.org>
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 3d44d57..5881ac4 100644
--- a/src/main/java/com/kenai/jffi/Platform.java
+++ b/src/main/java/com/kenai/jffi/Platform.java
@@ -110,6 +110,8 @@ public abstract class Platform {
         AARCH64(64),
        /** MIPS64EL */
         MIPS64EL(64),
+        /** RISCV64 */
+        RISCV64(64),
         /** Unknown CPU */
         UNKNOWN(64);
 
@@ -255,6 +257,9 @@ public abstract class Platform {
 
             } 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 3ca1d6d..ac78a2a 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 class StubLoader {
         AARCH64,
         /** MIPS 64-bit little endian */
         MIPS64EL,
+        /** RISC-V 64-bit little endian */
+        RISCV64,
         /** Unknown CPU */
         UNKNOWN;
 
@@ -237,6 +239,8 @@ public class StubLoader {
             return CPU.AARCH64;
         } 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;
 
         }
 
-- 
2.40.1

