/[qemu]/qemu/disas.c
ViewVC logotype

Diff of /qemu/disas.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by bellard, Tue Sep 30 20:57:29 2003 UTC revision 1.9 by bellard, Mon Oct 27 21:13:58 2003 UTC
# Line 5  Line 5 
5  #include "elf.h"  #include "elf.h"
6  #include <errno.h>  #include <errno.h>
7    
8    #include "cpu.h"
9    #include "exec-all.h"
10    
11  /* Filled in by elfload.c.  Simplistic, but will do for now. */  /* Filled in by elfload.c.  Simplistic, but will do for now. */
12  unsigned int disas_num_syms;  unsigned int disas_num_syms;
13  void *disas_symtab;  void *disas_symtab;
# Line 19  buffer_read_memory (memaddr, myaddr, len Line 22  buffer_read_memory (memaddr, myaddr, len
22       int length;       int length;
23       struct disassemble_info *info;       struct disassemble_info *info;
24  {  {
25    if (memaddr < info->buffer_vma      if (memaddr < info->buffer_vma
26        || memaddr + length > info->buffer_vma + info->buffer_length)          || memaddr + length > info->buffer_vma + info->buffer_length)
27      /* Out of bounds.  Use EIO because GDB uses it.  */          /* Out of bounds.  Use EIO because GDB uses it.  */
28      return EIO;          return EIO;
29    memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);      memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
30    return 0;      return 0;
31  }  }
32    
33    #if !defined(CONFIG_USER_ONLY)
34    /* Get LENGTH bytes from info's buffer, at target address memaddr.
35       Transfer them to myaddr.  */
36    static int
37    target_read_memory (memaddr, myaddr, length, info)
38         bfd_vma memaddr;
39         bfd_byte *myaddr;
40         int length;
41         struct disassemble_info *info;
42    {
43        int i;
44        for(i = 0; i < length; i++) {
45            myaddr[i] = ldub_code((void *)((long)memaddr));
46        }
47        return 0;
48    }
49    #endif
50    
51  /* Print an error message.  We can assume that this is in response to  /* Print an error message.  We can assume that this is in response to
52     an error return from buffer_read_memory.  */     an error return from buffer_read_memory.  */
53  void  void
# Line 103  void disas(FILE *out, void *code, unsign Line 124  void disas(FILE *out, void *code, unsign
124    
125      INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf);      INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf);
126    
127    #if !defined(CONFIG_USER_ONLY)
128        if (!is_host) {
129            disasm_info.read_memory_func = target_read_memory;
130        }
131    #endif
132    
133      disasm_info.buffer = code;      disasm_info.buffer = code;
134      disasm_info.buffer_vma = (unsigned long)code;      disasm_info.buffer_vma = (unsigned long)code;
135      disasm_info.buffer_length = size;      disasm_info.buffer_length = size;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26