summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/scmp_arch_detect.c3
-rw-r--r--tools/scmp_bpf_disasm.c2
-rw-r--r--tools/scmp_bpf_sim.c2
-rw-r--r--tools/util.c2
-rw-r--r--tools/util.h7
5 files changed, 16 insertions, 0 deletions
diff --git a/tools/scmp_arch_detect.c b/tools/scmp_arch_detect.c
index ad43f2d..b844a68 100644
--- a/tools/scmp_arch_detect.c
+++ b/tools/scmp_arch_detect.c
@@ -120,6 +120,9 @@ int main(int argc, char *argv[])
case SCMP_ARCH_S390X:
printf("s390x\n");
break;
+ case SCMP_ARCH_RISCV64:
+ printf("riscv64\n");
+ break;
default:
printf("unknown\n");
}
diff --git a/tools/scmp_bpf_disasm.c b/tools/scmp_bpf_disasm.c
index 27fba9a..5c914b4 100644
--- a/tools/scmp_bpf_disasm.c
+++ b/tools/scmp_bpf_disasm.c
@@ -508,6 +508,8 @@ int main(int argc, char *argv[])
arch = AUDIT_ARCH_S390;
else if (strcmp(optarg, "s390x") == 0)
arch = AUDIT_ARCH_S390X;
+ else if (strcmp(optarg, "riscv64") == 0)
+ arch = AUDIT_ARCH_RISCV64;
else
exit_usage(argv[0]);
break;
diff --git a/tools/scmp_bpf_sim.c b/tools/scmp_bpf_sim.c
index 4d30822..a381314 100644
--- a/tools/scmp_bpf_sim.c
+++ b/tools/scmp_bpf_sim.c
@@ -285,6 +285,8 @@ int main(int argc, char *argv[])
arch = AUDIT_ARCH_S390;
else if (strcmp(optarg, "s390x") == 0)
arch = AUDIT_ARCH_S390X;
+ else if (strcmp(optarg, "riscv64") == 0)
+ arch = AUDIT_ARCH_RISCV64;
else
exit_fault(EINVAL);
break;
diff --git a/tools/util.c b/tools/util.c
index 7122335..741b2a2 100644
--- a/tools/util.c
+++ b/tools/util.c
@@ -78,6 +78,8 @@
#define ARCH_NATIVE AUDIT_ARCH_S390X
#elif __s390__
#define ARCH_NATIVE AUDIT_ARCH_S390
+#elif __riscv && __riscv_xlen == 64
+#define ARCH_NATIVE AUDIT_ARCH_RISCV64
#else
#error the simulator code needs to know about your machine type
#endif
diff --git a/tools/util.h b/tools/util.h
index 08c4839..6c2ca33 100644
--- a/tools/util.h
+++ b/tools/util.h
@@ -72,6 +72,13 @@
#define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
#endif
+#ifndef AUDIT_ARCH_RISCV64
+#ifndef EM_RISCV
+#define EM_RISCV 243
+#endif /* EM_RISCV */
+#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+#endif /* AUDIT_ARCH_RISCV64 */
+
extern uint32_t arch;
uint16_t ttoh16(uint32_t arch, uint16_t val);