ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mon/src/mon_disass.cpp
(Generate patch)

Comparing mon/src/mon_disass.cpp (file contents):
Revision 1.10 by gbeauche, 2004-06-14T14:23:59Z vs.
Revision 1.11 by gbeauche, 2007-06-07T09:51:56Z

# Line 20 | Line 20
20  
21   #include "sysdeps.h"
22  
23 + #include <assert.h>
24   #include <stdarg.h>
25  
26   #include "mon.h"
# Line 168 | Line 169 | int disass_68k(FILE *f, uint32 adr)
169  
170          return num;
171   }
172 +
173 + int disass_mips(FILE *f, uint32 adr, int little_endian)
174 + {
175 +        // Initialize info for GDB disassembler
176 +        disassemble_info info;
177 +        char buf[1024];
178 +        SFILE sfile = {buf, buf};
179 +        sfile.buffer = buf;
180 +        sfile.current = buf;
181 +        INIT_DISASSEMBLE_INFO(info, (FILE *)&sfile, (fprintf_ftype)mon_sprintf);
182 +
183 +        // Disassemble instruction
184 +        lookup_lowmem = false;
185 +        int num = little_endian ? print_insn_little_mips(adr, &info) : print_insn_big_mips(adr, &info);
186 +
187 +        assert(num == 4);
188 +        for (int i=0; i<4; i++)
189 +                fprintf(f, " %02x", mon_read_byte(adr + i));
190 +
191 +        fprintf(f, "  %s\n", buf);
192 +
193 +        return num;
194 + }
195  
196   int disass_x86(FILE *f, uint32 adr, uint32 bits)
197   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines