1 /* This file is part of the program psim.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 #include "registers.h"
31 #include "device_tree.h"
35 #include "interrupts.h"
41 #include "function_unit.h"
44 /* typedef struct _cpu cpu;
46 Declared in basics.h because it is used opaquely throughout the
50 /* Create a cpu object */
52 INLINE_CPU cpu *cpu_create
59 INLINE_CPU void cpu_init
62 /* Find our way home */
64 INLINE_CPU psim *cpu_system
67 INLINE_CPU cpu_mon *cpu_monitor
73 INLINE_CPU event_queue *cpu_event_queue
77 /* The processors local concept of time */
79 INLINE_CPU signed64 cpu_get_time_base
82 INLINE_CPU void cpu_set_time_base
86 INLINE_CPU signed32 cpu_get_decrementer
89 INLINE_CPU void cpu_set_decrementer
91 signed32 decrementer);
94 /* manipulate the program counter
96 The program counter is not included in the register file. Instead
97 it is extracted and then later restored (set, reset, halt). This
98 is to give the user of the cpu (and the compiler) the chance to
99 minimize the need to load/store the cpu's PC value. (Especially in
100 the case of a single processor) */
102 INLINE_CPU void cpu_set_program_counter
104 unsigned_word new_program_counter);
106 INLINE_CPU unsigned_word cpu_get_program_counter
109 INLINE_CPU void cpu_restart
113 INLINE_CPU void cpu_halt
120 #if WITH_IDECODE_CACHE_SIZE
121 /* Return the cache entry that matches the given CIA. No guarentee
122 that the cache entry actually contains the instruction for that
125 INLINE_CPU idecode_cache *cpu_icache_entry
129 INLINE_CPU void cpu_flush_icache
134 /* reveal the processors VM:
136 At first sight it may seem better to, instead of exposing the cpu's
137 inner vm maps, to have the cpu its self provide memory manipulation
138 functions. (eg cpu_instruction_fetch() cpu_data_read_4())
140 Unfortunatly in addition to these functions is the need (for the
141 debugger) to be able to read/write to memory in ways that violate
142 the vm protection (eg store breakpoint instruction in the
145 INLINE_CPU vm_data_map *cpu_data_map
148 INLINE_CPU vm_instruction_map *cpu_instruction_map
152 /* grant access to the reservation information */
153 typedef struct _memory_reservation {
157 } memory_reservation;
159 INLINE_CPU memory_reservation *cpu_reservation
163 INLINE_CPU void cpu_print_info
170 This model exploits the PowerPC's requirement for a synchronization
171 to occure after (or before) the update of any context controlling
172 register. All context sync points must call the sync function
173 below to when ever a synchronization point is reached */
175 INLINE_CPU registers *cpu_registers
178 INLINE_CPU void cpu_synchronize_context
181 INLINE_CPU function_unit *cpu_function_unit
184 INLINE_CPU model_data *cpu_model
187 #define IS_PROBLEM_STATE(PROCESSOR) \
188 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
189 ? (cpu_registers(PROCESSOR)->msr & msr_problem_state) \
192 #define IS_64BIT_MODE(PROCESSOR) \
193 (WITH_TARGET_WORD_BITSIZE == 64 \
194 ? (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
195 ? (cpu_registers(PROCESSOR)->msr & msr_64bit_mode) \
199 #define IS_FP_AVAILABLE(PROCESSOR) \
200 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
201 ? (cpu_registers(PROCESSOR)->msr & msr_floating_point_available) \