run copyright.sh for 2011.
[deliverable/binutils-gdb.git] / sim / common / cgen-cpu.h
CommitLineData
c906108c 1/* Simulator header for cgen cpus.
7b6bb8da 2 Copyright (C) 1998, 1999, 2007, 2008, 2009, 2010, 2011
dc3cf14f 3 Free Software Foundation, Inc.
c906108c
SS
4 Contributed by Cygnus Support.
5
6This file is part of GDB, the GNU debugger.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
4744ac1b
JB
10the Free Software Foundation; either version 3 of the License, or
11(at your option) any later version.
c906108c
SS
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
4744ac1b
JB
18You should have received a copy of the GNU General Public License
19along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
20
21#ifndef CGEN_CPU_H
22#define CGEN_CPU_H
23
24/* Type of function that is ultimately called by sim_resume. */
25typedef void (ENGINE_FN) (SIM_CPU *);
26
27/* Type of function to do disassembly. */
28typedef void (CGEN_DISASSEMBLER) (SIM_CPU *, const CGEN_INSN *,
29 const ARGBUF *, IADDR pc_, char *buf_);
30
31/* Additional non-machine generated per-cpu data to go in SIM_CPU.
32 The member's name must be `cgen_cpu'. */
33
34typedef struct {
35 /* Non-zero while cpu simulation is running. */
36 int running_p;
37#define CPU_RUNNING_P(cpu) ((cpu)->cgen_cpu.running_p)
38
39 /* Instruction count. This is maintained even in fast mode to keep track
40 of simulator speed. */
41 unsigned long insn_count;
42#define CPU_INSN_COUNT(cpu) ((cpu)->cgen_cpu.insn_count)
43
44 /* sim_resume handlers */
45 ENGINE_FN *fast_engine_fn;
46#define CPU_FAST_ENGINE_FN(cpu) ((cpu)->cgen_cpu.fast_engine_fn)
47 ENGINE_FN *full_engine_fn;
48#define CPU_FULL_ENGINE_FN(cpu) ((cpu)->cgen_cpu.full_engine_fn)
49
50 /* Maximum number of instructions per time slice.
51 When single stepping this is 1. If using the pbb model, this can be
52 more than 1. 0 means "as long as you want". */
53 unsigned int max_slice_insns;
54#define CPU_MAX_SLICE_INSNS(cpu) ((cpu)->cgen_cpu.max_slice_insns)
55
56 /* Simulator's execution cache.
57 Allocate space for this even if not used as some simulators may have
58 one machine variant that uses the scache and another that doesn't and
59 we don't want members in this struct to move about. */
60 CPU_SCACHE scache;
61
62 /* Instruction descriptor table. */
63 IDESC *idesc;
64#define CPU_IDESC(cpu) ((cpu)->cgen_cpu.idesc)
65
96baa820
JM
66 /* Whether the read,write,semantic entries (function pointers or computed
67 goto labels) have been initialized or not. */
c906108c
SS
68 int idesc_read_init_p;
69#define CPU_IDESC_READ_INIT_P(cpu) ((cpu)->cgen_cpu.idesc_read_init_p)
70 int idesc_write_init_p;
71#define CPU_IDESC_WRITE_INIT_P(cpu) ((cpu)->cgen_cpu.idesc_write_init_p)
72 int idesc_sem_init_p;
73#define CPU_IDESC_SEM_INIT_P(cpu) ((cpu)->cgen_cpu.idesc_sem_init_p)
74
75 /* Cpu descriptor table.
76 This is a CGEN created entity that contains the description file
77 turned into C code and tables for our use. */
78 CGEN_CPU_DESC cpu_desc;
79#define CPU_CPU_DESC(cpu) ((cpu)->cgen_cpu.cpu_desc)
80
81 /* Function to fetch the insn data entry in the IDESC. */
82 const CGEN_INSN * (*get_idata) (SIM_CPU *, int);
83#define CPU_GET_IDATA(cpu) ((cpu)->cgen_cpu.get_idata)
84
43ff13b4
JM
85 /* Floating point support. */
86 CGEN_FPU fpu;
87#define CGEN_CPU_FPU(cpu) (& (cpu)->cgen_cpu.fpu)
88
c906108c
SS
89 /* Disassembler. */
90 CGEN_DISASSEMBLER *disassembler;
91#define CPU_DISASSEMBLER(cpu) ((cpu)->cgen_cpu.disassembler)
92
d4f3574e
SS
93 /* Queued writes for parallel write-after support. */
94 CGEN_WRITE_QUEUE write_queue;
95#define CPU_WRITE_QUEUE(cpu) (& (cpu)->cgen_cpu.write_queue)
96
c906108c
SS
97 /* Allow slop in size calcs for case where multiple cpu types are supported
98 and space for the specified cpu is malloc'd at run time. */
99 double slop;
100} CGEN_CPU;
101
102/* Shorthand macro for fetching registers.
103 CPU_CGEN_HW is defined in cpu.h. */
104#define CPU(x) (CPU_CGEN_HW (current_cpu)->x)
105
106#endif /* CGEN_CPU_H */
This page took 0.486597 seconds and 4 git commands to generate.