[sim]
[deliverable/binutils-gdb.git] / sim / rl78 / cpu.h
1 /* cpu.h --- declarations for the RL78 core.
2
3 Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
5 Contributed by Red Hat, Inc.
6
7 This file is part of the GNU simulators.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 #ifndef SIM_RL78_CPU_H_
24 #define SIM_RL78_CPU_H_
25
26 #include <stdint.h>
27 #include <setjmp.h>
28
29 #include "opcode/rl78.h"
30
31 extern int verbose;
32 extern int trace;
33
34 typedef uint8_t QI;
35 typedef uint16_t HI;
36 typedef uint32_t SI;
37
38 extern int rl78_in_gdb;
39
40 SI get_reg (RL78_Register);
41 SI set_reg (RL78_Register, SI);
42
43 SI pc;
44
45
46 extern const char * const reg_names[];
47
48 void init_cpu (void);
49 void set_flags (int mask, int newbits);
50 void set_c (int c);
51 int get_c (void);
52
53 const char *bits (int v, int b);
54
55 int condition_true (RL78_Condition cond_id, int val);
56
57 /* Instruction step return codes.
58 Suppose one of the decode_* functions below returns a value R:
59 - If RL78_STEPPED (R), then the single-step completed normally.
60 - If RL78_HIT_BREAK (R), then the program hit a breakpoint.
61 - If RL78_EXITED (R), then the program has done an 'exit' system
62 call, and the exit code is RL78_EXIT_STATUS (R).
63 - If RL78_STOPPED (R), then a signal (number RL78_STOP_SIG (R)) was
64 generated.
65
66 For building step return codes:
67 - RL78_MAKE_STEPPED is the return code for finishing a normal step.
68 - RL78_MAKE_HIT_BREAK is the return code for hitting a breakpoint.
69 - RL78_MAKE_EXITED (C) is the return code for exiting with status C.
70 - RL78_MAKE_STOPPED (S) is the return code for stopping on signal S. */
71 #define RL78_MAKE_STEPPED() (1)
72 #define RL78_MAKE_HIT_BREAK() (2)
73 #define RL78_MAKE_EXITED(c) (((int) (c) << 8) + 3)
74 #define RL78_MAKE_STOPPED(s) (((int) (s) << 8) + 4)
75
76 #define RL78_STEPPED(r) ((r) == RL78_MAKE_STEPPED ())
77 #define RL78_HIT_BREAK(r) ((r) == RL78_MAKE_HIT_BREAK ())
78 #define RL78_EXITED(r) (((r) & 0xff) == 3)
79 #define RL78_EXIT_STATUS(r) ((r) >> 8)
80 #define RL78_STOPPED(r) (((r) & 0xff) == 4)
81 #define RL78_STOP_SIG(r) ((r) >> 8)
82
83 /* The step result for the current step. Global to allow
84 communication between the stepping function and the system
85 calls. */
86 extern int step_result;
87
88 extern int decode_opcode (void);
89
90 extern int trace_register_words;
91 extern void trace_register_changes (void);
92 extern void generate_access_exception (void);
93 extern jmp_buf decode_jmp_buf;
94
95 extern long long total_clocks;
96 extern int pending_clocks;
97 extern int timer_enabled;
98 extern void dump_counts_per_insn (const char * filename);
99 extern unsigned int counts_per_insn[0x100000];
100
101 #endif
This page took 0.070609 seconds and 5 git commands to generate.