Search
lxdream.org :: lxdream/src/xlat/xlatdasm.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/xlat/xlatdasm.h
changeset 1263:b3de98d19faf
prev1094:d2324eb67223
author nkeynes
date Wed Feb 04 08:38:23 2015 +1000 (9 years ago)
permissions -rw-r--r--
last change Fix assorted compile warnings reported by Clang
file annotate diff log raw
nkeynes@362
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@362
     3
 *
nkeynes@362
     4
 * Wrapper around i386-dis to supply the same behaviour as the other
nkeynes@362
     5
 * disassembly functions.
nkeynes@362
     6
 *
nkeynes@362
     7
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@362
     8
 *
nkeynes@362
     9
 * This program is free software; you can redistribute it and/or modify
nkeynes@362
    10
 * it under the terms of the GNU General Public License as published by
nkeynes@362
    11
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@362
    12
 * (at your option) any later version.
nkeynes@362
    13
 *
nkeynes@362
    14
 * This program is distributed in the hope that it will be useful,
nkeynes@362
    15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@362
    16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@362
    17
 * GNU General Public License for more details.
nkeynes@362
    18
 */
nkeynes@362
    19
nkeynes@476
    20
#include <stdio.h>
nkeynes@362
    21
#include "cpu.h"
nkeynes@362
    22
#include "mem.h"
nkeynes@1263
    23
extern const struct cpu_desc_struct xlat_cpu_desc;
nkeynes@362
    24
nkeynes@1263
    25
typedef struct xlat_symbol {
nkeynes@365
    26
    const char *name;
nkeynes@365
    27
    void *ptr;
nkeynes@1263
    28
} xlat_symbol;
nkeynes@365
    29
nkeynes@1263
    30
nkeynes@1263
    31
nkeynes@1263
    32
/**
nkeynes@1263
    33
 * Dump the disassembly of the specified code block to a stream
nkeynes@1263
    34
 * (primarily for debugging purposes)
nkeynes@1263
    35
 * @param out The stream to write the output to
nkeynes@1263
    36
 * @param code a translated block
nkeynes@1263
    37
 */
nkeynes@1263
    38
void xlat_disasm_block( FILE *out, void *code );
nkeynes@1263
    39
nkeynes@1263
    40
/**
nkeynes@1263
    41
 * Disassemble one host instruction
nkeynes@1263
    42
 * @param pc Instruction to disassemble
nkeynes@1263
    43
 * @param buf buffer to hold the disassembled instruction
nkeynes@1263
    44
 * @param len sizeof buf
nkeynes@1263
    45
 * @param opcode buffer to hold the raw opcodes for the instruction (must be at least
nkeynes@1263
    46
 *    3 * maximum number of instruction bytes)
nkeynes@1263
    47
 * @return next pc after the current instruction
nkeynes@1263
    48
 */
nkeynes@1263
    49
uintptr_t xlat_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode );
nkeynes@1263
    50
nkeynes@1263
    51
void xlat_disasm_region( FILE *out, void *block, uint32_t len );
nkeynes@1263
    52
void xlat_disasm_init( xlat_symbol *symtab, int num_symbols );
nkeynes@1263
    53
uintptr_t xlat_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode );
nkeynes@1263
    54
nkeynes@1263
    55
void xlat_print_symbolic_operand( char *buf, int hex, uintptr_t disp );
.