Search
lxdream.org :: lxdream/src/xlat/xlatdasm.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/xlat/xlatdasm.h
changeset 1263:b3de98d19faf
prev1094:d2324eb67223
author nkeynes
date Tue Mar 06 09:04:34 2012 +1000 (12 years ago)
permissions -rw-r--r--
last change Break host disassembly bits out of sh4x86.in, and move the generic disasm
bits from x86dasm to xlat.
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/xlat/xlatdasm.h Tue Mar 06 09:04:34 2012 +1000
1.3 @@ -0,0 +1,55 @@
1.4 +/**
1.5 + * $Id$
1.6 + *
1.7 + * Wrapper around i386-dis to supply the same behaviour as the other
1.8 + * disassembly functions.
1.9 + *
1.10 + * Copyright (c) 2005 Nathan Keynes.
1.11 + *
1.12 + * This program is free software; you can redistribute it and/or modify
1.13 + * it under the terms of the GNU General Public License as published by
1.14 + * the Free Software Foundation; either version 2 of the License, or
1.15 + * (at your option) any later version.
1.16 + *
1.17 + * This program is distributed in the hope that it will be useful,
1.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.20 + * GNU General Public License for more details.
1.21 + */
1.22 +
1.23 +#include <stdio.h>
1.24 +#include "cpu.h"
1.25 +#include "mem.h"
1.26 +extern const struct cpu_desc_struct xlat_cpu_desc;
1.27 +
1.28 +typedef struct xlat_symbol {
1.29 + const char *name;
1.30 + void *ptr;
1.31 +} xlat_symbol;
1.32 +
1.33 +
1.34 +
1.35 +/**
1.36 + * Dump the disassembly of the specified code block to a stream
1.37 + * (primarily for debugging purposes)
1.38 + * @param out The stream to write the output to
1.39 + * @param code a translated block
1.40 + */
1.41 +void xlat_disasm_block( FILE *out, void *code );
1.42 +
1.43 +/**
1.44 + * Disassemble one host instruction
1.45 + * @param pc Instruction to disassemble
1.46 + * @param buf buffer to hold the disassembled instruction
1.47 + * @param len sizeof buf
1.48 + * @param opcode buffer to hold the raw opcodes for the instruction (must be at least
1.49 + * 3 * maximum number of instruction bytes)
1.50 + * @return next pc after the current instruction
1.51 + */
1.52 +uintptr_t xlat_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode );
1.53 +
1.54 +void xlat_disasm_region( FILE *out, void *block, uint32_t len );
1.55 +void xlat_disasm_init( xlat_symbol *symtab, int num_symbols );
1.56 +uintptr_t xlat_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode );
1.57 +
1.58 +void xlat_print_symbolic_operand( char *buf, int hex, uintptr_t disp );
.