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 Oct 29 23:51:58 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Use regparam calling conventions for all functions called from translated code,
along with a few other high-use functions. Can probably extend this to all functions,
but as it is this is a nice performance boost
file annotate diff log raw
nkeynes@30
     1
/**
nkeynes@586
     2
 * $Id$
nkeynes@30
     3
 * 
nkeynes@30
     4
 * Generic CPU definitions, primarily for providing information to the GUI.
nkeynes@30
     5
 *
nkeynes@30
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@30
     7
 *
nkeynes@30
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@30
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@30
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@30
    11
 * (at your option) any later version.
nkeynes@30
    12
 *
nkeynes@30
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@30
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@30
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@30
    16
 * GNU General Public License for more details.
nkeynes@30
    17
 */
nkeynes@9
    18
nkeynes@736
    19
#ifndef lxdream_cpu_H
nkeynes@736
    20
#define lxdream_cpu_H 1
nkeynes@9
    21
nkeynes@586
    22
#include "lxdream.h"
nkeynes@586
    23
#include "mem.h"
nkeynes@9
    24
nkeynes@9
    25
#ifdef __cplusplus
nkeynes@9
    26
extern "C" {
nkeynes@9
    27
#endif
nkeynes@9
    28
nkeynes@9
    29
/**
nkeynes@9
    30
 * Disassembly function pointer typedef.
nkeynes@9
    31
 *
nkeynes@9
    32
 * @param pc Address to disassemble
nkeynes@9
    33
 * @param buffer String buffer to write disassembly into
nkeynes@9
    34
 * @param buflen Maximum length of buffer
nkeynes@9
    35
 * @return next address to disassemble
nkeynes@9
    36
 */
nkeynes@11
    37
typedef uint32_t (*disasm_func_t)(uint32_t pc, char *buffer, int buflen, char *opcode );
nkeynes@11
    38
nkeynes@9
    39
#define REG_INT 0
nkeynes@9
    40
#define REG_FLT 1
nkeynes@9
    41
#define REG_SPECIAL 2
nkeynes@9
    42
nkeynes@9
    43
/**
nkeynes@9
    44
 * Structure that defines a single register in a CPU for display purposes.
nkeynes@9
    45
 */
nkeynes@9
    46
typedef struct reg_desc_struct {
nkeynes@9
    47
    char *name;
nkeynes@9
    48
    int type;
nkeynes@9
    49
    void *value;
nkeynes@9
    50
} reg_desc_t;
nkeynes@9
    51
nkeynes@30
    52
/**
nkeynes@30
    53
 * CPU definition structure - basic information and support functions.
nkeynes@30
    54
 */
nkeynes@9
    55
typedef struct cpu_desc_struct {
nkeynes@43
    56
    char *name; /* CPU Name */
nkeynes@43
    57
    disasm_func_t disasm_func; /* Disassembly function */
nkeynes@43
    58
    gboolean (*step_func)(); /* Single step function */
nkeynes@43
    59
    int (*is_valid_page_func)(uint32_t); /* Test for valid memory page */
nkeynes@586
    60
    void (*set_breakpoint)(uint32_t, breakpoint_type_t);
nkeynes@586
    61
    gboolean (*clear_breakpoint)(uint32_t, breakpoint_type_t);
nkeynes@43
    62
    int (*get_breakpoint)(uint32_t);
nkeynes@43
    63
    size_t instr_size; /* Size of instruction */
nkeynes@43
    64
    char *regs; /* Pointer to start of registers */
nkeynes@43
    65
    size_t regs_size; /* Size of register structure in bytes */
nkeynes@43
    66
    const struct reg_desc_struct *regs_info; /* Description of all registers */
nkeynes@43
    67
    uint32_t *pc; /* Pointer to PC register */
nkeynes@429
    68
} const *cpu_desc_t;
nkeynes@9
    69
nkeynes@9
    70
#ifdef __cplusplus
nkeynes@9
    71
}
nkeynes@9
    72
#endif
nkeynes@9
    73
nkeynes@736
    74
#endif /* !lxdream_cpu_H */
.