Search
lxdream.org :: lxdream/src/syscall.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/syscall.h
changeset 736:a02d1475ccfd
prev561:533f6b478071
next1014:f5914b2fd0db
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
nkeynes@102
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@102
     3
 * 
nkeynes@102
     4
 * Generic syscall support - ability to add hooks into SH4 code to call out
nkeynes@102
     5
 * to the emu.
nkeynes@102
     6
 *
nkeynes@102
     7
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@102
     8
 *
nkeynes@102
     9
 * This program is free software; you can redistribute it and/or modify
nkeynes@102
    10
 * it under the terms of the GNU General Public License as published by
nkeynes@102
    11
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@102
    12
 * (at your option) any later version.
nkeynes@102
    13
 *
nkeynes@102
    14
 * This program is distributed in the hope that it will be useful,
nkeynes@102
    15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@102
    16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@102
    17
 * GNU General Public License for more details.
nkeynes@102
    18
 */
nkeynes@736
    19
#ifndef lxdream_syscall_H
nkeynes@736
    20
#define lxdream_syscall_H 1
nkeynes@102
    21
nkeynes@102
    22
#include <stdint.h>
nkeynes@102
    23
#include <glib/gtypes.h>
nkeynes@102
    24
nkeynes@102
    25
#ifdef __cplusplus
nkeynes@102
    26
extern "C" {
nkeynes@102
    27
#endif
nkeynes@102
    28
nkeynes@102
    29
nkeynes@102
    30
typedef void (*syscall_hook_func_t)( uint32_t hook_id );
nkeynes@102
    31
nkeynes@102
    32
nkeynes@102
    33
/**
nkeynes@102
    34
 * Define a new hook without an indirect vector
nkeynes@102
    35
 */
nkeynes@102
    36
void syscall_add_hook( uint32_t hook_id, syscall_hook_func_t hook );
nkeynes@102
    37
nkeynes@102
    38
/**
nkeynes@102
    39
 * Define a new hook which indirects through the specified vector address
nkeynes@102
    40
 * (which must be somewhere in main SH4 ram).
nkeynes@102
    41
 */
nkeynes@102
    42
void syscall_add_hook_vector( uint32_t hook_id, uint32_t vector_addr,
nkeynes@102
    43
			      syscall_hook_func_t hook );
nkeynes@102
    44
nkeynes@102
    45
/**
nkeynes@102
    46
 * Invoke a syscall from the SH4
nkeynes@102
    47
 */
nkeynes@102
    48
void syscall_invoke( uint32_t hook_id );
nkeynes@102
    49
nkeynes@102
    50
/**
nkeynes@102
    51
 * Repatch all syscall vectors (eg in case of system reset)
nkeynes@102
    52
 */
nkeynes@102
    53
void syscall_repatch_vectors( );
nkeynes@102
    54
nkeynes@102
    55
/************************ Standard syscall hacks ************************/
nkeynes@102
    56
nkeynes@102
    57
/**
nkeynes@102
    58
 * Install the BIOS emu hack into ram (sets the vectors at 8C0000B0 through 
nkeynes@102
    59
 * 8C0000C0)
nkeynes@102
    60
 */
nkeynes@102
    61
void bios_install( void );
nkeynes@102
    62
nkeynes@102
    63
/**
nkeynes@102
    64
 * Install the DCLoad syscall hack
nkeynes@102
    65
 */
nkeynes@102
    66
void dcload_install( void );
nkeynes@102
    67
nkeynes@182
    68
/**
nkeynes@182
    69
 * Set the flag that indicates whether the dcload exit() syscall will be
nkeynes@182
    70
 * honoured by exiting the VM.
nkeynes@182
    71
 */
nkeynes@209
    72
void dcload_set_allow_unsafe( gboolean allow );
nkeynes@182
    73
nkeynes@102
    74
#ifdef __cplusplus
nkeynes@102
    75
}
nkeynes@102
    76
#endif
nkeynes@736
    77
nkeynes@736
    78
#endif /* !lxdream_syscall_H */
.