1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, 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.
30 #include "registers.h"
31 #include "device_tree.h"
35 #include "interrupts.h"
40 #include "function_unit.h"
43 /* typedef struct _cpu cpu;
45 Declared in basics.h because it is used opaquely throughout the
49 /* Create a cpu object */
51 INLINE_CPU cpu
*cpu_create
58 INLINE_CPU
void cpu_init
61 /* Find our way home */
63 INLINE_CPU psim
*cpu_system
66 INLINE_CPU cpu_mon
*cpu_monitor
72 INLINE_CPU event_queue
*cpu_event_queue
76 /* The processors local concept of time */
78 INLINE_CPU signed64 cpu_get_time_base
81 INLINE_CPU
void cpu_set_time_base
85 INLINE_CPU signed32 cpu_get_decrementer
88 INLINE_CPU
void cpu_set_decrementer
90 signed32 decrementer
);
93 /* manipulate the program counter
95 The program counter is not included in the register file. Instead
96 it is extracted and then later restored (set, reset, halt). This
97 is to give the user of the cpu (and the compiler) the chance to
98 minimize the need to load/store the cpu's PC value. (Especially in
99 the case of a single processor) */
101 INLINE_CPU
void cpu_set_program_counter
103 unsigned_word new_program_counter
);
105 INLINE_CPU unsigned_word cpu_get_program_counter
108 INLINE_CPU
void cpu_restart
112 INLINE_CPU
void cpu_halt
119 #if WITH_IDECODE_CACHE_SIZE
120 /* Return the cache entry that matches the given CIA. No guarentee
121 that the cache entry actually contains the instruction for that
124 INLINE_CPU idecode_cache
*cpu_icache_entry
128 INLINE_CPU
void cpu_flush_icache
133 /* reveal the processors VM:
135 At first sight it may seem better to, instead of exposing the cpu's
136 inner vm maps, to have the cpu its self provide memory manipulation
137 functions. (eg cpu_instruction_fetch() cpu_data_read_4())
139 Unfortunatly in addition to these functions is the need (for the
140 debugger) to be able to read/write to memory in ways that violate
141 the vm protection (eg store breakpoint instruction in the
144 INLINE_CPU vm_data_map
*cpu_data_map
147 INLINE_CPU vm_instruction_map
*cpu_instruction_map
151 /* grant access to the reservation information */
152 typedef struct _memory_reservation
{
156 } memory_reservation
;
158 INLINE_CPU memory_reservation
*cpu_reservation
162 INLINE_CPU
void cpu_print_info
169 This model exploits the PowerPC's requirement for a synchronization
170 to occure after (or before) the update of any context controlling
171 register. All context sync points must call the sync function
172 below to when ever a synchronization point is reached */
174 INLINE_CPU registers
*cpu_registers
177 INLINE_CPU
void cpu_synchronize_context
180 INLINE_CPU function_unit
*cpu_function_unit
183 #define IS_PROBLEM_STATE(PROCESSOR) \
184 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
185 ? (cpu_registers(PROCESSOR)->msr & msr_problem_state) \
188 #define IS_64BIT_MODE(PROCESSOR) \
189 (WITH_TARGET_WORD_BITSIZE == 64 \
190 ? (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
191 ? (cpu_registers(PROCESSOR)->msr & msr_64bit_mode) \
195 #define IS_FP_AVAILABLE(PROCESSOR) \
196 (CURRENT_ENVIRONMENT == OPERATING_ENVIRONMENT \
197 ? (cpu_registers(PROCESSOR)->msr & msr_floating_point_available) \