Search
lxdream.org :: lxdream/src/cpu.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/cpu.h
changeset 30:89b30313d757
prev14:fc481a638848
next43:0cf3e339cc59
author nkeynes
date Mon Dec 26 10:48:45 2005 +0000 (18 years ago)
permissions -rw-r--r--
last change Remove default MMIO trace
view annotate diff log raw
     1 /**
     2  * $Id: cpu.h,v 1.6 2005-12-25 05:56:55 nkeynes Exp $
     3  * 
     4  * Generic CPU definitions, primarily for providing information to the GUI.
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #ifndef dream_cpu_H
    20 #define dream_cpu_H 1
    22 #include <stdint.h>
    23 #include <stdlib.h>
    24 #include <glib/gtypes.h>
    26 #ifdef __cplusplus
    27 extern "C" {
    28 #endif
    30 /**
    31  * Disassembly function pointer typedef.
    32  *
    33  * @param pc Address to disassemble
    34  * @param buffer String buffer to write disassembly into
    35  * @param buflen Maximum length of buffer
    36  * @return next address to disassemble
    37  */
    38 typedef uint32_t (*disasm_func_t)(uint32_t pc, char *buffer, int buflen, char *opcode );
    40 typedef int (*is_valid_page_t)(uint32_t pc);
    41 typedef gboolean (*step_func_t)();
    43 #define REG_INT 0
    44 #define REG_FLT 1
    45 #define REG_SPECIAL 2
    47 /**
    48  * Structure that defines a single register in a CPU for display purposes.
    49  */
    50 typedef struct reg_desc_struct {
    51     char *name;
    52     int type;
    53     void *value;
    54 } reg_desc_t;
    56 /**
    57  * CPU definition structure - basic information and support functions.
    58  */
    59 typedef struct cpu_desc_struct {
    60   char *name; /* CPU Name */
    61   disasm_func_t disasm_func; /* Disassembly function */
    62   step_func_t step_func; /* Single step function */
    63   is_valid_page_t is_valid_page_func; /* Test for valid memory page */
    64   size_t instr_size; /* Size of instruction */
    65   char *regs; /* Pointer to start of registers */
    66   size_t regs_size; /* Size of register structure in bytes */
    67   const struct reg_desc_struct *regs_info; /* Description of all registers */
    68   uint32_t *pc; /* Pointer to PC register */
    69   uint32_t *icount; /* Pointer to instruction counter */
    70 } *cpu_desc_t;
    72 #ifdef __cplusplus
    73 }
    74 #endif
    76 #endif /* !dream_cpu_H */
.