00001 /* 00002 * syscall.h - proxy system call handler interfaces 00003 * 00004 * This file is a part of the SimpleScalar tool suite written by 00005 * Todd M. Austin as a part of the Multiscalar Research Project. 00006 * 00007 * The tool suite is currently maintained by Doug Burger and Todd M. Austin. 00008 * 00009 * Copyright (C) 1994, 1995, 1996, 1997, 1998 by Todd M. Austin 00010 * 00011 * This source file is distributed "as is" in the hope that it will be 00012 * useful. The tool set comes with no warranty, and no author or 00013 * distributor accepts any responsibility for the consequences of its 00014 * use. 00015 * 00016 * Everyone is granted permission to copy, modify and redistribute 00017 * this tool set under the following conditions: 00018 * 00019 * This source code is distributed for non-commercial use only. 00020 * Please contact the maintainer for restrictions applying to 00021 * commercial use. 00022 * 00023 * Permission is granted to anyone to make or distribute copies 00024 * of this source code, either as received or modified, in any 00025 * medium, provided that all copyright notices, permission and 00026 * nonwarranty notices are preserved, and that the distributor 00027 * grants the recipient permission for further redistribution as 00028 * permitted by this document. 00029 * 00030 * Permission is granted to distribute this file in compiled 00031 * or executable form under the same conditions that apply for 00032 * source code, provided that either: 00033 * 00034 * A. it is accompanied by the corresponding machine-readable 00035 * source code, 00036 * B. it is accompanied by a written offer, with no time limit, 00037 * to give anyone a machine-readable copy of the corresponding 00038 * source code in return for reimbursement of the cost of 00039 * distribution. This written offer must permit verbatim 00040 * duplication by anyone, or 00041 * C. it is distributed by someone who received only the 00042 * executable form, and is accompanied by a copy of the 00043 * written offer of source code that they received concurrently. 00044 * 00045 * In other words, you are welcome to use, share and improve this 00046 * source file. You are forbidden to forbid anyone else to use, share 00047 * and improve what you give them. 00048 * 00049 * INTERNET: dburger@cs.wisc.edu 00050 * US Mail: 1210 W. Dayton Street, Madison, WI 53706 00051 * 00052 * $Id: syscall.h,v 1.1.1.1 2003/09/18 00:57:54 panalyzer Exp $ 00053 * 00054 * $Log: syscall.h,v $ 00055 * Revision 1.1.1.1 2003/09/18 00:57:54 panalyzer 00056 * 00057 * 00058 * Revision 1.1.1.1 2003/09/18 00:18:44 panalyzer 00059 * 00060 * 00061 * Revision 1.1.1.1 2003/09/16 18:48:14 gdm 00062 * 00063 * 00064 * Revision 1.1.1.1 2000/11/29 14:53:54 cu-cs 00065 * Grand unification of arm sources. 00066 * 00067 * 00068 * Revision 1.1.1.1 2000/05/26 15:18:58 taustin 00069 * SimpleScalar Tool Set 00070 * 00071 * 00072 * Revision 1.5 1998/08/27 16:49:58 taustin 00073 * implemented host interface description in host.h 00074 * added target interface support 00075 * moved target-dependent definitions to target files 00076 * added support for register and memory contexts 00077 * 00078 * Revision 1.4 1997/03/11 01:36:51 taustin 00079 * updated copyright 00080 * long/int tweaks made for ALPHA target support 00081 * syscall structures are now more portable across platforms 00082 * 00083 * Revision 1.3 1996/12/27 15:56:56 taustin 00084 * updated comments 00085 * 00086 * Revision 1.1 1996/12/05 18:50:23 taustin 00087 * Initial revision 00088 * 00089 * 00090 */ 00091 00092 #ifndef SYSCALL_H 00093 #define SYSCALL_H 00094 00095 #include <sys/types.h> 00096 #ifdef _MSC_VER 00097 #include <time.h> 00098 #else 00099 #include <sys/time.h> 00100 #endif 00101 00102 #include "host.h" 00103 #include "misc.h" 00104 #include "machine.h" 00105 00106 /* 00107 * This module implements the system call portion of the SimpleScalar 00108 * instruction set architecture. The system call definitions are borrowed 00109 * from Ultrix. All system calls are executed by the simulator (the host) on 00110 * behalf of the simulated program (the target). The basic procedure for 00111 * implementing a system call is as follows: 00112 * 00113 * 1) decode the system call (this is the enum in "syscode") 00114 * 2) copy system call inputs in target (simulated program) memory 00115 * to host memory (simulator memory), note: the location and 00116 * amount of memory to copy is system call specific 00117 * 3) the simulator performs the system call on behalf of the target prog 00118 * 4) copy system call results in host memory to target memory 00119 * 5) set result register to indicate the error status of the system call 00120 * 00121 * That's it... If you encounter an unimplemented system call and would like 00122 * to add support for it, first locate the syscode and arguments for the system 00123 * call when it occurs (do this in the debugger) and then implement a proxy 00124 * procedure in syscall.c. 00125 * 00126 */ 00127 00128 00129 /* syscall proxy handler, architect registers and memory are assumed to be 00130 precise when this function is called, register and memory are updated with 00131 the results of the sustem call */ 00132 void 00133 sys_syscall(struct regs_t *regs, /* registers to access */ 00134 mem_access_fn mem_fn, /* generic memory accessor */ 00135 struct mem_t *mem, /* memory space to access */ 00136 md_inst_t inst, /* system call inst */ 00137 int traceable); /* traceable system call? */ 00138 00139 #endif /* SYSCALL_H */