* [PATCH]: Fix Bug #1290: Disassembling of bclr is wrong for 68HC12
@ 2002-10-13 2:05 Stephane Carrez
0 siblings, 0 replies; only message in thread
From: Stephane Carrez @ 2002-10-13 2:05 UTC (permalink / raw)
To: binutils, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
Hi!
I've committed the following patch to fix:
[ Bug #1290 ] Disassembling of bclr is wrong for 68HC12
http://savannah.gnu.org/bugs/?func=detailbug&group_id=2424&bug_id=1290
The bitmask was disassembled before the operand.
Committed on binutils/gdb mainline and gdb 5.3 branch.
Stephane
2002-10-13 Stephane Carrez <stcarrez@nerim.fr>
* m68hc11-dis.c (print_insn): Treat bitmask and branch operands
at the end.
[-- Attachment #2: m68hc11-dis.c.diffs --]
[-- Type: text/plain, Size: 3264 bytes --]
Index: m68hc11-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/m68hc11-dis.c,v
retrieving revision 1.5
diff -u -p -r1.5 m68hc11-dis.c
--- m68hc11-dis.c 13 Aug 2002 19:01:25 -0000 1.5
+++ m68hc11-dis.c 13 Oct 2002 08:45:32 -0000
@@ -495,55 +495,6 @@ print_insn (memaddr, info, arch)
reg_dst_table[(buffer[0] & 7)]);
}
- /* M6811_OP_BITMASK and M6811_OP_JUMP_REL must be treated separately
- and in that order. The brset/brclr insn have a bitmask and then
- a relative branch offset. */
- if (format & M6811_OP_BITMASK)
- {
- status = read_memory (memaddr + pos, &buffer[0], 1, info);
- if (status != 0)
- {
- return status;
- }
- pos++;
- (*info->fprintf_func) (info->stream, " #$%02x%s",
- buffer[0] & 0x0FF,
- (format & M6811_OP_JUMP_REL ? " " : ""));
- format &= ~M6811_OP_BITMASK;
- }
- if (format & M6811_OP_JUMP_REL)
- {
- int val;
-
- status = read_memory (memaddr + pos, &buffer[0], 1, info);
- if (status != 0)
- {
- return status;
- }
-
- pos++;
- val = (buffer[0] & 0x80) ? buffer[0] | 0xFFFFFF00 : buffer[0];
- (*info->print_address_func) (memaddr + pos + val, info);
- format &= ~M6811_OP_JUMP_REL;
- }
- else if (format & M6812_OP_JUMP_REL16)
- {
- int val;
-
- status = read_memory (memaddr + pos, &buffer[0], 2, info);
- if (status != 0)
- {
- return status;
- }
-
- pos += 2;
- val = ((buffer[0] << 8) | (buffer[1] & 0x0FF));
- if (val & 0x8000)
- val |= 0xffff0000;
-
- (*info->print_address_func) (memaddr + pos + val, info);
- format &= ~M6812_OP_JUMP_REL16;
- }
if (format & (M6811_OP_IMM16 | M6811_OP_IND16))
{
int val;
@@ -639,6 +590,56 @@ print_insn (memaddr, info, arch)
val = ((buffer[0] << 8) | (buffer[1] & 0x0FF));
val &= 0x0FFFF;
(*info->print_address_func) (val, info);
+ }
+
+ /* M6811_OP_BITMASK and M6811_OP_JUMP_REL must be treated separately
+ and in that order. The brset/brclr insn have a bitmask and then
+ a relative branch offset. */
+ if (format & M6811_OP_BITMASK)
+ {
+ status = read_memory (memaddr + pos, &buffer[0], 1, info);
+ if (status != 0)
+ {
+ return status;
+ }
+ pos++;
+ (*info->fprintf_func) (info->stream, " #$%02x%s",
+ buffer[0] & 0x0FF,
+ (format & M6811_OP_JUMP_REL ? " " : ""));
+ format &= ~M6811_OP_BITMASK;
+ }
+ if (format & M6811_OP_JUMP_REL)
+ {
+ int val;
+
+ status = read_memory (memaddr + pos, &buffer[0], 1, info);
+ if (status != 0)
+ {
+ return status;
+ }
+
+ pos++;
+ val = (buffer[0] & 0x80) ? buffer[0] | 0xFFFFFF00 : buffer[0];
+ (*info->print_address_func) (memaddr + pos + val, info);
+ format &= ~M6811_OP_JUMP_REL;
+ }
+ else if (format & M6812_OP_JUMP_REL16)
+ {
+ int val;
+
+ status = read_memory (memaddr + pos, &buffer[0], 2, info);
+ if (status != 0)
+ {
+ return status;
+ }
+
+ pos += 2;
+ val = ((buffer[0] << 8) | (buffer[1] & 0x0FF));
+ if (val & 0x8000)
+ val |= 0xffff0000;
+
+ (*info->print_address_func) (memaddr + pos + val, info);
+ format &= ~M6812_OP_JUMP_REL16;
}
if (format & M6812_OP_PAGE)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-13 9:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-13 2:05 [PATCH]: Fix Bug #1290: Disassembling of bclr is wrong for 68HC12 Stephane Carrez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).