nkeynes@102: /** nkeynes@102: * $Id: syscall.h,v 1.1 2006-03-13 12:38:34 nkeynes Exp $ nkeynes@102: * nkeynes@102: * Generic syscall support - ability to add hooks into SH4 code to call out nkeynes@102: * to the emu. nkeynes@102: * nkeynes@102: * Copyright (c) 2005 Nathan Keynes. nkeynes@102: * nkeynes@102: * This program is free software; you can redistribute it and/or modify nkeynes@102: * it under the terms of the GNU General Public License as published by nkeynes@102: * the Free Software Foundation; either version 2 of the License, or nkeynes@102: * (at your option) any later version. nkeynes@102: * nkeynes@102: * This program is distributed in the hope that it will be useful, nkeynes@102: * but WITHOUT ANY WARRANTY; without even the implied warranty of nkeynes@102: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nkeynes@102: * GNU General Public License for more details. nkeynes@102: */ nkeynes@102: #ifndef dream_syscall_H nkeynes@102: #define dream_syscall_H 1 nkeynes@102: nkeynes@102: #include nkeynes@102: #include nkeynes@102: nkeynes@102: #ifdef __cplusplus nkeynes@102: extern "C" { nkeynes@102: #endif nkeynes@102: nkeynes@102: nkeynes@102: typedef void (*syscall_hook_func_t)( uint32_t hook_id ); nkeynes@102: nkeynes@102: nkeynes@102: /** nkeynes@102: * Define a new hook without an indirect vector nkeynes@102: */ nkeynes@102: void syscall_add_hook( uint32_t hook_id, syscall_hook_func_t hook ); nkeynes@102: nkeynes@102: /** nkeynes@102: * Define a new hook which indirects through the specified vector address nkeynes@102: * (which must be somewhere in main SH4 ram). nkeynes@102: */ nkeynes@102: void syscall_add_hook_vector( uint32_t hook_id, uint32_t vector_addr, nkeynes@102: syscall_hook_func_t hook ); nkeynes@102: nkeynes@102: /** nkeynes@102: * Invoke a syscall from the SH4 nkeynes@102: */ nkeynes@102: void syscall_invoke( uint32_t hook_id ); nkeynes@102: nkeynes@102: /** nkeynes@102: * Repatch all syscall vectors (eg in case of system reset) nkeynes@102: */ nkeynes@102: void syscall_repatch_vectors( ); nkeynes@102: nkeynes@102: /************************ Standard syscall hacks ************************/ nkeynes@102: nkeynes@102: /** nkeynes@102: * Install the BIOS emu hack into ram (sets the vectors at 8C0000B0 through nkeynes@102: * 8C0000C0) nkeynes@102: */ nkeynes@102: void bios_install( void ); nkeynes@102: nkeynes@102: /** nkeynes@102: * Install the DCLoad syscall hack nkeynes@102: */ nkeynes@102: void dcload_install( void ); nkeynes@102: nkeynes@102: #ifdef __cplusplus nkeynes@102: } nkeynes@102: #endif nkeynes@102: #endif