Search
lxdream.org :: lxdream/src/cpu.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/cpu.h
changeset 736:a02d1475ccfd
prev586:2a3ba82cf243
next998:1754a8c6a9cf
author nkeynes
date Wed Nov 05 10:05:08 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Fix (extremely boneheaded) failure to convert pc to physical address before
storing in the translation cache (in other words, the translation cache was
effectively disabled for MMU code). MMU code is now about 3 times faster...
view annotate diff log raw
     1 /**
     2  * $Id$
     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 lxdream_cpu_H
    20 #define lxdream_cpu_H 1
    22 #include "lxdream.h"
    23 #include "mem.h"
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    29 /**
    30  * Disassembly function pointer typedef.
    31  *
    32  * @param pc Address to disassemble
    33  * @param buffer String buffer to write disassembly into
    34  * @param buflen Maximum length of buffer
    35  * @return next address to disassemble
    36  */
    37 typedef uint32_t (*disasm_func_t)(uint32_t pc, char *buffer, int buflen, char *opcode );
    39 #define REG_INT 0
    40 #define REG_FLT 1
    41 #define REG_SPECIAL 2
    43 /**
    44  * Structure that defines a single register in a CPU for display purposes.
    45  */
    46 typedef struct reg_desc_struct {
    47     char *name;
    48     int type;
    49     void *value;
    50 } reg_desc_t;
    52 /**
    53  * CPU definition structure - basic information and support functions.
    54  */
    55 typedef struct cpu_desc_struct {
    56     char *name; /* CPU Name */
    57     disasm_func_t disasm_func; /* Disassembly function */
    58     gboolean (*step_func)(); /* Single step function */
    59     int (*is_valid_page_func)(uint32_t); /* Test for valid memory page */
    60     void (*set_breakpoint)(uint32_t, breakpoint_type_t);
    61     gboolean (*clear_breakpoint)(uint32_t, breakpoint_type_t);
    62     int (*get_breakpoint)(uint32_t);
    63     size_t instr_size; /* Size of instruction */
    64     char *regs; /* Pointer to start of registers */
    65     size_t regs_size; /* Size of register structure in bytes */
    66     const struct reg_desc_struct *regs_info; /* Description of all registers */
    67     uint32_t *pc; /* Pointer to PC register */
    68 } const *cpu_desc_t;
    70 #ifdef __cplusplus
    71 }
    72 #endif
    74 #endif /* !lxdream_cpu_H */
.