2 * $Id: dcload.c,v 1.2 2006-03-14 12:45:50 nkeynes Exp $
4 * DC-load syscall implementation.
6 * Copyright (c) 2005 Nathan Keynes.
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.
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.
23 #include "sh4/sh4core.h"
39 #define SYS_ASSIGNWRKMEM 14
41 #define SYS_OPENDIR 16
42 #define SYS_CLOSEDIR 17
43 #define SYS_READDIR 18
44 #define SYS_GETHOSTINFO 19
46 #define SYS_MAGIC 0xDEADBEEF
47 #define SYS_MAGIC_ADDR 0x8c004004
48 #define SYSCALL_ADDR 0x8c004008
50 void dcload_syscall( uint32_t syscall_id )
52 uint32_t syscall = sh4r.r[4];
55 if( sh4r.r[5] == 0 ) {
56 char *buf = mem_get_region( sh4r.r[6] );
57 int length = sh4r.r[7];
58 sh4r.r[0] = read( 0, buf, length );
64 if( sh4r.r[5] == 1 || sh4r.r[5] == 2 ) {
65 char *buf = mem_get_region( sh4r.r[6] );
66 int length = sh4r.r[7];
67 sh4r.r[0] = write( sh4r.r[5], buf, length );
82 syscall_add_hook_vector( 0xF0, SYSCALL_ADDR, dcload_syscall );
83 sh4_write_long( SYS_MAGIC_ADDR, SYS_MAGIC );
.