Path: blob/master/libmupen64plus/mupen64plus-core/src/r4300/reset.c
2 views
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *1* Mupen64plus - reset.c *2* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *3* Copyright (C) 2011 CasualJames *4* Copyright (C) 2008-2009 Richard Goedeken *5* Copyright (C) 2008 Ebenblues Nmn Okaygo Tillin9 *6* Hard reset based on code by hacktarux. *7* *8* This program is free software; you can redistribute it and/or modify *9* it under the terms of the GNU General Public License as published by *10* the Free Software Foundation; either version 2 of the License, or *11* (at your option) any later version. *12* *13* This program is distributed in the hope that it will be useful, *14* but WITHOUT ANY WARRANTY; without even the implied warranty of *15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *16* GNU General Public License for more details. *17* *18* You should have received a copy of the GNU General Public License *19* along with this program; if not, write to the *20* Free Software Foundation, Inc., *21* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *22* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */2324#include "r4300/reset.h"25#include "r4300/r4300.h"26#include "r4300/interupt.h"27#include "memory/memory.h"2829int reset_hard_job = 0;3031void reset_hard(void)32{33init_memory(0);34r4300_reset_hard();35r4300_reset_soft();36last_addr = 0xa4000040;37next_interupt = 624999;38init_interupt();39if(r4300emu != CORE_PURE_INTERPRETER)40{41/* TODO42* The following code *should* work and avoid free_blocks() and init_blocks(),43* but it doesn't unless the last line is added (which causes a memory leak).44int i;45for (i=0; i<0x100000; i++)46invalid_code[i] = 1;47blocks[0xa4000000>>12]->block = NULL; */48free_blocks();49init_blocks();50}51generic_jump_to(last_addr);52}5354void reset_soft(void)55{56add_interupt_event(HW2_INT, 0); /* Hardware 2 Interrupt immediately */57add_interupt_event(NMI_INT, 50000000); /* Non maskable Interrupt after 1/2 second */58}596061