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 #ifndef CONST_ATTRIBUTE
39 #define CONST_ATTRIBUTE __attribute__((__const__))
42 /* typedef struct _cpu cpu;
44 Declared in basics.h because it is used opaquely throughout the
48 /* Create a cpu object */
55 os_emul
*cpu_emulation
,
62 /* Find our way home */
66 (cpu
*processor
) CONST_ATTRIBUTE
;
69 (cpu_mon
*) cpu_monitor
70 (cpu
*processor
) CONST_ATTRIBUTE
;
73 (os_emul
*) cpu_os_emulation
78 (cpu
*processor
) CONST_ATTRIBUTE
;
81 /* manipulate the processors program counter and execution state.
83 The program counter is not included in the register file. Instead
84 it is extracted and then later restored (set, reset, halt). This
85 is to give the user of the cpu (and the compiler) the chance to
86 minimize the need to load/store the cpu's PC value. (Especially in
87 the case of a single processor) */
90 (void) cpu_set_program_counter
92 unsigned_word new_program_counter
);
95 (unsigned_word
) cpu_get_program_counter
115 ...) __attribute__ ((format (printf
, 3, 4)));
118 /* The processors local concept of time */
121 (signed64
) cpu_get_time_base
125 (void) cpu_set_time_base
130 (signed32
) cpu_get_decrementer
134 (void) cpu_set_decrementer
136 signed32 decrementer
);
139 #if WITH_IDECODE_CACHE_SIZE
140 /* Return the cache entry that matches the given CIA. No guarentee
141 that the cache entry actually contains the instruction for that
145 (idecode_cache
) *cpu_icache_entry
150 (void) cpu_flush_icache
155 /* reveal the processors VM:
157 At first sight it may seem better to, instead of exposing the cpu's
158 inner vm maps, to have the cpu its self provide memory manipulation
159 functions. (eg cpu_instruction_fetch() cpu_data_read_4())
161 Unfortunatly in addition to these functions is the need (for the
162 debugger) to be able to read/write to memory in ways that violate
163 the vm protection (eg store breakpoint instruction in the
167 (vm_data_map
*) cpu_data_map
171 (vm_instruction_map
*) cpu_instruction_map
175 (void) cpu_page_tlb_invalidate_entry
180 (void) cpu_page_tlb_invalidate_all
184 /* reveal the processors interrupt state */
187 (interrupts
*) cpu_interrupts
191 /* grant access to the reservation information */
193 typedef struct _memory_reservation
{
197 } memory_reservation
;
200 (memory_reservation
*) cpu_reservation
206 This model exploits the PowerPC's requirement for a synchronization
207 to occure after (or before) the update of any context controlling
208 register. All context sync points must call the sync function
209 below to when ever a synchronization point is reached */
212 (registers
*) cpu_registers
213 (cpu
*processor
) CONST_ATTRIBUTE
;
216 (void) cpu_synchronize_context
220 #define IS_PROBLEM_STATE(PROCESSOR) \
221 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
222 ? (cpu_registers(PROCESSOR)->msr & msr_problem_state) \
225 #define IS_64BIT_MODE(PROCESSOR) \
226 (WITH_TARGET_WORD_BITSIZE == 64 \
227 ? (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
228 ? (cpu_registers(PROCESSOR)->msr & msr_64bit_mode) \
232 #define IS_FP_AVAILABLE(PROCESSOR) \
233 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
234 ? (cpu_registers(PROCESSOR)->msr & msr_floating_point_available) \
240 (void) cpu_print_info
245 (model_data
*) cpu_model
246 (cpu
*processor
) CONST_ATTRIBUTE
;
249 #if (CPU_INLINE & INCLUDE_MODULE)