Import changeset
[gem5.git] / system / alpha / h / kernel.h
1 #ifndef __KERNEL_H_LOADED
2 #define __KERNEL_H_LOADED
3 /*****************************************************************************
4
5 Copyright © 1993, 1994 Digital Equipment Corporation,
6 Maynard, Massachusetts.
7
8 All Rights Reserved
9
10 Permission to use, copy, modify, and distribute this software and its
11 documentation for any purpose and without fee is hereby granted, provided
12 that the copyright notice and this permission notice appear in all copies
13 of software and supporting documentation, and that the name of Digital not
14 be used in advertising or publicity pertaining to distribution of the software
15 without specific, written prior permission. Digital grants this permission
16 provided that you prominently mark, as not part of the original, any
17 modifications made to this software or documentation.
18
19 Digital Equipment Corporation disclaims all warranties and/or guarantees
20 with regard to this software, including all implied warranties of fitness for
21 a particular purpose and merchantability, and makes no representations
22 regarding the use of, or the results of the use of, the software and
23 documentation in terms of correctness, accuracy, reliability, currentness or
24 otherwise; and you rely on the software, documentation and results solely at
25 your own risk.
26
27 ******************************************************************************/
28
29 /*
30 * $Id: kernel.h,v 1.1.1.1 1997/10/30 23:27:16 verghese Exp $;
31 */
32
33 /*
34 * Derived from EB64 version; history of EB64 version:
35 *
36 * $Log: kernel.h,v $
37 * Revision 1.1.1.1 1997/10/30 23:27:16 verghese
38 * current 10/29/97
39 *
40 * Revision 1.7 1994/08/05 20:13:47 fdh
41 * Updated Copyright header and RCS $Id: identifier.
42 *
43 * Revision 1.6 1994/06/28 20:08:21 fdh
44 * Modified filenames and build precedure to fit into a FAT filesystem.
45 *
46 * Revision 1.5 1994/06/20 14:18:59 fdh
47 * Fixup header file preprocessor #include conditionals.
48 *
49 * Revision 1.4 1994/03/09 12:48:33 berent
50 * Made NT compilable and tidied up
51 *
52 * Revision 1.4 1993/10/01 15:47:00 berent
53 * Added saved_user_pc; used to avoid need for special ethernet PAL code
54 *
55 * Revision 1.3 1993/08/09 11:43:38 berent
56 * Correct return types of some functions
57 *
58 * Revision 1.2 1993/06/08 22:32:06 berent
59 * Changed to improve ladbx server communications
60 *
61 * Revision 1.1 1993/06/08 19:56:36 fdh
62 * Initial revision
63 *
64 */
65
66 #include "system.h"
67 #include "server_t.h"
68
69
70 /* kload_implemented - check whether the kernel will load new processes.
71 *
72 * Returns TRUE if this kernel supports the loading of new processes,
73 * FALSE if not.
74 */
75 extern kload_implemented(void);
76
77 /* kload - load a new process.
78 *
79 * Arguments:
80 * name - file name of new process.
81 * argv - argument array for new process, NULL terminated.
82 * standardIn - file name of standard input.
83 * standardOut - file name of standard output.
84 * standardError - file name of standard error.
85 * loadAddress - address at which client expects process to be loaded; or
86 * all bits 1 if unknown.
87 * startAddress - address at which client expects process to start executing.
88 * ignored if the load address is not set.
89 *
90 * The format and interpretation of file name arguments is kernel dependent except
91 * in that an empty string always means use the default (if any). The
92 * standard input, standard output and standard error file names may be ignored by
93 * some kernels. Kernels will only use the load and start addresses if they have
94 * direct control over where programs are loaded or started.
95 *
96 * Return Value:
97 * TRUE if successful, FALSE if not.
98 */
99 extern int kload(char * name,
100 char * argv[],
101 char * standardIn,
102 char * standardOut,
103 char * standardError,
104 address_value loadAddress,
105 address_value startAddress);
106
107 /* kconnect_implemented - check whether the kernel will connect to existing processes.
108 *
109 * Returns TRUE if this kernel supports connecting to existing processes,
110 * FALSE if not.
111 */
112
113 extern int kconnect_implemented(void);
114
115 /* kconnect - connect to an existing process
116 *
117 * Argument:
118 * pid - process id of process to which the kernel is to be connected. The interpretation
119 * of this value is kernel dependent. It may be ignored by kernels running
120 * in a non multiprocessing environment.
121 *
122 * Return Value:
123 * TRUE if successful, FALSE if not.
124 */
125 extern int kconnect(ui pid);
126
127 /* kkill_possible - checks whether this kernel can kill the current process.
128 *
129 * Return Value:
130 * TRUE if possible; false if not.
131 */
132 extern int kkill_possible(void);
133
134 /* kkill - kill the current process.
135 */
136 extern void kkill(void);
137
138 /* kdetach_possible - checks whether this kernel can detach from the current process
139 * without killing it.
140 *
141 * Return Value:
142 * TRUE if possible; false if not.
143 */
144 extern int kdetach_possible(void);
145
146 /* kdetach - detach from the current process without killing it. If possible the kernel will
147 * not remove any breakpoints or continue the process if it is stopped ; but
148 * there may be kernels on which detaching can only be implemented such that
149 * it does one or both of these.
150 */
151 extern void kdetach(void);
152
153 /* kpid - return the pid of the current process.
154 */
155 extern ui kpid(void);
156
157 /* kgo - run the current process until it hits a breakpoint or stops for some
158 * other reason.
159 */
160 extern void kgo(void);
161
162 /* kstop - stop the current process as soon as possible.
163 */
164 extern void kstop(void);
165
166 /* kaddressok - check whether an address is readable
167 *
168 * Argument:
169 * address - the address to be checked.
170 *
171 * Return value:
172 * TRUE if readable, FALSE if not.
173 */
174 extern int kaddressok(address_value address);
175
176 /* kcexamine - get a value from memory.
177 *
178 * Argument:
179 * address - the address from which the value is to be fetched. Must be
180 * 8 byte alligned.
181 *
182 * Return value:
183 * The 8 byte value at address. If there is a breakpoint within this 8 byte
184 * region the value returned is the value that would be at that address if the
185 * breakpoint were removed.
186 */
187 extern ul kcexamine(address_value address);
188
189
190 /* kcdeposit - deposit a value in memory.
191 *
192 * Arguments:
193 * address - the address at which the value is to be deposited. Must be
194 * 8 byte alligned.
195 * value - the 8 byte value to be deposited. If there is a breakpoint within
196 * the 8 byte region the new value should not overwrite any breakpoint
197 * instruction; but instead should change the value that will be written
198 * back when any such instruction is removed.
199 *
200 * Return value:
201 * TRUE if successful. FALSE if the kernel was unable to deposit the data.
202 */
203 extern int kcdeposit(address_value address, ul value);
204
205 /* kstep - step one instruction. If there is a breakpoint at the current program counter
206 * the instruction that would be at that address if the breakpoint were removed is
207 * executed.
208 */
209 extern void kstep(void);
210
211 /* kpc - get the current program counter.
212 *
213 * Return value:
214 * current program counter.
215 */
216 extern address_value kpc(void);
217
218 /* ksetpc - update the program counter.
219 *
220 * Argument:
221 * address - new value of program counter.
222 */
223 extern void ksetpc(address_value address);
224
225 /* kregister - get the contents of a register
226 *
227 * Argument:
228 * reg - the register number. If reg is in the range 0 to 31 the function fetches the
229 * contents of fixed point register reg. If reg is the range 32 to 63 it
230 * fetches (as an 8 byte bit pattern) the contents of floating point register
231 * reg-32.
232 *
233 * Return value:
234 * The 8 byte bit pattern in the selected register.
235 */
236 extern register_value kregister(int reg);
237
238 /* ksetreg - writes a bit pattern to a register
239 *
240 * Arguments:
241 * reg - the register number, as for kregister.
242 * value - the 8 byte bit pattern to be written.
243 */
244 extern void ksetreg(int reg, register_value value);
245
246 /* kbreak - sets a breakpoint.
247 *
248 * Argument:
249 * address - the address at which a breakpoint is to be set. Must be 4 byte alligned.
250 *
251 * Return value:
252 * The result that should be sent back to the client.
253 */
254 extern short int kbreak(address_value address);
255
256 /* kremovebreak - sets a breakpoint.
257 *
258 * Argument:
259 * address - the address of the breakpoint. Must be 4 byte alligned.
260 *
261 * Return value:
262 * The result that should be sent back to the client.
263 */
264 extern short int kremovebreak(address_value address);
265
266 /* kpoll - get the state of the current process.
267 *
268 * Return value:
269 * PROCESS_STATE_PROCESS_RUNNING - the process is running,
270 * PROCESS_STATE_PROCESS_AT_BREAK - the process has stopped at a breakpoint,
271 * PROCESS_STATE_PROCESS_SUSPENDED - the process has stopped elsewhere,
272 * PROCESS_STATE_PROCESS_TERMINATED - the process no longer exists,
273 * PROCESS_STATE_PROCESS_LOADING - the process is loading,
274 * PROCESS_STATE_LOAD_FAILED - the process failed to load.
275 */
276 extern int kpoll(void);
277
278 #endif /* __KERNEL_H_LOADED */