3.1.3b tag.
[minix3.git] / include / minix / com.h
blob0ca2695ad6cf2428db52ae7065bcae948e4bda21
1 #ifndef _MINIX_COM_H
2 #define _MINIX_COM_H
4 /*===========================================================================*
5 * Magic process numbers *
6 *===========================================================================*/
8 /* These may not be any valid endpoint (see <minix/endpoint.h>). */
9 #define ANY 0x7ace /* used to indicate 'any process' */
10 #define NONE 0x6ace /* used to indicate 'no process at all' */
11 #define SELF 0x8ace /* used to indicate 'own process' */
12 #define _MAX_MAGIC_PROC (SELF) /* used by <minix/endpoint.h>
13 to determine generation size */
15 /*===========================================================================*
16 * Process numbers of processes in the system image *
17 *===========================================================================*/
19 /* The values of several task numbers depend on whether they or other tasks
20 * are enabled. They are defined as (PREVIOUS_TASK - ENABLE_TASK) in general.
21 * ENABLE_TASK is either 0 or 1, so a task either gets a new number, or gets
22 * the same number as the previous task and is further unused. Note that the
23 * order should correspond to the order in the task table defined in table.c.
26 /* Kernel tasks. These all run in the same address space. */
27 #define IDLE -4 /* runs when no one else can run */
28 #define CLOCK -3 /* alarms and other clock functions */
29 #define SYSTEM -2 /* request system functionality */
30 #define KERNEL -1 /* pseudo-process for IPC and scheduling */
31 #define HARDWARE KERNEL /* for hardware interrupt handlers */
33 /* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
34 #define NR_TASKS 4
36 /* User-space processes, that is, device drivers, servers, and INIT. */
37 #define PM_PROC_NR 0 /* process manager */
38 #define FS_PROC_NR 1 /* file system */
39 #define RS_PROC_NR 2 /* reincarnation server */
40 #define MEM_PROC_NR 3 /* memory driver (RAM disk, null, etc.) */
41 #define LOG_PROC_NR 4 /* log device driver */
42 #define TTY_PROC_NR 5 /* terminal (TTY) driver */
43 #define DS_PROC_NR 6 /* data store server */
44 #define MFS_PROC_NR 7 /* minix root filesystem */
45 #define INIT_PROC_NR 8 /* init -- goes multiuser */
47 /* Number of processes contained in the system image. */
48 #define NR_BOOT_PROCS (NR_TASKS + INIT_PROC_NR + 1)
50 /*===========================================================================*
51 * Kernel notification types *
52 *===========================================================================*/
54 /* Kernel notification types. In principle, these can be sent to any process,
55 * so make sure that these types do not interfere with other message types.
56 * Notifications are prioritized because of the way they are unhold() and
57 * blocking notifications are delivered. The lowest numbers go first. The
58 * offset are used for the per-process notification bit maps.
60 #define NOTIFY_MESSAGE 0x1000
61 #define NOTIFY_FROM(p_nr) (NOTIFY_MESSAGE | ((p_nr) + NR_TASKS))
62 # define PROC_EVENT NOTIFY_FROM(PM_PROC_NR) /* process status change */
63 # define SYN_ALARM NOTIFY_FROM(CLOCK) /* synchronous alarm */
64 # define SYS_SIG NOTIFY_FROM(SYSTEM) /* system signal */
65 # define HARD_INT NOTIFY_FROM(HARDWARE) /* hardware interrupt */
66 # define NEW_KSIG NOTIFY_FROM(HARDWARE) /* new kernel signal */
67 # define FKEY_PRESSED NOTIFY_FROM(TTY_PROC_NR)/* function key press */
68 # define DEV_PING NOTIFY_FROM(RS_PROC_NR) /* driver liveness ping */
69 # define DS_UPDATE NOTIFY_FROM(DS_PROC_NR) /* subscription update */
71 /* Shorthands for message parameters passed with notifications. */
72 #define NOTIFY_SOURCE m_source
73 #define NOTIFY_TYPE m_type
74 #define NOTIFY_ARG m2_l1
75 #define NOTIFY_TIMESTAMP m2_l2
76 #define NOTIFY_FLAGS m2_i1
78 /*===========================================================================*
79 * Messages for BUS controller drivers *
80 *===========================================================================*/
81 #define BUSC_RQ_BASE 0x300 /* base for request types */
82 #define BUSC_RS_BASE 0x380 /* base for response types */
84 #define BUSC_PCI_INIT (BUSC_RQ_BASE + 0) /* First message to
85 * PCI driver
87 #define BUSC_PCI_FIRST_DEV (BUSC_RQ_BASE + 1) /* Get index (and
88 * vid/did) of the
89 * first PCI device
91 #define BUSC_PCI_NEXT_DEV (BUSC_RQ_BASE + 2) /* Get index (and
92 * vid/did) of the
93 * next PCI device
95 #define BUSC_PCI_FIND_DEV (BUSC_RQ_BASE + 3) /* Get index of a
96 * PCI device based on
97 * bus/dev/function
99 #define BUSC_PCI_IDS (BUSC_RQ_BASE + 4) /* Get vid/did from an
100 * index
102 #define BUSC_PCI_DEV_NAME (BUSC_RQ_BASE + 5) /* Get the name of a
103 * PCI device
105 #define BUSC_PCI_SLOT_NAME (BUSC_RQ_BASE + 6) /* Get the name of a
106 * PCI slot
108 #define BUSC_PCI_RESERVE (BUSC_RQ_BASE + 7) /* Reserve a PCI dev */
109 #define BUSC_PCI_ATTR_R8 (BUSC_RQ_BASE + 8) /* Read 8-bit
110 * attribute value
112 #define BUSC_PCI_ATTR_R16 (BUSC_RQ_BASE + 9) /* Read 16-bit
113 * attribute value
115 #define BUSC_PCI_ATTR_R32 (BUSC_RQ_BASE + 10) /* Read 32-bit
116 * attribute value
118 #define BUSC_PCI_ATTR_W8 (BUSC_RQ_BASE + 11) /* Write 8-bit
119 * attribute value
121 #define BUSC_PCI_ATTR_W16 (BUSC_RQ_BASE + 12) /* Write 16-bit
122 * attribute value
124 #define BUSC_PCI_ATTR_W32 (BUSC_RQ_BASE + 13) /* Write 32-bit
125 * attribute value
127 #define BUSC_PCI_RESCAN (BUSC_RQ_BASE + 14) /* Rescan bus */
128 #define BUSC_PCI_DEV_NAME_S (BUSC_RQ_BASE + 15) /* Get the name of a
129 * PCI device
130 * (safecopy)
132 #define BUSC_PCI_SLOT_NAME_S (BUSC_RQ_BASE + 16) /* Get the name of a
133 * PCI slot (safecopy)
135 #define BUSC_PCI_ACL (BUSC_RQ_BASE + 17) /* Set the ACL for a
136 * driver (safecopy)
139 /*===========================================================================*
140 * Messages for BLOCK and CHARACTER device drivers *
141 *===========================================================================*/
143 /* Message types for device drivers. */
144 #define DEV_RQ_BASE 0x400 /* base for device request types */
145 #define DEV_RS_BASE 0x500 /* base for device response types */
147 #define CANCEL (DEV_RQ_BASE + 0) /* force a task to cancel */
148 #define DEV_OPEN (DEV_RQ_BASE + 6) /* open a minor device */
149 #define DEV_CLOSE (DEV_RQ_BASE + 7) /* close a minor device */
150 #define TTY_SETPGRP (DEV_RQ_BASE + 10) /* set process group */
151 #define TTY_EXIT (DEV_RQ_BASE + 11) /* process group leader exited */
152 #define DEV_SELECT (DEV_RQ_BASE + 12) /* request select() attention */
153 #define DEV_STATUS (DEV_RQ_BASE + 13) /* request driver status */
155 #define DEV_READ_S (DEV_RQ_BASE + 20) /* (safecopy) read from minor */
156 #define DEV_WRITE_S (DEV_RQ_BASE + 21) /* (safecopy) write to minor */
157 #define DEV_SCATTER_S (DEV_RQ_BASE + 22) /* (safecopy) write from a vector */
158 #define DEV_GATHER_S (DEV_RQ_BASE + 23) /* (safecopy) read into a vector */
159 #define DEV_IOCTL_S (DEV_RQ_BASE + 24) /* (safecopy) I/O control code */
161 #define DEV_REPLY (DEV_RS_BASE + 0) /* general task reply */
162 #define DEV_CLONED (DEV_RS_BASE + 1) /* return cloned minor */
163 #define DEV_REVIVE (DEV_RS_BASE + 2) /* driver revives process */
164 #define DEV_IO_READY (DEV_RS_BASE + 3) /* selected device ready */
165 #define DEV_NO_STATUS (DEV_RS_BASE + 4) /* empty status reply */
167 /* Field names for messages to block and character device drivers. */
168 #define DEVICE m2_i1 /* major-minor device */
169 #define IO_ENDPT m2_i2 /* which (proc/endpoint) wants I/O? */
170 #define COUNT m2_i3 /* how many bytes to transfer */
171 #define REQUEST m2_i3 /* ioctl request code */
172 #define POSITION m2_l1 /* file offset (low 4 bytes) */
173 #define HIGHPOS m2_l2 /* file offset (high 4 bytes) */
174 #define ADDRESS m2_p1 /* core buffer address */
175 #define IO_GRANT m2_p1 /* grant id (for DEV_*_S variants) */
177 /* Field names for DEV_SELECT messages to device drivers. */
178 #define DEV_MINOR m2_i1 /* minor device */
179 #define DEV_SEL_OPS m2_i2 /* which select operations are requested */
180 #define DEV_SEL_WATCH m2_i3 /* request notify if no operations are ready */
182 /* Field names used in reply messages from tasks. */
183 #define REP_ENDPT m2_i1 /* # of proc on whose behalf I/O was done */
184 #define REP_STATUS m2_i2 /* bytes transferred or error number */
185 #define REP_IO_GRANT m2_i3 /* DEV_REVIVE: grant by which I/O was done */
186 # define SUSPEND -998 /* status to suspend caller, reply later */
188 /* Field names for messages to TTY driver. */
189 #define TTY_LINE DEVICE /* message parameter: terminal line */
190 #define TTY_REQUEST COUNT /* message parameter: ioctl request code */
191 #define TTY_SPEK POSITION/* message parameter: ioctl speed, erasing */
192 #define TTY_PGRP m2_i3 /* message parameter: process group */
194 /* Field names for the QIC 02 status reply from tape driver */
195 #define TAPE_STAT0 m2_l1
196 #define TAPE_STAT1 m2_l2
198 /*===========================================================================*
199 * Messages for networking layer *
200 *===========================================================================*/
202 /* Message types for network layer requests. This layer acts like a driver. */
203 #define NW_OPEN DEV_OPEN
204 #define NW_CLOSE DEV_CLOSE
205 #define NW_READ DEV_READ
206 #define NW_WRITE DEV_WRITE
207 #define NW_IOCTL DEV_IOCTL
208 #define NW_CANCEL CANCEL
210 /* Base type for data link layer requests and responses. */
211 #define DL_RQ_BASE 0x800
212 #define DL_RS_BASE 0x900
214 /* Message types for data link layer requests. */
215 #define DL_WRITE (DL_RQ_BASE + 3)
216 #define DL_WRITEV (DL_RQ_BASE + 4)
217 #define DL_READ (DL_RQ_BASE + 5)
218 #define DL_READV (DL_RQ_BASE + 6)
219 #define DL_CONF (DL_RQ_BASE + 7)
220 #define DL_STOP (DL_RQ_BASE + 8)
221 #define DL_GETSTAT (DL_RQ_BASE + 9)
222 #define DL_GETNAME (DL_RQ_BASE +10)
223 #define DL_WRITEV_S (DL_RQ_BASE +11)
224 #define DL_READV_S (DL_RQ_BASE +12)
225 #define DL_GETSTAT_S (DL_RQ_BASE +13)
227 /* Message type for data link layer replies. */
228 #define DL_CONF_REPLY (DL_RS_BASE + 20)
229 #define DL_TASK_REPLY (DL_RS_BASE + 21)
230 #define DL_NAME_REPLY (DL_RS_BASE + 22)
231 #define DL_STAT_REPLY (DL_RS_BASE + 23)
233 /* Field names for data link layer messages. */
234 #define DL_PORT m2_i1
235 #define DL_PROC m2_i2 /* endpoint */
236 #define DL_COUNT m2_i3
237 #define DL_MODE m2_l1
238 #define DL_CLCK m2_l2
239 #define DL_ADDR m2_p1
240 #define DL_STAT m2_l1
241 #define DL_GRANT m2_l2
242 #define DL_NAME m3_ca1
244 /* Bits in 'DL_STAT' field of DL replies. */
245 # define DL_PACK_SEND 0x01
246 # define DL_PACK_RECV 0x02
247 # define DL_READ_IP 0x04
249 /* Bits in 'DL_MODE' field of DL requests. */
250 # define DL_NOMODE 0x0
251 # define DL_PROMISC_REQ 0x2
252 # define DL_MULTI_REQ 0x4
253 # define DL_BROAD_REQ 0x8
255 /*===========================================================================*
256 * SYSTASK request types and field names *
257 *===========================================================================*/
259 /* System library calls are dispatched via a call vector, so be careful when
260 * modifying the system call numbers. The numbers here determine which call
261 * is made from the call vector.
263 #define KERNEL_CALL 0x600 /* base for kernel calls to SYSTEM */
265 # define SYS_FORK (KERNEL_CALL + 0) /* sys_fork() */
266 # define SYS_EXEC (KERNEL_CALL + 1) /* sys_exec() */
267 # define SYS_EXIT (KERNEL_CALL + 2) /* sys_exit() */
268 # define SYS_NICE (KERNEL_CALL + 3) /* sys_nice() */
269 # define SYS_PRIVCTL (KERNEL_CALL + 4) /* sys_privctl() */
270 # define SYS_TRACE (KERNEL_CALL + 5) /* sys_trace() */
271 # define SYS_KILL (KERNEL_CALL + 6) /* sys_kill() */
273 # define SYS_GETKSIG (KERNEL_CALL + 7) /* sys_getsig() */
274 # define SYS_ENDKSIG (KERNEL_CALL + 8) /* sys_endsig() */
275 # define SYS_SIGSEND (KERNEL_CALL + 9) /* sys_sigsend() */
276 # define SYS_SIGRETURN (KERNEL_CALL + 10) /* sys_sigreturn() */
278 # define SYS_NEWMAP (KERNEL_CALL + 11) /* sys_newmap() */
279 # define SYS_SEGCTL (KERNEL_CALL + 12) /* sys_segctl() */
280 # define SYS_MEMSET (KERNEL_CALL + 13) /* sys_memset() */
282 # define SYS_UMAP (KERNEL_CALL + 14) /* sys_umap() */
283 # define SYS_VIRCOPY (KERNEL_CALL + 15) /* sys_vircopy() */
284 # define SYS_PHYSCOPY (KERNEL_CALL + 16) /* sys_physcopy() */
285 # define SYS_VIRVCOPY (KERNEL_CALL + 17) /* sys_virvcopy() */
286 # define SYS_PHYSVCOPY (KERNEL_CALL + 18) /* sys_physvcopy() */
288 # define SYS_IRQCTL (KERNEL_CALL + 19) /* sys_irqctl() */
289 # define SYS_INT86 (KERNEL_CALL + 20) /* sys_int86() */
290 # define SYS_DEVIO (KERNEL_CALL + 21) /* sys_devio() */
291 # define SYS_SDEVIO (KERNEL_CALL + 22) /* sys_sdevio() */
292 # define SYS_VDEVIO (KERNEL_CALL + 23) /* sys_vdevio() */
294 # define SYS_SETALARM (KERNEL_CALL + 24) /* sys_setalarm() */
295 # define SYS_TIMES (KERNEL_CALL + 25) /* sys_times() */
296 # define SYS_GETINFO (KERNEL_CALL + 26) /* sys_getinfo() */
297 # define SYS_ABORT (KERNEL_CALL + 27) /* sys_abort() */
298 # define SYS_IOPENABLE (KERNEL_CALL + 28) /* sys_enable_iop() */
299 # define SYS_VM_SETBUF (KERNEL_CALL + 29) /* sys_vm_setbuf() */
300 # define SYS_VM_MAP (KERNEL_CALL + 30) /* sys_vm_map() */
301 # define SYS_SAFECOPYFROM (KERNEL_CALL + 31) /* sys_safecopyfrom() */
302 # define SYS_SAFECOPYTO (KERNEL_CALL + 32) /* sys_safecopyto() */
303 # define SYS_VSAFECOPY (KERNEL_CALL + 33) /* sys_vsafecopy() */
304 # define SYS_SETGRANT (KERNEL_CALL + 34) /* sys_setgrant() */
305 # define SYS_READBIOS (KERNEL_CALL + 35) /* sys_readbios() */
307 # define SYS_SPROF (KERNEL_CALL + 36) /* sys_sprof() */
308 # define SYS_CPROF (KERNEL_CALL + 37) /* sys_cprof() */
309 # define SYS_PROFBUF (KERNEL_CALL + 38) /* sys_profbuf() */
311 #define NR_SYS_CALLS 39 /* number of system calls */
313 /* Pseudo call for use in kernel/table.c. */
314 #define SYS_ALL_CALLS (NR_SYS_CALLS)
316 /* Subfunctions for SYS_PRIVCTL */
317 #define SYS_PRIV_INIT 1 /* Initialize a privilege structure */
318 #define SYS_PRIV_ADD_IO 2 /* Add I/O range (struct io_range) */
319 #define SYS_PRIV_ADD_MEM 3 /* Add memory range (struct mem_range)
321 #define SYS_PRIV_ADD_IRQ 4 /* Add IRQ */
322 #define SYS_PRIV_USER 5 /* Make a process an oridinary user
323 * process.
326 /* Subfunctions for SYS_SETGRANT */
327 #define SYS_PARAM_SET_GRANT 1 /* Set address and size of grant table */
329 /* Field names for SYS_MEMSET, SYS_SEGCTL. */
330 #define MEM_PTR m2_p1 /* base */
331 #define MEM_COUNT m2_l1 /* count */
332 #define MEM_PATTERN m2_l2 /* pattern to write */
333 #define MEM_CHUNK_BASE m4_l1 /* physical base address */
334 #define MEM_CHUNK_SIZE m4_l2 /* size of mem chunk */
335 #define MEM_TOT_SIZE m4_l3 /* total memory size */
336 #define MEM_CHUNK_TAG m4_l4 /* tag to identify chunk of mem */
338 /* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
339 #define DIO_REQUEST m2_i3 /* device in or output */
340 # define _DIO_INPUT 0x001
341 # define _DIO_OUTPUT 0x002
342 # define _DIO_DIRMASK 0x00f
343 # define _DIO_BYTE 0x010
344 # define _DIO_WORD 0x020
345 # define _DIO_LONG 0x030
346 # define _DIO_TYPEMASK 0x0f0
347 # define _DIO_SAFE 0x100
348 # define _DIO_SAFEMASK 0xf00
349 # define DIO_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE)
350 # define DIO_INPUT_WORD (_DIO_INPUT|_DIO_WORD)
351 # define DIO_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE)
352 # define DIO_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD)
353 # define DIO_SAFE_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
354 # define DIO_SAFE_INPUT_WORD (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
355 # define DIO_SAFE_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
356 # define DIO_SAFE_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
357 #define DIO_PORT m2_l1 /* single port address */
358 #define DIO_VALUE m2_l2 /* single I/O value */
359 #define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */
360 #define DIO_VEC_SIZE m2_l2 /* number of elements in vector */
361 #define DIO_VEC_ENDPT m2_i2 /* number of process where vector is */
362 #define DIO_OFFSET m2_i1 /* offset from grant */
364 /* Field names for SYS_SIGNARLM, SYS_FLAGARLM, SYS_SYNCALRM. */
365 #define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */
366 #define ALRM_ABS_TIME m2_i2 /* set to 1 to use absolute alarm time */
367 #define ALRM_TIME_LEFT m2_l1 /* how many ticks were remaining */
368 #define ALRM_ENDPT m2_i1 /* which process wants the alarm? */
369 #define ALRM_FLAG_PTR m2_p1 /* virtual address of timeout flag */
371 /* Field names for SYS_IRQCTL. */
372 #define IRQ_REQUEST m5_c1 /* what to do? */
373 # define IRQ_SETPOLICY 1 /* manage a slot of the IRQ table */
374 # define IRQ_RMPOLICY 2 /* remove a slot of the IRQ table */
375 # define IRQ_ENABLE 3 /* enable interrupts */
376 # define IRQ_DISABLE 4 /* disable interrupts */
377 #define IRQ_VECTOR m5_c2 /* irq vector */
378 #define IRQ_POLICY m5_i1 /* options for IRQCTL request */
379 # define IRQ_REENABLE 0x001 /* reenable IRQ line after interrupt */
380 # define IRQ_BYTE 0x100 /* byte values */
381 # define IRQ_WORD 0x200 /* word values */
382 # define IRQ_LONG 0x400 /* long values */
383 #define IRQ_ENDPT m5_i2 /* endpoint number, SELF, NONE */
384 #define IRQ_HOOK_ID m5_l3 /* id of irq hook at kernel */
386 /* Field names for SYS_SEGCTL. */
387 #define SEG_SELECT m4_l1 /* segment selector returned */
388 #define SEG_OFFSET m4_l2 /* offset in segment returned */
389 #define SEG_PHYS m4_l3 /* physical address of segment */
390 #define SEG_SIZE m4_l4 /* segment size */
391 #define SEG_INDEX m4_l5 /* segment index in remote map */
393 /* Field names for SYS_VIDCOPY. */
394 #define VID_REQUEST m4_l1 /* what to do? */
395 # define VID_VID_COPY 1 /* request vid_vid_copy() */
396 # define MEM_VID_COPY 2 /* request mem_vid_copy() */
397 #define VID_SRC_ADDR m4_l2 /* virtual address in memory */
398 #define VID_SRC_OFFSET m4_l3 /* offset in video memory */
399 #define VID_DST_OFFSET m4_l4 /* offset in video memory */
400 #define VID_CP_COUNT m4_l5 /* number of words to be copied */
402 /* Field names for SYS_ABORT. */
403 #define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */
404 #define ABRT_MON_ENDPT m1_i2 /* process where monitor params are */
405 #define ABRT_MON_LEN m1_i3 /* length of monitor params */
406 #define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */
408 /* Field names for _UMAP, _VIRCOPY, _PHYSCOPY. */
409 #define CP_SRC_SPACE m5_c1 /* T or D space (stack is also D) */
410 #define CP_SRC_ENDPT m5_i1 /* process to copy from */
411 #define CP_SRC_ADDR m5_l1 /* address where data come from */
412 #define CP_DST_SPACE m5_c2 /* T or D space (stack is also D) */
413 #define CP_DST_ENDPT m5_i2 /* process to copy to */
414 #define CP_DST_ADDR m5_l2 /* address where data go to */
415 #define CP_NR_BYTES m5_l3 /* number of bytes to copy */
417 /* Field names for SYS_VCOPY and SYS_VVIRCOPY. */
418 #define VCP_NR_OK m1_i2 /* number of successfull copies */
419 #define VCP_VEC_SIZE m1_i3 /* size of copy vector */
420 #define VCP_VEC_ADDR m1_p1 /* pointer to copy vector */
422 /* Field names for SYS_GETINFO. */
423 #define I_REQUEST m7_i3 /* what info to get */
424 # define GET_KINFO 0 /* get kernel information structure */
425 # define GET_IMAGE 1 /* get system image table */
426 # define GET_PROCTAB 2 /* get kernel process table */
427 # define GET_RANDOMNESS 3 /* get randomness buffer */
428 # define GET_MONPARAMS 4 /* get monitor parameters */
429 # define GET_KENV 5 /* get kernel environment string */
430 # define GET_IRQHOOKS 6 /* get the IRQ table */
431 # define GET_KMESSAGES 7 /* get kernel messages */
432 # define GET_PRIVTAB 8 /* get kernel privileges table */
433 # define GET_KADDRESSES 9 /* get various kernel addresses */
434 # define GET_SCHEDINFO 10 /* get scheduling queues */
435 # define GET_PROC 11 /* get process slot if given process */
436 # define GET_MACHINE 12 /* get machine information */
437 # define GET_LOCKTIMING 13 /* get lock()/unlock() latency timing */
438 # define GET_BIOSBUFFER 14 /* get a buffer for BIOS calls */
439 # define GET_LOADINFO 15 /* get load average information */
440 #define I_ENDPT m7_i4 /* calling process */
441 #define I_VAL_PTR m7_p1 /* virtual address at caller */
442 #define I_VAL_LEN m7_i1 /* max length of value */
443 #define I_VAL_PTR2 m7_p2 /* second virtual address */
444 #define I_VAL_LEN2_E m7_i2 /* second length, or proc nr */
445 # define GET_IRQACTIDS 16 /* get the IRQ masks */
447 /* Field names for SYS_TIMES. */
448 #define T_ENDPT m4_l1 /* process to request time info for */
449 #define T_USER_TIME m4_l1 /* user time consumed by process */
450 #define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
451 #define T_CHILD_UTIME m4_l3 /* user time consumed by process' children */
452 #define T_CHILD_STIME m4_l4 /* sys time consumed by process' children */
453 #define T_BOOT_TICKS m4_l5 /* number of clock ticks since boot time */
455 /* vm_map */
456 #define VM_MAP_ENDPT m4_l1
457 #define VM_MAP_MAPUNMAP m4_l2
458 #define VM_MAP_BASE m4_l3
459 #define VM_MAP_SIZE m4_l4
460 #define VM_MAP_ADDR m4_l5
462 /* Field names for SYS_TRACE, SYS_PRIVCTL. */
463 #define CTL_ENDPT m2_i1 /* process number of the caller */
464 #define CTL_REQUEST m2_i2 /* server control request */
465 #define CTL_MM_PRIV m2_i3 /* privilege as seen by PM */
466 #define CTL_ARG_PTR m2_p1 /* pointer to argument */
467 #define CTL_ADDRESS m2_l1 /* address at traced process' space */
468 #define CTL_DATA m2_l2 /* data field for tracing */
470 /* Field names for SYS_SETGRANT */
471 #define SG_ADDR m2_p1 /* address */
472 #define SG_SIZE m2_i2 /* no. of entries */
474 /* Field names for SYS_KILL, SYS_SIGCTL */
475 #define SIG_REQUEST m2_l2 /* PM signal control request */
476 #define S_GETSIG 0 /* get pending kernel signal */
477 #define S_ENDSIG 1 /* finish a kernel signal */
478 #define S_SENDSIG 2 /* POSIX style signal handling */
479 #define S_SIGRETURN 3 /* return from POSIX handling */
480 #define S_KILL 4 /* servers kills process with signal */
481 #define SIG_ENDPT m2_i1 /* process number for inform */
482 #define SIG_NUMBER m2_i2 /* signal number to send */
483 #define SIG_FLAGS m2_i3 /* signal flags field */
484 #define SIG_MAP m2_l1 /* used by kernel to pass signal bit map */
485 #define SIG_CTXT_PTR m2_p1 /* pointer to info to restore signal context */
487 /* Field names for SYS_FORK, _EXEC, _EXIT, _NEWMAP. */
488 #define PR_ENDPT m1_i1 /* indicates a process */
489 #define PR_PRIORITY m1_i2 /* process priority */
490 #define PR_SLOT m1_i2 /* indicates a process slot */
491 #define PR_PID m1_i3 /* process id at process manager */
492 #define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
493 #define PR_TRACING m1_i3 /* flag to indicate tracing is on/ off */
494 #define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
495 #define PR_IP_PTR m1_p3 /* initial value for ip after exec */
496 #define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap
497 * and sys_fork
500 /* Field names for SYS_INT86 */
501 #define INT86_REG86 m1_p1 /* pointer to registers */
503 /* Field names for SYS_SAFECOPY* */
504 #define SCP_FROM_TO m2_i1 /* from/to whom? */
505 #define SCP_INFO m2_i2 /* byte: DDDDSSSS Dest and Src seg */
506 #define SCP_GID m2_i3 /* grant id */
507 #define SCP_OFFSET m2_l1 /* offset within grant */
508 #define SCP_ADDRESS m2_p1 /* my own address */
509 #define SCP_BYTES m2_l2 /* bytes from offset */
511 /* Field names for SYS_VSAFECOPY* */
512 #define VSCP_VEC_ADDR m2_p1 /* start of vector */
513 #define VSCP_VEC_SIZE m2_l2 /* elements in vector */
515 /* For the SCP_INFO field: encoding and decoding. */
516 #define SCP_MAKEINFO(seg) ((seg) & 0xffff)
517 #define SCP_INFO2SEG(info) ((info) & 0xffff)
519 /* Field names for SELECT (FS). */
520 #define SEL_NFDS m8_i1
521 #define SEL_READFDS m8_p1
522 #define SEL_WRITEFDS m8_p2
523 #define SEL_ERRORFDS m8_p3
524 #define SEL_TIMEOUT m8_p4
526 /* Field names for SYS_SPROF, _CPROF, _PROFBUF. */
527 #define PROF_ACTION m7_i1 /* start/stop/reset/get */
528 #define PROF_MEM_SIZE m7_i2 /* available memory for data */
529 #define PROF_FREQ m7_i3 /* sample frequency */
530 #define PROF_ENDPT m7_i4 /* endpoint of caller */
531 #define PROF_CTL_PTR m7_p1 /* location of info struct */
532 #define PROF_MEM_PTR m7_p2 /* location of profiling data */
534 /* Field names for GETSYSINFO_UP (PM). */
535 #define SIU_WHAT m2_i1
536 #define SIU_LEN m2_i2
537 #define SIU_WHERE m2_p1
539 /* Message for SYS_READBIOS */
540 #define RDB_SIZE m2_i1
541 #define RDB_ADDR m2_l1
542 #define RDB_BUF m2_p1
544 /*===========================================================================*
545 * Messages for the Reincarnation Server *
546 *===========================================================================*/
548 #define RS_RQ_BASE 0x700
550 #define RS_UP (RS_RQ_BASE + 0) /* start system service */
551 #define RS_DOWN (RS_RQ_BASE + 1) /* stop system service */
552 #define RS_REFRESH (RS_RQ_BASE + 2) /* refresh system service */
553 #define RS_RESTART (RS_RQ_BASE + 3) /* restart system service */
554 #define RS_SHUTDOWN (RS_RQ_BASE + 5) /* alert about shutdown */
555 #define RS_UP_COPY (RS_RQ_BASE + 6) /* start system service and
556 * keep the binary in memory
558 #define RS_START (RS_RQ_BASE + 7) /* start a driver/service
559 * arguments are passed in
560 * a struct rs_start
563 # define RS_CMD_ADDR m1_p1 /* command string */
564 # define RS_CMD_LEN m1_i1 /* length of command */
565 # define RS_PERIOD m1_i2 /* heartbeat period */
566 # define RS_DEV_MAJOR m1_i3 /* major device number */
568 # define RS_ENDPOINT m1_i1 /* endpoint number in reply */
570 /*===========================================================================*
571 * Messages for the Data Store Server *
572 *===========================================================================*/
574 #define DS_RQ_BASE 0x800
576 #define DS_PUBLISH (DS_RQ_BASE + 0) /* publish information */
577 #define DS_SUBSCRIBE (DS_RQ_BASE + 1) /* subscribe to information */
578 #define DS_RETRIEVE (DS_RQ_BASE + 2) /* retrieve information by name */
579 #define DS_CHECK (DS_RQ_BASE + 3) /* retrieve updated information */
581 /* DS field names: DS_SUBSCRIBE, DS_PUBLISH, DS_RETRIEVE */
582 # define DS_KEY_GRANT m2_p1 /* key for the information */
583 # define DS_KEY_LEN m2_i1 /* length of key incl. '\0' */
584 # define DS_FLAGS m2_i2 /* flags provided by caller */
586 /* DS_PUBLISH, DS_RETRIEVE */
587 # define DS_VAL m2_l1 /* data (u32, char *, etc.) */
588 # define DS_VAL_LEN m2_l2 /* data length */
590 /*===========================================================================*
591 * Miscellaneous messages used by TTY *
592 *===========================================================================*/
594 /* Miscellaneous request types and field names, e.g. used by IS server. */
595 #define FKEY_CONTROL 98 /* control a function key at the TTY */
596 # define FKEY_REQUEST m2_i1 /* request to perform at TTY */
597 # define FKEY_MAP 10 /* observe function key */
598 # define FKEY_UNMAP 11 /* stop observing function key */
599 # define FKEY_EVENTS 12 /* request open key presses */
600 # define FKEY_FKEYS m2_l1 /* F1-F12 keys pressed */
601 # define FKEY_SFKEYS m2_l2 /* Shift-F1-F12 keys pressed */
602 #define DIAG_BASE 0xa00
603 #define DIAGNOSTICS (DIAG_BASE+1) /* output a string without FS in between */
604 #define DIAGNOSTICS_S (DIAG_BASE+2) /* grant-based version of DIAGNOSTICS */
605 # define DIAG_PRINT_BUF_G m1_p1
606 # define DIAG_BUF_COUNT m1_i1
607 #define GET_KMESS (DIAG_BASE+3) /* get kmess from TTY */
608 # define GETKM_PTR m1_p1
609 #define GET_KMESS_S (DIAG_BASE+4) /* get kmess from TTY */
610 # define GETKM_GRANT m1_i1
612 #define PM_BASE 0x900
613 #define PM_GET_WORK (PM_BASE + 1) /* Get work from PM */
614 #define PM_IDLE (PM_BASE + 2) /* PM doesn't have any more work */
615 #define PM_BUSY (PM_BASE + 3) /* A reply from FS is needed */
616 #define PM_STIME (PM_BASE + 4) /* Tell FS about the new system time */
617 #define PM_STIME_TIME m1_i1 /* boottime */
618 #define PM_SETSID (PM_BASE + 5) /* Tell FS about the session leader */
619 #define PM_SETSID_PROC m1_i1 /* process */
620 #define PM_SETGID (PM_BASE + 6) /* Tell FS about the new group IDs */
621 #define PM_SETGID_PROC m1_i1 /* process */
622 #define PM_SETGID_EGID m1_i2 /* effective group id */
623 #define PM_SETGID_RGID m1_i3 /* real group id */
624 #define PM_SETUID (PM_BASE + 7) /* Tell FS about the new user IDs */
625 #define PM_SETUID_PROC m1_i1 /* process */
626 #define PM_SETUID_EGID m1_i2 /* effective user id */
627 #define PM_SETUID_RGID m1_i3 /* real user id */
628 #define PM_FORK (PM_BASE + 8) /* Tell FS about the new process */
629 #define PM_FORK_PPROC m1_i1 /* parent process */
630 #define PM_FORK_CPROC m1_i2 /* child process */
631 #define PM_FORK_CPID m1_i3 /* child pid */
632 #define PM_EXIT (PM_BASE + 9) /* Tell FS about the exiting process */
633 #define PM_EXIT_PROC m1_i1 /* process */
634 #define PM_UNPAUSE (PM_BASE + 10) /* interrupted process */
635 #define PM_UNPAUSE_PROC m1_i1 /* process */
636 #define PM_REBOOT (PM_BASE + 11) /* Tell FS that we about to reboot */
637 #define PM_EXEC (PM_BASE + 12) /* Forward exec call to FS */
638 #define PM_EXEC_PROC m1_i1 /* process */
639 #define PM_EXEC_PATH m1_p1 /* executable */
640 #define PM_EXEC_PATH_LEN m1_i2 /* length of path including
641 * terminating nul
643 #define PM_EXEC_FRAME m1_p2 /* arguments and environment */
644 #define PM_EXEC_FRAME_LEN m1_i3 /* size of frame */
645 #define PM_FORK_NB (PM_BASE + 13) /* Tell FS about the fork_nb call */
646 #define PM_DUMPCORE (PM_BASE + 14) /* Ask FS to generate a core dump */
647 #define PM_CORE_PROC m1_i1
648 #define PM_CORE_SEGPTR m1_p1
649 #define PM_UNPAUSE_TR (PM_BASE + 15) /* interrupted process (for tracing) */
650 #define PM_EXIT_TR (PM_BASE + 16) /* Tell FS about the exiting process
651 * (for tracing)
654 /* Replies */
655 #define PM_EXIT_REPLY (PM_BASE + 20) /* Reply from FS */
656 #define PM_REBOOT_REPLY (PM_BASE + 21) /* Reply from FS */
657 #define PM_EXEC_REPLY (PM_BASE + 22) /* Reply from FS */
658 /* PM_EXEC_PROC m1_i1 */
659 #define PM_EXEC_STATUS m1_i2 /* OK or failure */
660 #define PM_CORE_REPLY (PM_BASE + 23) /* Reply from FS */
661 /* PM_CORE_PROC m1_i1 */
662 #define PM_CORE_STATUS m1_i2 /* OK or failure */
663 #define PM_EXIT_REPLY_TR (PM_BASE + 24) /* Reply from FS */
665 /* Parameters for the EXEC_NEWMEM call */
666 #define EXC_NM_PROC m1_i1 /* process that needs new map */
667 #define EXC_NM_PTR m1_p1 /* parameters in struct exec_newmem */
668 /* Results:
669 * the status will be in m_type.
670 * the top of the stack will be in m1_i1.
671 * the following flags will be in m1_i2:
673 #define EXC_NM_RF_LOAD_TEXT 1 /* Load text segment (otherwise the
674 * text segment is already present)
676 #define EXC_NM_RF_ALLOW_SETUID 2 /* Setuid execution is allowed (tells
677 * FS to update its uid and gid
678 * fields.
681 /* Parameters for the EXEC_RESTART call */
682 #define EXC_RS_PROC m1_i1 /* process that needs to be restarted */
683 #define EXC_RS_RESULT m1_i2 /* result of the exec */
686 #endif /* _MINIX_COM_H */