]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix extracting tags from PCC and CSP
authorLuis Machado <luis.machado@linaro.org>
Wed, 10 Mar 2021 13:16:56 +0000 (10:16 -0300)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:57:21 +0000 (15:57 -0700)
The tags for PCC/CSP are stored in the order of struct user_morello_state.

Make sure we account for that when extracting the tags.

gdb/ChangeLog:

2021-03-17  Luis Machado  <luis.machado@arm.com>

* aarch64-tdep.c (aarch64_register_tag): Handle PCC/CSP tag
extraction.

gdb/aarch64-tdep.c

index 14531b27009cbce0f6fcb3ef998c3f43b43697ca..e4ac51a00ab999bea7e9f13ad0d9e961b287cf27 100644 (file)
@@ -4189,6 +4189,16 @@ aarch64_register_tag (struct gdbarch *gdbarch,
       regnum > tdep->cap_reg_last - 2)
     return false;
 
+  /* The CSP/PCC tags are swapped in the tag_map because the ordering of CSP/PCC
+     in struct user_morello_state is different from GDB's register description.
+
+     Make sure we account for that when extracting the tag from those
+     registers.  */
+  if (regnum == tdep->cap_reg_pcc)
+    regnum = tdep->cap_reg_csp;
+  else if (regnum == tdep->cap_reg_csp)
+    regnum = tdep->cap_reg_pcc;
+
   /* Find the proper bit within the tag_map.  */
   int shift = regnum - tdep->cap_reg_base;
   ULONGEST tag_map = 0;