3 * Copyright (C) 2006 Exophase <exophase@gmail.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (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 GNU
13 * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 // System mode and user mode are represented as the same here
85 CHANGED_PC_STATUS = 31
95 COUNTDOWN_BREAKPOINT_B,
96 COUNTDOWN_BREAKPOINT_C,
103 TRANSLATION_REGION_RAM,
104 TRANSLATION_REGION_ROM,
105 TRANSLATION_REGION_BIOS
106 } translation_region_type;
108 extern debug_state current_debug_state;
109 extern u32 instruction_count;
110 extern u32 last_instruction;
112 u32 function_cc step_debug(u32 pc, u32 cycles);
113 u32 execute_arm(u32 cycles);
114 void raise_interrupt(irq_type irq_raised);
116 u32 function_cc execute_load_u8(u32 address);
117 u32 function_cc execute_load_u16(u32 address);
118 u32 function_cc execute_load_u32(u32 address);
119 u32 function_cc execute_load_s8(u32 address);
120 u32 function_cc execute_load_s16(u32 address);
121 void function_cc execute_store_u8(u32 address, u32 source);
122 void function_cc execute_store_u16(u32 address, u32 source);
123 void function_cc execute_store_u32(u32 address, u32 source);
124 u32 function_cc execute_arm_translate(u32 cycles);
125 void init_translater();
126 void cpu_write_mem_savestate(file_tag_type savestate_file);
127 void cpu_read_savestate(file_tag_type savestate_file);
129 u8 function_cc *block_lookup_address_arm(u32 pc);
130 u8 function_cc *block_lookup_address_thumb(u32 pc);
131 s32 translate_block_arm(u32 pc, translation_region_type translation_region,
133 s32 translate_block_thumb(u32 pc, translation_region_type translation_region,
138 #define ROM_TRANSLATION_CACHE_SIZE (1024 * 512 * 4)
139 #define RAM_TRANSLATION_CACHE_SIZE (1024 * 384)
140 #define BIOS_TRANSLATION_CACHE_SIZE (1024 * 128)
141 #define TRANSLATION_CACHE_LIMIT_THRESHOLD (1024)
145 #define ROM_TRANSLATION_CACHE_SIZE (1024 * 512 * 4 * 5)
146 #define RAM_TRANSLATION_CACHE_SIZE (1024 * 384 * 2)
147 #define BIOS_TRANSLATION_CACHE_SIZE (1024 * 128 * 2)
148 #define TRANSLATION_CACHE_LIMIT_THRESHOLD (1024 * 32)
152 extern u8 rom_translation_cache[ROM_TRANSLATION_CACHE_SIZE];
153 extern u8 ram_translation_cache[RAM_TRANSLATION_CACHE_SIZE];
154 extern u8 bios_translation_cache[BIOS_TRANSLATION_CACHE_SIZE];
155 extern u8 *rom_translation_ptr;
156 extern u8 *ram_translation_ptr;
157 extern u8 *bios_translation_ptr;
159 #define MAX_TRANSLATION_GATES 8
161 extern u32 idle_loop_target_pc;
162 extern u32 force_pc_update_target;
163 extern u32 iwram_stack_optimize;
164 extern u32 allow_smc_ram_u8;
165 extern u32 allow_smc_ram_u16;
166 extern u32 allow_smc_ram_u32;
167 extern u32 direct_map_vram;
168 extern u32 translation_gate_targets;
169 extern u32 translation_gate_target_pc[MAX_TRANSLATION_GATES];
171 extern u32 in_interrupt;
173 #define ROM_BRANCH_HASH_SIZE (1024 * 64)
175 /* EDIT: Shouldn't this be extern ?! */
176 extern u32 *rom_branch_hash[ROM_BRANCH_HASH_SIZE];
178 void flush_translation_cache_rom();
179 void flush_translation_cache_ram();
180 void flush_translation_cache_bios();
181 void dump_translation_cache();
183 extern u32 reg_mode[7][7];
186 extern u32 cpu_modes[32];
187 extern const u32 psr_masks[16];
189 extern u32 breakpoint_value;
191 extern u32 memory_region_access_read_u8[16];
192 extern u32 memory_region_access_read_s8[16];
193 extern u32 memory_region_access_read_u16[16];
194 extern u32 memory_region_access_read_s16[16];
195 extern u32 memory_region_access_read_u32[16];
196 extern u32 memory_region_access_write_u8[16];
197 extern u32 memory_region_access_write_u16[16];
198 extern u32 memory_region_access_write_u32[16];
199 extern u32 memory_reads_u8;
200 extern u32 memory_reads_s8;
201 extern u32 memory_reads_u16;
202 extern u32 memory_reads_s16;
203 extern u32 memory_reads_u32;
204 extern u32 memory_writes_u8;
205 extern u32 memory_writes_u16;
206 extern u32 memory_writes_u32;