Search
lxdream.org :: lxdream/src/cpu.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cpu.h
changeset 9:2784c7660165
next10:c898b37506e0
author nkeynes
date Thu Dec 08 13:38:00 2005 +0000 (13 years ago)
permissions -rw-r--r--
last change Generalise the core debug window to allow multiple instances.
Add cpu description structure to define different cpus for use by the
debug window, in preparation for ARM implementation
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/cpu.h Thu Dec 08 13:38:00 2005 +0000
1.3 @@ -0,0 +1,50 @@
1.4 +
1.5 +#ifndef dream_disasm_H
1.6 +#define dream_disasm_H 1
1.7 +
1.8 +#include <stdlib.h>
1.9 +
1.10 +#ifdef __cplusplus
1.11 +extern "C" {
1.12 +#endif
1.13 +
1.14 +/**
1.15 + * Disassembly function pointer typedef.
1.16 + *
1.17 + * @param pc Address to disassemble
1.18 + * @param buffer String buffer to write disassembly into
1.19 + * @param buflen Maximum length of buffer
1.20 + * @return next address to disassemble
1.21 + */
1.22 +typedef int (*disasm_func_t)(uint32_t pc, char *buffer, int buflen );
1.23 +
1.24 +#define REG_INT 0
1.25 +#define REG_FLT 1
1.26 +#define REG_SPECIAL 2
1.27 +
1.28 +/**
1.29 + * Structure that defines a single register in a CPU for display purposes.
1.30 + */
1.31 +typedef struct reg_desc_struct {
1.32 + char *name;
1.33 + int type;
1.34 + void *value;
1.35 +} reg_desc_t;
1.36 +
1.37 +typedef struct cpu_desc_struct {
1.38 + char *name; /* CPU Name */
1.39 + disasm_func_t disasm_func; /* Disassembly function */
1.40 + size_t instr_size; /* Size of instruction */
1.41 + char *regs; /* Pointer to start of registers */
1.42 + size_t regs_size; /* Size of register structure in bytes */
1.43 + struct reg_desc_struct *regs_info; /* Description of all registers */
1.44 + uint32_t *pc; /* Pointer to PC register */
1.45 + uint32_t *icount; /* Pointer to instruction counter */
1.46 + /* Memory map? */
1.47 +} *cpu_desc_t;
1.48 +
1.49 +#ifdef __cplusplus
1.50 +}
1.51 +#endif
1.52 +
1.53 +#endif /* !dream_disasm_H */
.