]> 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)
committerLuis Machado <luis.machado@linaro.org>
Wed, 17 Mar 2021 13:38:42 +0000 (10:38 -0300)
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/ChangeLog
gdb/aarch64-tdep.c

index 97addfc322bd1ef7aa6f4d3f0fc80675064d1d90..02fc5b8c149f0dc17bcfd7ebcd70868de10528fd 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-17  Luis Machado  <luis.machado@arm.com>
+
+       * aarch64-tdep.c (aarch64_register_tag): Handle PCC/CSP tag
+       extraction.
+
 2021-03-17  Luis Machado  <luis.machado@arm.com>
 
        * aarch64-tdep.c (aarch64_find_mapping_symbol, aarch64_pc_is_c64): New
index 9d11cba958bdd6f749fea9b7a11de7e606968aa7..fd3a8e8ae0d9e74a7d76a51b010d3318a95baee9 100644 (file)
@@ -4123,6 +4123,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;