perl-Sys-CPU/add-support-riscv64.patch
David Abdurachmanov 65b573e0a6
Add support for riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2020-07-16 09:35:31 +03:00

30 lines
1.0 KiB
Diff

diff --git a/CPU.xs b/CPU.xs
index 067c9cb..53e806b 100644
--- a/CPU.xs
+++ b/CPU.xs
@@ -400,6 +400,9 @@ CODE:
#endif
#if defined __s390__ || defined __s390x__
value = processor_machine_field (proc_cpuinfo_field ("processor") );
+#endif
+#if defined __riscv
+ value = proc_cpuinfo_field ("processor");
#endif
if (!value) value = proc_cpuinfo_field ("model name");
if (!value) value = proc_cpuinfo_field ("machine");
diff --git a/t/Sys-CPU.t b/t/Sys-CPU.t
index 4246b22..e813514 100755
--- a/t/Sys-CPU.t
+++ b/t/Sys-CPU.t
@@ -25,8 +25,8 @@ if (defined($speed)) {
print "ok 3 (CPU Speed : $speed)\n";
} elsif ( $^O eq 'MSWin32'){
print "ok 3 (CPU Speed: test skipped on MSWin32)\n";
-} elsif ($Config{archname} =~ /^(arm|aarch64)/ ) {
- print "ok 3 (CPU Speed: test skipped on ARM and AArch64)\n";
+} elsif ($Config{archname} =~ /^(arm|aarch64|riscv64)/ ) {
+ print "ok 3 (CPU Speed: test skipped on ARM, AArch64 and RISC-V RV64GC)\n";
} else {
print "not ok 3 (cpu_clock undefined (ok if Win9x))\n";
}