1 /* This file is part of the program psim.
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
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 3 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, see <http://www.gnu.org/licenses/>.
25 #include "registers.h"
30 #include "interrupts.h"
38 #include "libiberty.h"
40 #ifndef CONST_ATTRIBUTE
41 #define CONST_ATTRIBUTE __attribute__((__const__))
44 /* typedef struct _cpu cpu;
46 Declared in basics.h because it is used opaquely throughout the
50 /* Create a cpu object */
57 os_emul
*cpu_emulation
,
64 /* Find our way home */
68 (cpu
*processor
) CONST_ATTRIBUTE
;
71 (cpu_mon
*) cpu_monitor
72 (cpu
*processor
) CONST_ATTRIBUTE
;
75 (os_emul
*) cpu_os_emulation
80 (cpu
*processor
) CONST_ATTRIBUTE
;
83 /* manipulate the processors program counter and execution state.
85 The program counter is not included in the register file. Instead
86 it is extracted and then later restored (set, reset, halt). This
87 is to give the user of the cpu (and the compiler) the chance to
88 minimize the need to load/store the cpu's PC value. (Especially in
89 the case of a single processor) */
92 (void) cpu_set_program_counter
94 unsigned_word new_program_counter
);
97 (unsigned_word
) cpu_get_program_counter
117 ...) ATTRIBUTE_PRINTF_3
;
120 /* The processors local concept of time */
123 (int64_t) cpu_get_time_base
127 (void) cpu_set_time_base
132 (int32_t) cpu_get_decrementer
136 (void) cpu_set_decrementer
138 int32_t decrementer
);
141 #if WITH_IDECODE_CACHE_SIZE
142 /* Return the cache entry that matches the given CIA. No guarentee
143 that the cache entry actually contains the instruction for that
147 (idecode_cache
) *cpu_icache_entry
152 (void) cpu_flush_icache
157 /* reveal the processors VM:
159 At first sight it may seem better to, instead of exposing the cpu's
160 inner vm maps, to have the cpu its self provide memory manipulation
161 functions. (eg cpu_instruction_fetch() cpu_data_read_4())
163 Unfortunatly in addition to these functions is the need (for the
164 debugger) to be able to read/write to memory in ways that violate
165 the vm protection (eg store breakpoint instruction in the
169 (vm_data_map
*) cpu_data_map
173 (vm_instruction_map
*) cpu_instruction_map
177 (void) cpu_page_tlb_invalidate_entry
182 (void) cpu_page_tlb_invalidate_all
186 /* reveal the processors interrupt state */
189 (interrupts
*) cpu_interrupts
193 /* grant access to the reservation information */
195 typedef struct _memory_reservation
{
199 } memory_reservation
;
202 (memory_reservation
*) cpu_reservation
208 This model exploits the PowerPC's requirement for a synchronization
209 to occure after (or before) the update of any context controlling
210 register. All context sync points must call the sync function
211 below to when ever a synchronization point is reached */
214 (registers
*) cpu_registers
215 (cpu
*processor
) CONST_ATTRIBUTE
;
218 (void) cpu_synchronize_context
222 #define IS_PROBLEM_STATE(PROCESSOR) \
223 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
224 ? (cpu_registers(PROCESSOR)->msr & msr_problem_state) \
227 #define IS_64BIT_MODE(PROCESSOR) \
228 (WITH_TARGET_WORD_BITSIZE == 64 \
229 ? (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
230 ? (cpu_registers(PROCESSOR)->msr & msr_64bit_mode) \
234 #define IS_FP_AVAILABLE(PROCESSOR) \
235 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
236 ? (cpu_registers(PROCESSOR)->msr & msr_floating_point_available) \
242 (void) cpu_print_info
247 (model_data
*) cpu_model
248 (cpu
*processor
) CONST_ATTRIBUTE
;
251 #if (CPU_INLINE & INCLUDE_MODULE)