mirror of https://gitee.com/openkylin/qemu.git
added correct memory access code for system emulation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@407 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
93a40ea926
commit
c6105c0a04
27
disas.c
27
disas.c
|
@ -5,6 +5,9 @@
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "exec-all.h"
|
||||||
|
|
||||||
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
||||||
unsigned int disas_num_syms;
|
unsigned int disas_num_syms;
|
||||||
void *disas_symtab;
|
void *disas_symtab;
|
||||||
|
@ -27,6 +30,24 @@ buffer_read_memory (memaddr, myaddr, length, info)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
/* Get LENGTH bytes from info's buffer, at target address memaddr.
|
||||||
|
Transfer them to myaddr. */
|
||||||
|
static int
|
||||||
|
target_read_memory (memaddr, myaddr, length, info)
|
||||||
|
bfd_vma memaddr;
|
||||||
|
bfd_byte *myaddr;
|
||||||
|
int length;
|
||||||
|
struct disassemble_info *info;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < length; i++) {
|
||||||
|
myaddr[i] = ldub_code((void *)((long)memaddr));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 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
|
||||||
an error return from buffer_read_memory. */
|
an error return from buffer_read_memory. */
|
||||||
void
|
void
|
||||||
|
@ -103,6 +124,12 @@ void disas(FILE *out, void *code, unsigned long size, int is_host, int flags)
|
||||||
|
|
||||||
INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf);
|
INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
if (!is_host) {
|
||||||
|
disasm_info.read_memory_func = target_read_memory;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
disasm_info.buffer = code;
|
disasm_info.buffer = code;
|
||||||
disasm_info.buffer_vma = (unsigned long)code;
|
disasm_info.buffer_vma = (unsigned long)code;
|
||||||
disasm_info.buffer_length = size;
|
disasm_info.buffer_length = size;
|
||||||
|
|
Loading…
Reference in New Issue