Search
lxdream.org :: lxdream/src/cpu.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/cpu.h
changeset 13:28aea89fb9c6
prev11:0a82ef380c45
next14:fc481a638848
author nkeynes
date Mon Dec 12 10:09:24 2005 +0000 (15 years ago)
permissions -rw-r--r--
last change Fix a few minor arm dasm issues
file annotate diff log raw
nkeynes@9
     1
nkeynes@9
     2
#ifndef dream_disasm_H
nkeynes@9
     3
#define dream_disasm_H 1
nkeynes@9
     4
nkeynes@9
     5
#include <stdlib.h>
nkeynes@9
     6
nkeynes@9
     7
#ifdef __cplusplus
nkeynes@9
     8
extern "C" {
nkeynes@9
     9
#endif
nkeynes@9
    10
nkeynes@9
    11
/**
nkeynes@9
    12
 * Disassembly function pointer typedef.
nkeynes@9
    13
 *
nkeynes@9
    14
 * @param pc Address to disassemble
nkeynes@9
    15
 * @param buffer String buffer to write disassembly into
nkeynes@9
    16
 * @param buflen Maximum length of buffer
nkeynes@9
    17
 * @return next address to disassemble
nkeynes@9
    18
 */
nkeynes@11
    19
typedef uint32_t (*disasm_func_t)(uint32_t pc, char *buffer, int buflen, char *opcode );
nkeynes@11
    20
nkeynes@11
    21
typedef int (*is_valid_page_t)(uint32_t pc);
nkeynes@9
    22
nkeynes@9
    23
#define REG_INT 0
nkeynes@9
    24
#define REG_FLT 1
nkeynes@9
    25
#define REG_SPECIAL 2
nkeynes@9
    26
nkeynes@9
    27
/**
nkeynes@9
    28
 * Structure that defines a single register in a CPU for display purposes.
nkeynes@9
    29
 */
nkeynes@9
    30
typedef struct reg_desc_struct {
nkeynes@9
    31
    char *name;
nkeynes@9
    32
    int type;
nkeynes@9
    33
    void *value;
nkeynes@9
    34
} reg_desc_t;
nkeynes@9
    35
nkeynes@9
    36
typedef struct cpu_desc_struct {
nkeynes@9
    37
  char *name; /* CPU Name */
nkeynes@9
    38
  disasm_func_t disasm_func; /* Disassembly function */
nkeynes@9
    39
  size_t instr_size; /* Size of instruction */
nkeynes@9
    40
  char *regs; /* Pointer to start of registers */
nkeynes@9
    41
  size_t regs_size; /* Size of register structure in bytes */
nkeynes@13
    42
  const struct reg_desc_struct *regs_info; /* Description of all registers */
nkeynes@9
    43
  uint32_t *pc; /* Pointer to PC register */
nkeynes@9
    44
  uint32_t *icount; /* Pointer to instruction counter */
nkeynes@9
    45
  /* Memory map? */
nkeynes@11
    46
    is_valid_page_t valid_page_func; /* Test for valid memory page */
nkeynes@9
    47
} *cpu_desc_t;
nkeynes@9
    48
nkeynes@9
    49
#ifdef __cplusplus
nkeynes@9
    50
}
nkeynes@9
    51
#endif
nkeynes@9
    52
nkeynes@9
    53
#endif /* !dream_disasm_H */
.