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 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.
26 #include "registers.h"
31 #include "interrupts.h"
39 #ifndef CONST_ATTRIBUTE
40 #define CONST_ATTRIBUTE __attribute__((__const__))
43 /* typedef struct _cpu cpu;
45 Declared in basics.h because it is used opaquely throughout the
49 /* Create a cpu object */
56 os_emul *cpu_emulation,
63 /* Find our way home */
67 (cpu *processor) CONST_ATTRIBUTE;
70 (cpu_mon *) cpu_monitor
71 (cpu *processor) CONST_ATTRIBUTE;
74 (os_emul *) cpu_os_emulation
79 (cpu *processor) CONST_ATTRIBUTE;
82 /* manipulate the processors program counter and execution state.
84 The program counter is not included in the register file. Instead
85 it is extracted and then later restored (set, reset, halt). This
86 is to give the user of the cpu (and the compiler) the chance to
87 minimize the need to load/store the cpu's PC value. (Especially in
88 the case of a single processor) */
91 (void) cpu_set_program_counter
93 unsigned_word new_program_counter);
96 (unsigned_word) cpu_get_program_counter
116 ...) __attribute__ ((format (printf, 3, 4)));
119 /* The processors local concept of time */
122 (signed64) cpu_get_time_base
126 (void) cpu_set_time_base
131 (signed32) cpu_get_decrementer
135 (void) cpu_set_decrementer
137 signed32 decrementer);
140 #if WITH_IDECODE_CACHE_SIZE
141 /* Return the cache entry that matches the given CIA. No guarentee
142 that the cache entry actually contains the instruction for that
146 (idecode_cache) *cpu_icache_entry
151 (void) cpu_flush_icache
156 /* reveal the processors VM:
158 At first sight it may seem better to, instead of exposing the cpu's
159 inner vm maps, to have the cpu its self provide memory manipulation
160 functions. (eg cpu_instruction_fetch() cpu_data_read_4())
162 Unfortunatly in addition to these functions is the need (for the
163 debugger) to be able to read/write to memory in ways that violate
164 the vm protection (eg store breakpoint instruction in the
168 (vm_data_map *) cpu_data_map
172 (vm_instruction_map *) cpu_instruction_map
176 (void) cpu_page_tlb_invalidate_entry
181 (void) cpu_page_tlb_invalidate_all
185 /* reveal the processors interrupt state */
188 (interrupts *) cpu_interrupts
192 /* grant access to the reservation information */
194 typedef struct _memory_reservation {
198 } memory_reservation;
201 (memory_reservation *) cpu_reservation
207 This model exploits the PowerPC's requirement for a synchronization
208 to occure after (or before) the update of any context controlling
209 register. All context sync points must call the sync function
210 below to when ever a synchronization point is reached */
213 (registers *) cpu_registers
214 (cpu *processor) CONST_ATTRIBUTE;
217 (void) cpu_synchronize_context
221 #define IS_PROBLEM_STATE(PROCESSOR) \
222 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
223 ? (cpu_registers(PROCESSOR)->msr & msr_problem_state) \
226 #define IS_64BIT_MODE(PROCESSOR) \
227 (WITH_TARGET_WORD_BITSIZE == 64 \
228 ? (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
229 ? (cpu_registers(PROCESSOR)->msr & msr_64bit_mode) \
233 #define IS_FP_AVAILABLE(PROCESSOR) \
234 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
235 ? (cpu_registers(PROCESSOR)->msr & msr_floating_point_available) \
241 (void) cpu_print_info
246 (model_data *) cpu_model
247 (cpu *processor) CONST_ATTRIBUTE;
250 #if (CPU_INLINE & INCLUDE_MODULE)