asan: score: global-buffer-overflow
authorAlan Modra <amodra@gmail.com>
Sun, 15 Dec 2019 23:30:39 +0000 (10:00 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 16 Dec 2019 07:04:29 +0000 (17:34 +1030)
I'm flying blind here, not having an s+core s3 insn set reference,
but this seems reasonably obvious from what is done by the assembler.
s3_do16_rpop does some mixing of imm and reg values to place in the
rpop reg field, but I'm not going to try to fix the disassembly
there.

* score-dis.c (print_insn_score16): Move rpush/rpop imm field
value adjustment so that it doesn't affect reg field too.

opcodes/ChangeLog
opcodes/score-dis.c

index 9cc0ba491e78faec5d1ceff30770f39baa6f10fb..ce56ec023129cf3ba594d3b532283b79328edd16 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-16  Alan Modra  <amodra@gmail.com>
+
+       * score-dis.c (print_insn_score16): Move rpush/rpop imm field
+       value adjustment so that it doesn't affect reg field too.
+
 2019-12-16  Alan Modra  <amodra@gmail.com>
 
        * crx-dis.c (EXTRACT, SBM): Avoid signed overflow.
index 69c801b25244ebc88b59b3214a5970ce10481e6b..74a1f1d93203d995ecee35c14c74cac33c91d201 100644 (file)
@@ -954,15 +954,6 @@ print_insn_score16 (bfd_vma pc, struct disassemble_info *info, long given)
                               reg = given >> bitstart;
                               reg &= (2 << (bitend - bitstart)) - 1;
 
-                              /* Check rpush rd, 0 and rpop! rd, 0.
-                                 If reg = 0, then set to 32.  */
-                              if (((given & 0x00007c00) == 0x00006c00
-                                    || (given & 0x00007c00) == 0x00006800)
-                                  && reg == 0)
-                                {
-                                  reg = 32;
-                                }
-
                               switch (*c)
                                 {
                                 case 'R':
@@ -972,6 +963,13 @@ print_insn_score16 (bfd_vma pc, struct disassemble_info *info, long given)
                                   func (stream, "%s", score_regnames[reg]);
                                   break;
                                 case 'd':
+                                 /* Check rpush rd, 0 and rpop! rd, 0.
+                                    If 0, then print 32.  */
+                                 if (((given & 0x00007c00) == 0x00006c00
+                                      || (given & 0x00007c00) == 0x00006800)
+                                     && reg == 0)
+                                   reg = 32;
+
                                   if (*(c + 1) == '\0')
                                     func (stream, "%ld", reg);
                                   else
This page took 0.026539 seconds and 4 git commands to generate.