1 #ifndef __KERNEL_H_LOADED
2 #define __KERNEL_H_LOADED
3 /*****************************************************************************
5 Copyright © 1993, 1994 Digital Equipment Corporation,
6 Maynard, Massachusetts.
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.
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
27 ******************************************************************************/
30 * $Id: kernel.h,v 1.1.1.1 1997/10/30 23:27:16 verghese Exp $;
34 * Derived from EB64 version; history of EB64 version:
37 * Revision 1.1.1.1 1997/10/30 23:27:16 verghese
40 * Revision 1.7 1994/08/05 20:13:47 fdh
41 * Updated Copyright header and RCS $Id: identifier.
43 * Revision 1.6 1994/06/28 20:08:21 fdh
44 * Modified filenames and build precedure to fit into a FAT filesystem.
46 * Revision 1.5 1994/06/20 14:18:59 fdh
47 * Fixup header file preprocessor #include conditionals.
49 * Revision 1.4 1994/03/09 12:48:33 berent
50 * Made NT compilable and tidied up
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
55 * Revision 1.3 1993/08/09 11:43:38 berent
56 * Correct return types of some functions
58 * Revision 1.2 1993/06/08 22:32:06 berent
59 * Changed to improve ladbx server communications
61 * Revision 1.1 1993/06/08 19:56:36 fdh
70 /* kload_implemented - check whether the kernel will load new processes.
72 * Returns TRUE if this kernel supports the loading of new processes,
75 extern kload_implemented(void);
77 /* kload - load a new process.
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.
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.
97 * TRUE if successful, FALSE if not.
99 extern int kload(char * name
,
103 char * standardError
,
104 address_value loadAddress
,
105 address_value startAddress
);
107 /* kconnect_implemented - check whether the kernel will connect to existing processes.
109 * Returns TRUE if this kernel supports connecting to existing processes,
113 extern int kconnect_implemented(void);
115 /* kconnect - connect to an existing process
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.
123 * TRUE if successful, FALSE if not.
125 extern int kconnect(ui pid
);
127 /* kkill_possible - checks whether this kernel can kill the current process.
130 * TRUE if possible; false if not.
132 extern int kkill_possible(void);
134 /* kkill - kill the current process.
136 extern void kkill(void);
138 /* kdetach_possible - checks whether this kernel can detach from the current process
139 * without killing it.
142 * TRUE if possible; false if not.
144 extern int kdetach_possible(void);
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.
151 extern void kdetach(void);
153 /* kpid - return the pid of the current process.
155 extern ui
kpid(void);
157 /* kgo - run the current process until it hits a breakpoint or stops for some
160 extern void kgo(void);
162 /* kstop - stop the current process as soon as possible.
164 extern void kstop(void);
166 /* kaddressok - check whether an address is readable
169 * address - the address to be checked.
172 * TRUE if readable, FALSE if not.
174 extern int kaddressok(address_value address
);
176 /* kcexamine - get a value from memory.
179 * address - the address from which the value is to be fetched. Must be
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.
187 extern ul
kcexamine(address_value address
);
190 /* kcdeposit - deposit a value in memory.
193 * address - the address at which the value is to be deposited. Must be
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.
201 * TRUE if successful. FALSE if the kernel was unable to deposit the data.
203 extern int kcdeposit(address_value address
, ul value
);
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
209 extern void kstep(void);
211 /* kpc - get the current program counter.
214 * current program counter.
216 extern address_value
kpc(void);
218 /* ksetpc - update the program counter.
221 * address - new value of program counter.
223 extern void ksetpc(address_value address
);
225 /* kregister - get the contents of a register
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
234 * The 8 byte bit pattern in the selected register.
236 extern register_value
kregister(int reg
);
238 /* ksetreg - writes a bit pattern to a register
241 * reg - the register number, as for kregister.
242 * value - the 8 byte bit pattern to be written.
244 extern void ksetreg(int reg
, register_value value
);
246 /* kbreak - sets a breakpoint.
249 * address - the address at which a breakpoint is to be set. Must be 4 byte alligned.
252 * The result that should be sent back to the client.
254 extern short int kbreak(address_value address
);
256 /* kremovebreak - sets a breakpoint.
259 * address - the address of the breakpoint. Must be 4 byte alligned.
262 * The result that should be sent back to the client.
264 extern short int kremovebreak(address_value address
);
266 /* kpoll - get the state of the current process.
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.
276 extern int kpoll(void);
278 #endif /* __KERNEL_H_LOADED */