Search
lxdream.org :: lxdream/src/x86dasm/x86dasm.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/x86dasm/x86dasm.c
changeset 376:8c7587af5a5d
prev365:94cab5ad0ed8
next429:e581b90c3fb3
author nkeynes
date Wed Sep 12 09:16:47 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Add disassembly dump function to xltcache
file annotate diff log raw
1.1 --- a/src/x86dasm/x86dasm.c Tue Sep 04 08:32:10 2007 +0000
1.2 +++ b/src/x86dasm/x86dasm.c Wed Sep 12 09:16:47 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: x86dasm.c,v 1.2 2007-09-04 08:32:10 nkeynes Exp $
1.6 + * $Id: x86dasm.c,v 1.3 2007-09-12 09:16:47 nkeynes Exp $
1.7 *
1.8 * Wrapper around i386-dis to supply the same behaviour as the other
1.9 * disassembly functions.
1.10 @@ -40,6 +40,20 @@
1.11 static x86_symbol *x86_symtab;
1.12 static int x86_num_symbols = 0;
1.13
1.14 +void x86_disasm_block(FILE *out, void *start, uint32_t len)
1.15 +{
1.16 + uint32_t start_addr = (uint32_t)start;
1.17 + uint32_t pc;
1.18 + x86_disasm_init( start, start_addr, len );
1.19 + for( pc = start_addr; pc < start_addr + len; ) {
1.20 + char buf[256];
1.21 + char op[256];
1.22 + uint32_t pc2 = x86_disasm_instruction( pc, buf, sizeof(buf), op );
1.23 + fprintf( out, "%08X: %-20s %s\n", pc, op, buf );
1.24 + pc = pc2;
1.25 + }
1.26 +}
1.27 +
1.28 void x86_disasm_init(char *buf, uint32_t vma, int buflen)
1.29 {
1.30 init_disassemble_info( &x86_disasm_info, NULL, x86_disasm_output );
.