================
@@ -1895,11 +1907,27 @@ inline bool Registers_arm64::validRegister(int regNum) 
const {
     return false;
   if (regNum == UNW_AARCH64_RA_SIGN_STATE)
     return true;
+  if (regNum == UNW_AARCH64_VG)
+    return true;
   if ((regNum > 32) && (regNum < 64))
     return false;
   return true;
 }
 
+inline uint64_t Registers_arm64::lazyGetVG() const {
+  if (!_misc_registers.__vg) {
+#if defined(__aarch64__)
+    register uint64_t vg asm("x0");
+    asm(".inst 0x04e0e3e0" // CNTD x0
+        : "=r"(vg));
+    _misc_registers.__vg = vg;
----------------
MacDue wrote:

Not sure if there's a nicer way to do this, LLVM's compiler-rt provides 
`__arm_get_current_vg` (which would be a safer alternative), but depending on 
how libunwind is built, it's not necessarily going to be available. 

https://github.com/llvm/llvm-project/pull/153565
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to