1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus - exception.c *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2002 Hacktarux *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22 #include "api/m64p_types.h"
23 #include "api/callbacks.h"
24 #include "memory/memory.h"
26 #include "exception.h"
31 void TLB_refill_exception(unsigned int address, int w)
33 int usual_handler = 0, i;
35 if (r4300emu != CORE_DYNAREC && w != 2) update_count();
36 if (w == 1) Cause = (3 << 2);
37 else Cause = (2 << 2);
39 Context = (Context & 0xFF80000F) | ((address >> 9) & 0x007FFFF0);
40 EntryHi = address & 0xFFFFE000;
41 if (Status & 0x2) // Test de EXL
43 generic_jump_to(0x80000180);
44 if(delay_slot==1 || delay_slot==3) Cause |= 0x80000000;
45 else Cause &= 0x7FFFFFFF;
49 if (r4300emu != CORE_PURE_INTERPRETER)
59 Status |= 0x2; //EXL=1
61 if (address >= 0x80000000 && address < 0xc0000000)
65 if (/*tlb_e[i].v_even &&*/ address >= tlb_e[i].start_even &&
66 address <= tlb_e[i].end_even)
68 if (/*tlb_e[i].v_odd &&*/ address >= tlb_e[i].start_odd &&
69 address <= tlb_e[i].end_odd)
74 generic_jump_to(0x80000180);
78 generic_jump_to(0x80000000);
81 if(delay_slot==1 || delay_slot==3)
94 if (r4300emu == CORE_DYNAREC)
97 if (!dyna_interp) delay_slot = 0;
100 if (r4300emu != CORE_DYNAREC || dyna_interp)
105 skip_jump = PC->addr;
111 void exception_general(void)
118 if(delay_slot==1 || delay_slot==3)
127 generic_jump_to(0x80000180);
128 last_addr = PC->addr;
129 if (r4300emu == CORE_DYNAREC)
132 if (!dyna_interp) delay_slot = 0;
134 if (r4300emu != CORE_DYNAREC || dyna_interp)
139 skip_jump = PC->addr;