[PATCH] D136264: [libunwind][RISCV] Support reading of VLENB CSR register
Sergei Kachkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 21 01:44:22 PDT 2022
kachkov98 updated this revision to Diff 469504.
kachkov98 added a comment.
Review changes
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136264/new/
https://reviews.llvm.org/D136264
Files:
libunwind/include/__libunwind_config.h
libunwind/include/libunwind.h
libunwind/src/Registers.hpp
Index: libunwind/src/Registers.hpp
===================================================================
--- libunwind/src/Registers.hpp
+++ libunwind/src/Registers.hpp
@@ -4084,6 +4084,8 @@
return true;
if (regNum < 0)
return false;
+ if (regNum == UNW_RISCV_VLENB)
+ return true;
if (regNum > UNW_RISCV_F31)
return false;
return true;
@@ -4098,6 +4100,11 @@
return 0;
if ((regNum > 0) && (regNum < 32))
return _registers[regNum];
+ if (regNum == UNW_RISCV_VLENB) {
+ reg_t vlenb;
+ __asm__("csrr %0, 0xC22" : "=r"(vlenb));
+ return vlenb;
+ }
_LIBUNWIND_ABORT("unsupported riscv register");
}
@@ -4249,6 +4256,8 @@
return "ft10";
case UNW_RISCV_F31:
return "ft11";
+ case UNW_RISCV_VLENB:
+ return "vlenb";
default:
return "unknown register";
}
Index: libunwind/include/libunwind.h
===================================================================
--- libunwind/include/libunwind.h
+++ libunwind/include/libunwind.h
@@ -1023,6 +1023,7 @@
UNW_RISCV_F29 = 61,
UNW_RISCV_F30 = 62,
UNW_RISCV_F31 = 63,
+ UNW_RISCV_VLENB = 0x1C22
};
// VE register numbers
Index: libunwind/include/__libunwind_config.h
===================================================================
--- libunwind/include/__libunwind_config.h
+++ libunwind/include/__libunwind_config.h
@@ -27,7 +27,7 @@
#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC 31
#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC64 31
#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_HEXAGON 34
-#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV 64
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV 8191
#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_VE 143
#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_S390X 83
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136264.469504.patch
Type: text/x-patch
Size: 1768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221021/82c33299/attachment.bin>
More information about the llvm-commits
mailing list