drop safemap code
[minix.git] / include / minix / com.h
blobc71b1c3c000b17b0e00deb84ad7c0e954de12a23
1 /* This file defines constants for use in message communication (mostly)
2 * between system processes.
4 * A number of protocol message request and response types are defined. For
5 * debugging purposes, each protocol is assigned its own unique number range.
6 * The following such message type ranges have been allocated:
8 * 1 - 0xFF POSIX requests (see callnr.h)
9 * 0x200 - 0x2FF Data link layer requests and responses
10 * 0x300 - 0x3FF Bus controller requests and responses
11 * 0x400 - 0x4FF Character device requests
12 * 0x500 - 0x5FF Character device responses
13 * 0x600 - 0x6FF Kernel calls to SYSTEM task
14 * 0x700 - 0x7FF Reincarnation Server (RS) requests
15 * 0x800 - 0x8FF Data Store (DS) requests
16 * 0x900 - 0x9FF Requests from PM to VFS, and responses
17 * 0xA00 - 0xAFF Requests from VFS to file systems (see vfsif.h)
18 * 0xB00 - 0xBFF Requests from VM to VFS
19 * 0xC00 - 0xCFF Virtual Memory (VM) requests
20 * 0xD00 - 0xDFF IPC server requests
21 * 0xE00 - 0xEFF Common system messages (e.g. system signals)
22 * 0xF00 - 0xFFF Scheduling messages
23 * 0x1000 - 0x10FF Notify messages
24 * 0x1100 - 0x11FF USB
25 * 0x1200 - 0x12FF Devman
26 * 0x1300 - 0x13FF TTY Input
27 * 0x1400 - 0x14FF VFS-FS transaction IDs
28 * 0x1500 - 0x15FF Block device requests and responses
29 * 0x1600 - 0x16FF VirtualBox (VBOX) requests (see vboxif.h)
31 * Zero and negative values are widely used for OK and error responses.
34 #ifndef _MINIX_COM_H
35 #define _MINIX_COM_H
37 /*===========================================================================*
38 * Magic process numbers *
39 *===========================================================================*/
41 /* These may not be any valid endpoint (see <minix/endpoint.h>). */
42 #define ANY ((endpoint_t) 0x7ace) /* used to indicate 'any process' */
43 #define NONE ((endpoint_t) 0x6ace) /* used to indicate 'no process at all' */
44 #define SELF ((endpoint_t) 0x8ace) /* used to indicate 'own process' */
45 #define _MAX_MAGIC_PROC (SELF) /* used by <minix/endpoint.h>
46 to determine generation size */
48 /*===========================================================================*
49 * Process numbers of processes in the system image *
50 *===========================================================================*/
52 /* The values of several task numbers depend on whether they or other tasks
53 * are enabled. They are defined as (PREVIOUS_TASK - ENABLE_TASK) in general.
54 * ENABLE_TASK is either 0 or 1, so a task either gets a new number, or gets
55 * the same number as the previous task and is further unused. Note that the
56 * order should correspond to the order in the task table defined in table.c.
59 /* Kernel tasks. These all run in the same address space. */
60 #define ASYNCM ((endpoint_t) -5) /* notifies about finished async sends */
61 #define IDLE ((endpoint_t) -4) /* runs when no one else can run */
62 #define CLOCK ((endpoint_t) -3) /* alarms and other clock functions */
63 #define SYSTEM ((endpoint_t) -2) /* request system functionality */
64 #define KERNEL ((endpoint_t) -1) /* pseudo-process for IPC and scheduling */
65 #define HARDWARE KERNEL /* for hardware interrupt handlers */
67 /* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
68 #define MAX_NR_TASKS 1023
69 #define NR_TASKS 5
71 /* User-space processes, that is, device drivers, servers, and INIT. */
72 #define PM_PROC_NR ((endpoint_t) 0) /* process manager */
73 #define VFS_PROC_NR ((endpoint_t) 1) /* file system */
74 #define RS_PROC_NR ((endpoint_t) 2) /* reincarnation server */
75 #define MEM_PROC_NR ((endpoint_t) 3) /* memory driver (RAM disk, null, etc.) */
76 #define LOG_PROC_NR ((endpoint_t) 4) /* log device driver */
77 #define TTY_PROC_NR ((endpoint_t) 5) /* terminal (TTY) driver */
78 #define DS_PROC_NR ((endpoint_t) 6) /* data store server */
79 #define MFS_PROC_NR ((endpoint_t) 7) /* minix root filesystem */
80 #define VM_PROC_NR ((endpoint_t) 8) /* memory server */
81 #define PFS_PROC_NR ((endpoint_t) 9) /* pipe filesystem */
82 #define SCHED_PROC_NR ((endpoint_t) 10) /* scheduler */
83 #define LAST_SPECIAL_PROC_NR 11 /* An untyped version for
84 computation in macros.*/
85 #define INIT_PROC_NR ((endpoint_t) LAST_SPECIAL_PROC_NR) /* init
86 -- goes multiuser */
88 /* Root system process and root user process. */
89 #define ROOT_SYS_PROC_NR RS_PROC_NR
90 #define ROOT_USR_PROC_NR INIT_PROC_NR
92 /*===========================================================================*
93 * Kernel notification types *
94 *===========================================================================*/
96 /* Kernel notification types. In principle, these can be sent to any process,
97 * so make sure that these types do not interfere with other message types.
98 * Notifications are prioritized because of the way they are unhold() and
99 * blocking notifications are delivered. The lowest numbers go first. The
100 * offset are used for the per-process notification bit maps.
102 #define NOTIFY_MESSAGE 0x1000
103 /* FIXME the old is_notify(a) should be replaced by is_ipc_notify(status). */
104 #define is_ipc_notify(ipc_status) (IPC_STATUS_CALL(ipc_status) == NOTIFY)
105 #define is_notify(a) ((unsigned) ((a) - NOTIFY_MESSAGE) < 0x100)
106 #define is_ipc_asynch(ipc_status) \
107 (is_ipc_notify(ipc_status) || IPC_STATUS_CALL(ipc_status) == SENDA)
109 /* Shorthands for message parameters passed with notifications. */
110 #define NOTIFY_ARG m2_l1
111 #define NOTIFY_TIMESTAMP m2_l2
113 /*===========================================================================*
114 * Messages for BUS controller drivers *
115 *===========================================================================*/
116 #define BUSC_RQ_BASE 0x300 /* base for request types */
117 #define BUSC_RS_BASE 0x380 /* base for response types */
119 #define BUSC_PCI_INIT (BUSC_RQ_BASE + 0) /* First message to
120 * PCI driver
122 #define BUSC_PCI_FIRST_DEV (BUSC_RQ_BASE + 1) /* Get index (and
123 * vid/did) of the
124 * first PCI device
126 #define BUSC_PCI_NEXT_DEV (BUSC_RQ_BASE + 2) /* Get index (and
127 * vid/did) of the
128 * next PCI device
130 #define BUSC_PCI_FIND_DEV (BUSC_RQ_BASE + 3) /* Get index of a
131 * PCI device based on
132 * bus/dev/function
134 #define BUSC_PCI_IDS (BUSC_RQ_BASE + 4) /* Get vid/did from an
135 * index
137 #define BUSC_PCI_RESERVE (BUSC_RQ_BASE + 7) /* Reserve a PCI dev */
138 #define BUSC_PCI_ATTR_R8 (BUSC_RQ_BASE + 8) /* Read 8-bit
139 * attribute value
141 #define BUSC_PCI_ATTR_R16 (BUSC_RQ_BASE + 9) /* Read 16-bit
142 * attribute value
144 #define BUSC_PCI_ATTR_R32 (BUSC_RQ_BASE + 10) /* Read 32-bit
145 * attribute value
147 #define BUSC_PCI_ATTR_W8 (BUSC_RQ_BASE + 11) /* Write 8-bit
148 * attribute value
150 #define BUSC_PCI_ATTR_W16 (BUSC_RQ_BASE + 12) /* Write 16-bit
151 * attribute value
153 #define BUSC_PCI_ATTR_W32 (BUSC_RQ_BASE + 13) /* Write 32-bit
154 * attribute value
156 #define BUSC_PCI_RESCAN (BUSC_RQ_BASE + 14) /* Rescan bus */
157 #define BUSC_PCI_DEV_NAME_S (BUSC_RQ_BASE + 15) /* Get the name of a
158 * PCI device
159 * (safecopy)
161 #define BUSC_PCI_SLOT_NAME_S (BUSC_RQ_BASE + 16) /* Get the name of a
162 * PCI slot (safecopy)
164 #define BUSC_PCI_SET_ACL (BUSC_RQ_BASE + 17) /* Set the ACL for a
165 * driver (safecopy)
167 #define BUSC_PCI_DEL_ACL (BUSC_RQ_BASE + 18) /* Delete the ACL of a
168 * driver
170 #define BUSC_PCI_GET_BAR (BUSC_RQ_BASE + 19) /* Get Base Address
171 * Register properties
173 #define BUSC_PGB_DEVIND m2_i1 /* device index */
174 #define BUSC_PGB_PORT m2_i2 /* port (BAR offset) */
175 #define BUSC_PGB_BASE m2_l1 /* BAR base address */
176 #define BUSC_PGB_SIZE m2_l2 /* BAR size */
177 #define BUSC_PGB_IOFLAG m2_i1 /* I/O space? */
178 #define IOMMU_MAP (BUSC_RQ_BASE + 32) /* Ask IOMMU to map
179 * a segment of memory
183 /*===========================================================================*
184 * Messages for CHARACTER device drivers *
185 *===========================================================================*/
187 /* Message types for character device drivers. */
188 #define DEV_RQ_BASE 0x400 /* base for character device request types */
189 #define DEV_RS_BASE 0x500 /* base for character device response types */
191 #define CANCEL (DEV_RQ_BASE + 0) /* force a task to cancel */
192 #define DEV_OPEN (DEV_RQ_BASE + 6) /* open a minor device */
193 #define DEV_CLOSE (DEV_RQ_BASE + 7) /* close a minor device */
194 #define DEV_SELECT (DEV_RQ_BASE + 12) /* request select() attention */
195 #define DEV_STATUS (DEV_RQ_BASE + 13) /* request driver status */
196 #define DEV_REOPEN (DEV_RQ_BASE + 14) /* reopen a minor device */
198 #define DEV_READ_S (DEV_RQ_BASE + 20) /* (safecopy) read from minor */
199 #define DEV_WRITE_S (DEV_RQ_BASE + 21) /* (safecopy) write to minor */
200 #define DEV_SCATTER_S (DEV_RQ_BASE + 22) /* (safecopy) write from a vector */
201 #define DEV_GATHER_S (DEV_RQ_BASE + 23) /* (safecopy) read into a vector */
202 #define DEV_IOCTL_S (DEV_RQ_BASE + 24) /* (safecopy) I/O control code */
204 #define IS_DEV_RQ(type) (((type) & ~0xff) == DEV_RQ_BASE)
206 #define DEV_REVIVE (DEV_RS_BASE + 2) /* driver revives process */
207 #define DEV_IO_READY (DEV_RS_BASE + 3) /* selected device ready */
208 #define DEV_NO_STATUS (DEV_RS_BASE + 4) /* empty status reply */
209 #define DEV_REOPEN_REPL (DEV_RS_BASE + 5) /* reply to DEV_REOPEN */
210 #define DEV_CLOSE_REPL (DEV_RS_BASE + 6) /* reply to DEV_CLOSE */
211 #define DEV_SEL_REPL1 (DEV_RS_BASE + 7) /* first reply to DEV_SELECT */
212 #define DEV_SEL_REPL2 (DEV_RS_BASE + 8) /* (opt) second reply to DEV_SELECT */
213 #define DEV_OPEN_REPL (DEV_RS_BASE + 9) /* reply to DEV_OPEN */
215 #define IS_DEV_RS(type) (((type) & ~0xff) == DEV_RS_BASE)
217 /* Field names for messages to character device drivers. */
218 #define DEVICE m2_i1 /* major-minor device */
219 #define USER_ENDPT m2_i2 /* which endpoint initiated this call? */
220 #define COUNT m2_i3 /* how many bytes to transfer */
221 #define REQUEST m2_i3 /* ioctl request code */
222 #define POSITION m2_l1 /* file offset (low 4 bytes) */
223 #define HIGHPOS m2_l2 /* file offset (high 4 bytes) */
224 #define ADDRESS m2_p1 /* core buffer address */
225 #define IO_GRANT m2_p1 /* grant id (for DEV_*_S variants) */
226 #define FLAGS m2_s1 /* operation flags */
228 #define FLG_OP_NONBLOCK 0x1 /* operation is non blocking */
230 /* Field names for DEV_SELECT messages to character device drivers. */
231 #define DEV_MINOR m2_i1 /* minor device */
232 #define DEV_SEL_OPS m2_i2 /* which select operations are requested */
234 /* Field names used in reply messages from tasks. */
235 #define REP_ENDPT m2_i1 /* # of proc on whose behalf I/O was done */
236 #define REP_STATUS m2_i2 /* bytes transferred or error number */
237 #define REP_IO_GRANT m2_i3 /* DEV_REVIVE: grant by which I/O was done */
238 # define SUSPEND -998 /* status to suspend caller, reply later */
240 /* Field names for messages to TTY driver. */
241 #define TTY_LINE DEVICE /* message parameter: terminal line */
242 #define TTY_REQUEST COUNT /* message parameter: ioctl request code */
243 #define TTY_SPEK POSITION/* message parameter: ioctl speed, erasing */
244 #define TTY_PGRP m2_i3 /* message parameter: process group */
246 /*===========================================================================*
247 * Messages for networking layer *
248 *===========================================================================*/
250 /* Base type for data link layer requests and responses. */
251 #define DL_RQ_BASE 0x200
252 #define DL_RS_BASE 0x280
254 /* Message types for data link layer requests. */
255 #define DL_CONF (DL_RQ_BASE + 0)
256 #define DL_GETSTAT_S (DL_RQ_BASE + 1)
257 #define DL_WRITEV_S (DL_RQ_BASE + 2)
258 #define DL_READV_S (DL_RQ_BASE + 3)
260 /* Message type for data link layer replies. */
261 #define DL_CONF_REPLY (DL_RS_BASE + 0)
262 #define DL_STAT_REPLY (DL_RS_BASE + 1)
263 #define DL_TASK_REPLY (DL_RS_BASE + 2)
265 /* Field names for data link layer messages. */
266 #define DL_COUNT m2_i3
267 #define DL_MODE m2_l1
268 #define DL_FLAGS m2_l1
269 #define DL_GRANT m2_l2
270 #define DL_STAT m3_i1
271 #define DL_HWADDR m3_ca1
273 /* Bits in 'DL_FLAGS' field of DL replies. */
274 # define DL_NOFLAGS 0x00
275 # define DL_PACK_SEND 0x01
276 # define DL_PACK_RECV 0x02
278 /* Bits in 'DL_MODE' field of DL requests. */
279 # define DL_NOMODE 0x0
280 # define DL_PROMISC_REQ 0x1
281 # define DL_MULTI_REQ 0x2
282 # define DL_BROAD_REQ 0x4
284 /*===========================================================================*
285 * SYSTASK request types and field names *
286 *===========================================================================*/
288 /* System library calls are dispatched via a call vector, so be careful when
289 * modifying the system call numbers. The numbers here determine which call
290 * is made from the call vector.
292 #define KERNEL_CALL 0x600 /* base for kernel calls to SYSTEM */
294 # define SYS_FORK (KERNEL_CALL + 0) /* sys_fork() */
295 # define SYS_EXEC (KERNEL_CALL + 1) /* sys_exec() */
296 # define SYS_CLEAR (KERNEL_CALL + 2) /* sys_clear() */
297 # define SYS_SCHEDULE (KERNEL_CALL + 3) /* sys_schedule() */
298 # define SYS_PRIVCTL (KERNEL_CALL + 4) /* sys_privctl() */
299 # define SYS_TRACE (KERNEL_CALL + 5) /* sys_trace() */
300 # define SYS_KILL (KERNEL_CALL + 6) /* sys_kill() */
302 # define SYS_GETKSIG (KERNEL_CALL + 7) /* sys_getsig() */
303 # define SYS_ENDKSIG (KERNEL_CALL + 8) /* sys_endsig() */
304 # define SYS_SIGSEND (KERNEL_CALL + 9) /* sys_sigsend() */
305 # define SYS_SIGRETURN (KERNEL_CALL + 10) /* sys_sigreturn() */
307 # define SYS_MEMSET (KERNEL_CALL + 13) /* sys_memset() */
309 # define SYS_UMAP (KERNEL_CALL + 14) /* sys_umap() */
310 # define SYS_VIRCOPY (KERNEL_CALL + 15) /* sys_vircopy() */
311 # define SYS_PHYSCOPY (KERNEL_CALL + 16) /* sys_physcopy() */
312 # define SYS_UMAP_REMOTE (KERNEL_CALL + 17) /* sys_umap_remote() */
313 # define SYS_VUMAP (KERNEL_CALL + 18) /* sys_vumap() */
315 # define SYS_IRQCTL (KERNEL_CALL + 19) /* sys_irqctl() */
316 # define SYS_INT86 (KERNEL_CALL + 20) /* sys_int86() */
317 # define SYS_DEVIO (KERNEL_CALL + 21) /* sys_devio() */
318 # define SYS_SDEVIO (KERNEL_CALL + 22) /* sys_sdevio() */
319 # define SYS_VDEVIO (KERNEL_CALL + 23) /* sys_vdevio() */
321 # define SYS_SETALARM (KERNEL_CALL + 24) /* sys_setalarm() */
322 # define SYS_TIMES (KERNEL_CALL + 25) /* sys_times() */
323 # define SYS_GETINFO (KERNEL_CALL + 26) /* sys_getinfo() */
324 # define SYS_ABORT (KERNEL_CALL + 27) /* sys_abort() */
325 # define SYS_IOPENABLE (KERNEL_CALL + 28) /* sys_enable_iop() */
326 # define SYS_SAFECOPYFROM (KERNEL_CALL + 31) /* sys_safecopyfrom() */
327 # define SYS_SAFECOPYTO (KERNEL_CALL + 32) /* sys_safecopyto() */
328 # define SYS_VSAFECOPY (KERNEL_CALL + 33) /* sys_vsafecopy() */
329 # define SYS_SETGRANT (KERNEL_CALL + 34) /* sys_setgrant() */
330 # define SYS_READBIOS (KERNEL_CALL + 35) /* sys_readbios() */
332 # define SYS_SPROF (KERNEL_CALL + 36) /* sys_sprof() */
333 # define SYS_CPROF (KERNEL_CALL + 37) /* sys_cprof() */
334 # define SYS_PROFBUF (KERNEL_CALL + 38) /* sys_profbuf() */
336 # define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
338 # define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
339 # define SYS_SYSCTL (KERNEL_CALL + 44) /* sys_sysctl() */
341 # define SYS_VTIMER (KERNEL_CALL + 45) /* sys_vtimer() */
342 # define SYS_RUNCTL (KERNEL_CALL + 46) /* sys_runctl() */
343 # define SYS_GETMCONTEXT (KERNEL_CALL + 50) /* sys_getmcontext() */
344 # define SYS_SETMCONTEXT (KERNEL_CALL + 51) /* sys_setmcontext() */
346 # define SYS_UPDATE (KERNEL_CALL + 52) /* sys_update() */
347 # define SYS_EXIT (KERNEL_CALL + 53) /* sys_exit() */
349 # define SYS_SCHEDCTL (KERNEL_CALL + 54) /* sys_schedctl() */
350 # define SYS_STATECTL (KERNEL_CALL + 55) /* sys_statectl() */
352 # define SYS_SAFEMEMSET (KERNEL_CALL + 56) /* sys_safememset() */
354 /* Total */
355 #define NR_SYS_CALLS 57 /* number of kernel calls */
357 #define SYS_CALL_MASK_SIZE BITMAP_CHUNKS(NR_SYS_CALLS)
359 /* Basic kernel calls allowed to every system process. */
360 #define SYS_BASIC_CALLS \
361 SYS_EXIT, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, SYS_VSAFECOPY, SYS_GETINFO, \
362 SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \
363 SYS_PROFBUF, SYS_SYSCTL, SYS_STATECTL, SYS_SAFEMEMSET
365 /* Field names for SYS_MEMSET. */
366 #define MEM_PTR m2_p1 /* base */
367 #define MEM_COUNT m2_l1 /* count */
368 #define MEM_PATTERN m2_l2 /* pattern to write */
369 #define MEM_PROCESS m2_i1 /* NONE (phys) or process id (vir) */
371 /* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
372 #define DIO_REQUEST m2_i3 /* device in or output */
373 # define _DIO_INPUT 0x001
374 # define _DIO_OUTPUT 0x002
375 # define _DIO_DIRMASK 0x00f
376 # define _DIO_BYTE 0x010
377 # define _DIO_WORD 0x020
378 # define _DIO_LONG 0x030
379 # define _DIO_TYPEMASK 0x0f0
380 # define _DIO_SAFE 0x100
381 # define _DIO_SAFEMASK 0xf00
382 # define DIO_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE)
383 # define DIO_INPUT_WORD (_DIO_INPUT|_DIO_WORD)
384 # define DIO_INPUT_LONG (_DIO_INPUT|_DIO_LONG)
385 # define DIO_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE)
386 # define DIO_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD)
387 # define DIO_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG)
388 # define DIO_SAFE_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
389 # define DIO_SAFE_INPUT_WORD (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
390 # define DIO_SAFE_INPUT_LONG (_DIO_INPUT|_DIO_LONG|_DIO_SAFE)
391 # define DIO_SAFE_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
392 # define DIO_SAFE_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
393 # define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
394 #define DIO_PORT m2_l1 /* single port address */
395 #define DIO_VALUE m2_l2 /* single I/O value */
396 #define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */
397 #define DIO_VEC_SIZE m2_l2 /* number of elements in vector */
398 #define DIO_VEC_ENDPT m2_i2 /* number of process where vector is */
399 #define DIO_OFFSET m2_i1 /* offset from grant */
401 /* Field names for SYS_SETALARM. */
402 #define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */
403 #define ALRM_ABS_TIME m2_i2 /* set to 1 to use absolute alarm time */
404 #define ALRM_TIME_LEFT m2_l1 /* how many ticks were remaining */
406 /* Field names for SYS_IRQCTL. */
407 #define IRQ_REQUEST m5_s1 /* what to do? */
408 # define IRQ_SETPOLICY 1 /* manage a slot of the IRQ table */
409 # define IRQ_RMPOLICY 2 /* remove a slot of the IRQ table */
410 # define IRQ_ENABLE 3 /* enable interrupts */
411 # define IRQ_DISABLE 4 /* disable interrupts */
412 #define IRQ_VECTOR m5_s2 /* irq vector */
413 #define IRQ_POLICY m5_i1 /* options for IRQCTL request */
414 # define IRQ_REENABLE 0x001 /* reenable IRQ line after interrupt */
415 # define IRQ_BYTE 0x100 /* byte values */
416 # define IRQ_WORD 0x200 /* word values */
417 # define IRQ_LONG 0x400 /* long values */
418 #define IRQ_HOOK_ID m5_l3 /* id of irq hook at kernel */
420 /* Field names for SYS_ABORT. */
421 #define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */
422 #define ABRT_MON_ENDPT m1_i2 /* process where monitor params are */
423 #define ABRT_MON_LEN m1_i3 /* length of monitor params */
424 #define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */
426 /* Field names for SYS_IOPENABLE. */
427 #define IOP_ENDPT m2_l1 /* target endpoint */
429 /* Field names for _UMAP, _VIRCOPY, _PHYSCOPY. */
430 #define CP_SRC_ENDPT m5_i1 /* process to copy from */
431 #define CP_SRC_ADDR m5_l1 /* address where data come from */
432 #define CP_DST_ENDPT m5_i2 /* process to copy to */
433 #define CP_DST_ADDR m5_l2 /* address where data go to */
434 #define CP_NR_BYTES m5_l3 /* number of bytes to copy */
436 #define UMAP_SEG m5_s1
438 /* only used for backwards compatability */
439 #define CP_SRC_SPACE_OBSOLETE m5_s1 /* T or D space (stack is also D) */
440 #define CP_DST_SPACE_OBSOLETE m5_s2 /* T or D space (stack is also D) */
442 /* Field names for SYS_VUMAP. */
443 #define VUMAP_ENDPT m10_i1 /* grant owner, or SELF for local addresses */
444 #define VUMAP_VADDR m10_l1 /* address of virtual (input) vector */
445 #define VUMAP_VCOUNT m10_i2 /* number of elements in virtual vector */
446 #define VUMAP_OFFSET m10_l2 /* offset into first entry of input vector */
447 #define VUMAP_ACCESS m10_i3 /* access requested for input (VUA_ flags) */
448 #define VUMAP_PADDR m10_l3 /* address of physical (output) vector */
449 #define VUMAP_PMAX m10_i4 /* max number of physical vector elements */
450 #define VUMAP_PCOUNT m10_i1 /* upon return: number of elements filled */
452 /* Field names for SYS_GETINFO. */
453 #define I_REQUEST m7_i3 /* what info to get */
454 # define GET_KINFO 0 /* get kernel information structure */
455 # define GET_IMAGE 1 /* get system image table */
456 # define GET_PROCTAB 2 /* get kernel process table */
457 # define GET_RANDOMNESS 3 /* get randomness buffer */
458 # define GET_MONPARAMS 4 /* get monitor parameters */
459 # define GET_KENV 5 /* get kernel environment string */
460 # define GET_IRQHOOKS 6 /* get the IRQ table */
461 # define GET_PRIVTAB 8 /* get kernel privileges table */
462 # define GET_KADDRESSES 9 /* get various kernel addresses */
463 # define GET_SCHEDINFO 10 /* get scheduling queues */
464 # define GET_PROC 11 /* get process slot if given process */
465 # define GET_MACHINE 12 /* get machine information */
466 # define GET_LOCKTIMING 13 /* get lock()/unlock() latency timing */
467 # define GET_BIOSBUFFER 14 /* get a buffer for BIOS calls */
468 # define GET_LOADINFO 15 /* get load average information */
469 # define GET_IRQACTIDS 16 /* get the IRQ masks */
470 # define GET_PRIV 17 /* get privilege structure */
471 # define GET_HZ 18 /* get HZ value */
472 # define GET_WHOAMI 19 /* get own name, endpoint, and privileges */
473 # define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
474 # define GET_IDLETSC 21 /* get cumulative idle time stamp counter */
475 # define GET_CPUINFO 23 /* get information about cpus */
476 # define GET_REGS 24 /* get general process registers */
477 #define I_ENDPT m7_i4 /* calling process (may only be SELF) */
478 #define I_VAL_PTR m7_p1 /* virtual address at caller */
479 #define I_VAL_LEN m7_i1 /* max length of value */
480 #define I_VAL_PTR2 m7_p2 /* second virtual address */
481 #define I_VAL_LEN2_E m7_i2 /* second length, or proc nr */
483 /* GET_WHOAMI fields. */
484 #define GIWHO_EP m3_i1
485 #define GIWHO_NAME m3_ca1
486 #define GIWHO_PRIVFLAGS m3_i2
488 /* Field names for SYS_TIMES. */
489 #define T_ENDPT m4_l1 /* process to request time info for */
490 #define T_USER_TIME m4_l1 /* user time consumed by process */
491 #define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
492 #define T_BOOTTIME m4_l3 /* Boottime in seconds (also for SYS_STIME) */
493 #define T_BOOT_TICKS m4_l5 /* number of clock ticks since boot time */
495 /* Field names for SYS_TRACE, SYS_PRIVCTL, SYS_STATECTL. */
496 #define CTL_ENDPT m2_i1 /* process number of the caller */
497 #define CTL_REQUEST m2_i2 /* server control request */
498 #define CTL_ARG_PTR m2_p1 /* pointer to argument */
499 #define CTL_ADDRESS m2_l1 /* address at traced process' space */
500 #define CTL_DATA m2_l2 /* data field for tracing */
502 /* SYS_PRIVCTL with CTL_REQUEST == SYS_PRIV_QUERY_MEM */
503 #define CTL_PHYSSTART m2_l1 /* physical memory start in bytes*/
504 #define CTL_PHYSLEN m2_l2 /* length in bytes */
506 /* Subfunctions for SYS_PRIVCTL */
507 #define SYS_PRIV_ALLOW 1 /* Allow process to run */
508 #define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
509 #define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
510 #define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
511 #define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
512 #define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
514 #define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
515 #define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
516 #define SYS_PRIV_UPDATE_SYS 9 /* Update a sys privilege structure. */
517 #define SYS_PRIV_YIELD 10 /* Allow process to run and suspend */
519 /* Field names for SYS_SETGRANT */
520 #define SG_ADDR m2_p1 /* address */
521 #define SG_SIZE m2_i2 /* no. of entries */
523 /* Field names for SYS_GETKSIG, _ENDKSIG, _KILL, _SIGSEND, _SIGRETURN. */
524 #define SIG_ENDPT m2_i1 /* process number for inform */
525 #define SIG_NUMBER m2_i2 /* signal number to send */
526 #define SIG_FLAGS m2_i3 /* signal flags field */
527 #define SIG_MAP m2_l1 /* used by kernel to pass signal bit map */
528 #define SIG_CTXT_PTR m2_p1 /* pointer to info to restore signal context */
530 /* Field names for SYS_FORK, _EXEC, _EXIT, GETMCONTEXT, SETMCONTEXT.*/
531 #define PR_ENDPT m1_i1 /* indicates a process */
532 #define PR_PRIORITY m1_i2 /* process priority */
533 #define PR_SLOT m1_i2 /* indicates a process slot */
534 #define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
535 #define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
536 #define PR_IP_PTR m1_p3 /* initial value for ip after exec */
537 #define PR_FORK_FLAGS m1_i3 /* optional flags for fork operation */
538 #define PR_FORK_MSGADDR m1_p1 /* reply message address of forked child */
539 #define PR_CTX_PTR m1_p1 /* pointer to mcontext_t structure */
541 /* Field names for EXEC sent from userland to PM. */
542 #define PMEXEC_FLAGS m1_i3 /* PMEF_* */
544 #define PMEF_AUXVECTORS 20
545 #define PMEF_EXECNAMELEN1 256
546 #define PMEF_AUXVECTORSPACE 0x01 /* space for PMEF_AUXVECTORS on stack */
547 #define PMEF_EXECNAMESPACE1 0x02 /* space for PMEF_EXECNAMELEN1 execname */
549 /* Flags for PR_FORK_FLAGS. */
550 #define PFF_VMINHIBIT 0x01 /* Don't schedule until release by VM. */
552 /* Field names for SYS_INT86 */
553 #define INT86_REG86 m1_p1 /* pointer to registers */
555 /* Field names for SYS_SAFECOPY* */
556 #define SCP_FROM_TO m2_i1 /* from/to whom? */
557 #define SCP_SEG_OBSOLETE m2_i2 /* my own segment */
558 #define SCP_GID m2_i3 /* grant id */
559 #define SCP_OFFSET m2_l1 /* offset within grant */
560 #define SCP_ADDRESS m2_p1 /* my own address */
561 #define SCP_BYTES m2_l2 /* bytes from offset */
563 /* SYS_SAFEMEMSET */
564 #define SMS_DST m2_i1 /* dst endpoint */
565 #define SMS_GID m2_i3 /* grant id */
566 #define SMS_OFFSET m2_l1 /* offset within grant */
567 #define SMS_BYTES m2_l2 /* bytes from offset */
568 #define SMS_PATTERN m2_i2 /* memset() pattern */
570 /* Field names for SYS_VSAFECOPY* */
571 #define VSCP_VEC_ADDR m2_p1 /* start of vector */
572 #define VSCP_VEC_SIZE m2_l2 /* elements in vector */
574 #define SMAP_SEG_OBSOLETE m2_p1
576 /* Field names for SYS_SPROF, _CPROF, _PROFBUF. */
577 #define PROF_ACTION m7_i1 /* start/stop/reset/get */
578 #define PROF_MEM_SIZE m7_i2 /* available memory for data */
579 #define PROF_FREQ m7_i3 /* sample frequency */
580 #define PROF_ENDPT m7_i4 /* endpoint of caller */
581 #define PROF_INTR_TYPE m7_i5 /* interrupt type */
582 #define PROF_CTL_PTR m7_p1 /* location of info struct */
583 #define PROF_MEM_PTR m7_p2 /* location of profiling data */
585 /* Field names for SYS_READBIOS. */
586 #define RDB_SIZE m2_i1
587 #define RDB_ADDR m2_l1
588 #define RDB_BUF m2_p1
590 /* Field names for SYS_VMCTL. */
591 #define SVMCTL_WHO m1_i1
592 #define SVMCTL_PARAM m1_i2 /* All SYS_VMCTL requests. */
593 #define SVMCTL_VALUE m1_i3
594 #define SVMCTL_MRG_TARGET m2_i1 /* MEMREQ_GET reply: target process */
595 #define SVMCTL_MRG_ADDR m2_i2 /* MEMREQ_GET reply: address */
596 #define SVMCTL_MRG_LENGTH m2_i3 /* MEMREQ_GET reply: length */
597 #define SVMCTL_MRG_FLAG m2_s1 /* MEMREQ_GET reply: flag */
598 #define SVMCTL_MRG_EP2 m2_l1 /* MEMREQ_GET reply: source process */
599 #define SVMCTL_MRG_ADDR2 m2_l2 /* MEMREQ_GET reply: source address */
600 #define SVMCTL_MRG_REQUESTOR m2_p1 /* MEMREQ_GET reply: requestor */
601 #define SVMCTL_MAP_VIR_ADDR m1_p1
602 #define SVMCTL_PTROOT m1_i3
603 #define SVMCTL_PTROOT_V m1_p1
605 /* Reply message for VMCTL_KERN_PHYSMAP */
606 #define SVMCTL_MAP_FLAGS m2_i1 /* VMMF_* */
607 #define SVMCTL_MAP_PHYS_ADDR m2_l1
608 #define SVMCTL_MAP_PHYS_LEN m2_l2
610 #define VMMF_UNCACHED (1L << 0)
611 #define VMMF_USER (1L << 1)
612 #define VMMF_WRITE (1L << 2)
613 #define VMMF_GLO (1L << 3)
615 /* Values for SVMCTL_PARAM. */
616 #define VMCTL_CLEAR_PAGEFAULT 12
617 #define VMCTL_GET_PDBR 13
618 #define VMCTL_MEMREQ_GET 14
619 #define VMCTL_MEMREQ_REPLY 15
620 #define VMCTL_NOPAGEZERO 18
621 #define VMCTL_I386_KERNELLIMIT 19
622 #define VMCTL_I386_INVLPG 25
623 #define VMCTL_FLUSHTLB 26
624 #define VMCTL_KERN_PHYSMAP 27
625 #define VMCTL_KERN_MAP_REPLY 28
626 #define VMCTL_SETADDRSPACE 29
627 #define VMCTL_VMINHIBIT_SET 30
628 #define VMCTL_VMINHIBIT_CLEAR 31
629 #define VMCTL_CLEARMAPCACHE 32
630 #define VMCTL_BOOTINHIBIT_CLEAR 33
632 /* Codes and field names for SYS_SYSCTL. */
633 #define SYSCTL_CODE m1_i1 /* SYSCTL_CODE_* below */
634 #define SYSCTL_ARG1 m1_p1
635 #define SYSCTL_ARG2 m1_i2
636 #define SYSCTL_CODE_DIAG 1 /* Print diagnostics. */
637 #define SYSCTL_CODE_STACKTRACE 2 /* Print process stack. */
638 #define DIAG_BUFSIZE (80*25)
640 /* Field names for SYS_VTIMER. */
641 #define VT_WHICH m2_i1 /* which timer to set/retrieve */
642 # define VT_VIRTUAL 1 /* the ITIMER_VIRTUAL timer */
643 # define VT_PROF 2 /* the ITIMER_PROF timer */
644 #define VT_SET m2_i2 /* 1 for setting a timer, 0 retrieval only */
645 #define VT_VALUE m2_l1 /* new/previous value of the timer */
646 #define VT_ENDPT m2_l2 /* process to set/retrieve the timer for */
648 /* Field names for SYS_RUNCTL. */
649 #define RC_ENDPT m1_i1 /* which process to stop or resume */
650 #define RC_ACTION m1_i2 /* set or clear stop flag */
651 # define RC_STOP 0 /* stop the process */
652 # define RC_RESUME 1 /* clear the stop flag */
653 #define RC_FLAGS m1_i3 /* request flags */
654 # define RC_DELAY 1 /* delay stop if process is sending */
656 /* Field names for SYS_UPDATE. */
657 #define SYS_UPD_SRC_ENDPT m1_i1 /* source endpoint */
658 #define SYS_UPD_DST_ENDPT m1_i2 /* destination endpoint */
660 /* Subfunctions for SYS_STATECTL */
661 #define SYS_STATE_CLEAR_IPC_REFS 1 /* clear IPC references */
663 /* Subfunctions for SYS_SCHEDCTL */
664 #define SCHEDCTL_FLAGS m9_l1 /* flags for setting the scheduler */
665 # define SCHEDCTL_FLAG_KERNEL 1 /* mark kernel scheduler and remove
666 * RTS_NO_QUANTUM; otherwise caller is
667 * marked scheduler
669 #define SCHEDCTL_ENDPOINT m9_l2 /* endpt of process to be scheduled */
670 #define SCHEDCTL_QUANTUM m9_l3 /* current scheduling quantum */
671 #define SCHEDCTL_PRIORITY m9_s4 /* current scheduling priority */
672 #define SCHEDCTL_CPU m9_l5 /* where to place this process */
674 /*===========================================================================*
675 * Messages for the Reincarnation Server *
676 *===========================================================================*/
678 #define RS_RQ_BASE 0x700
680 #define RS_UP (RS_RQ_BASE + 0) /* start system service */
681 #define RS_DOWN (RS_RQ_BASE + 1) /* stop system service */
682 #define RS_REFRESH (RS_RQ_BASE + 2) /* refresh system service */
683 #define RS_RESTART (RS_RQ_BASE + 3) /* restart system service */
684 #define RS_SHUTDOWN (RS_RQ_BASE + 4) /* alert about shutdown */
685 #define RS_UPDATE (RS_RQ_BASE + 5) /* update system service */
686 #define RS_CLONE (RS_RQ_BASE + 6) /* clone system service */
687 #define RS_EDIT (RS_RQ_BASE + 7) /* edit system service */
689 #define RS_LOOKUP (RS_RQ_BASE + 8) /* lookup server name */
691 #define RS_INIT (RS_RQ_BASE + 20) /* service init message */
692 #define RS_LU_PREPARE (RS_RQ_BASE + 21) /* prepare to update message */
694 # define RS_CMD_ADDR m1_p1 /* command string */
695 # define RS_CMD_LEN m1_i1 /* length of command */
696 # define RS_PERIOD m1_i2 /* heartbeat period */
697 # define RS_DEV_MAJOR m1_i3 /* major device number */
699 # define RS_ENDPOINT m1_i1 /* endpoint number in reply */
701 # define RS_NAME m1_p1 /* name */
702 # define RS_NAME_LEN m1_i1 /* namelen */
704 # define RS_INIT_RESULT m7_i1 /* init result */
705 # define RS_INIT_TYPE m7_i2 /* init type */
706 # define RS_INIT_RPROCTAB_GID m7_i3 /* init rproc table gid */
707 # define RS_INIT_OLD_ENDPOINT m7_i4 /* init old endpoint */
709 # define RS_LU_RESULT m1_i1 /* live update result */
710 # define RS_LU_STATE m1_i2 /* state required to update */
711 # define RS_LU_PREPARE_MAXTIME m1_i3 /* the max time to prepare */
713 /*===========================================================================*
714 * Messages for the Data Store Server *
715 *===========================================================================*/
717 #define DS_RQ_BASE 0x800
719 #define DS_PUBLISH (DS_RQ_BASE + 0) /* publish data */
720 #define DS_RETRIEVE (DS_RQ_BASE + 1) /* retrieve data by name */
721 #define DS_SUBSCRIBE (DS_RQ_BASE + 2) /* subscribe to data updates */
722 #define DS_CHECK (DS_RQ_BASE + 3) /* retrieve updated data */
723 #define DS_DELETE (DS_RQ_BASE + 4) /* delete data */
724 #define DS_SNAPSHOT (DS_RQ_BASE + 5) /* take a snapshot */
725 #define DS_RETRIEVE_LABEL (DS_RQ_BASE + 6) /* retrieve label's name */
727 /* DS field names */
728 # define DS_KEY_GRANT m2_i1 /* key for the data */
729 # define DS_KEY_LEN m2_s1 /* length of key incl. '\0' */
730 # define DS_FLAGS m2_i2 /* flags provided by caller */
732 # define DS_VAL m2_l1 /* data (u32, char *, etc.) */
733 # define DS_VAL_LEN m2_l2 /* data length */
734 # define DS_NR_SNAPSHOT m2_i3 /* number of snapshot */
735 # define DS_OWNER m2_i3 /* owner */
737 /*===========================================================================*
738 * Miscellaneous messages used by TTY *
739 *===========================================================================*/
741 /* Miscellaneous request types and field names, e.g. used by IS server. */
742 #define FKEY_CONTROL 98 /* control a function key at the TTY */
743 # define FKEY_REQUEST m2_i1 /* request to perform at TTY */
744 # define FKEY_MAP 10 /* observe function key */
745 # define FKEY_UNMAP 11 /* stop observing function key */
746 # define FKEY_EVENTS 12 /* request open key presses */
747 # define FKEY_FKEYS m2_l1 /* F1-F12 keys pressed */
748 # define FKEY_SFKEYS m2_l2 /* Shift-F1-F12 keys pressed */
750 /*===========================================================================*
751 * Messages used between PM and VFS *
752 *===========================================================================*/
754 #define PM_RQ_BASE 0x900
755 #define PM_RS_BASE 0x980
757 /* Requests from PM to VFS */
758 #define PM_INIT (PM_RQ_BASE + 0) /* Process table exchange */
759 #define PM_SETUID (PM_RQ_BASE + 1) /* Set new user ID */
760 #define PM_SETGID (PM_RQ_BASE + 2) /* Set group ID */
761 #define PM_SETSID (PM_RQ_BASE + 3) /* Set session leader */
762 #define PM_EXIT (PM_RQ_BASE + 4) /* Process exits */
763 #define PM_DUMPCORE (PM_RQ_BASE + 5) /* Process is to dump core */
764 #define PM_EXEC (PM_RQ_BASE + 6) /* Forwarded exec call */
765 #define PM_FORK (PM_RQ_BASE + 7) /* Newly forked process */
766 #define PM_SRV_FORK (PM_RQ_BASE + 8) /* fork for system services */
767 #define PM_UNPAUSE (PM_RQ_BASE + 9) /* Interrupt process call */
768 #define PM_REBOOT (PM_RQ_BASE + 10) /* System reboot */
769 #define PM_SETGROUPS (PM_RQ_BASE + 11) /* Tell VFS about setgroups */
771 /* Replies from VFS to PM */
772 #define PM_SETUID_REPLY (PM_RS_BASE + 1)
773 #define PM_SETGID_REPLY (PM_RS_BASE + 2)
774 #define PM_SETSID_REPLY (PM_RS_BASE + 3)
775 #define PM_EXIT_REPLY (PM_RS_BASE + 4)
776 #define PM_CORE_REPLY (PM_RS_BASE + 5)
777 #define PM_EXEC_REPLY (PM_RS_BASE + 6)
778 #define PM_FORK_REPLY (PM_RS_BASE + 7)
779 #define PM_SRV_FORK_REPLY (PM_RS_BASE + 8)
780 #define PM_UNPAUSE_REPLY (PM_RS_BASE + 9)
781 #define PM_REBOOT_REPLY (PM_RS_BASE + 10)
782 #define PM_SETGROUPS_REPLY (PM_RS_BASE + 11)
784 /* Standard parameters for all requests and replies, except PM_REBOOT */
785 # define PM_PROC m7_i1 /* process endpoint */
787 /* Additional parameters for PM_INIT */
788 # define PM_SLOT m7_i2 /* process slot number */
789 # define PM_PID m7_i3 /* process pid */
791 /* Additional parameters for PM_SETUID and PM_SETGID */
792 # define PM_EID m7_i2 /* effective user/group id */
793 # define PM_RID m7_i3 /* real user/group id */
795 /* Additional parameter for PM_SETGROUPS */
796 # define PM_GROUP_NO m7_i2 /* number of groups */
797 # define PM_GROUP_ADDR m7_p1 /* struct holding group data */
799 /* Additional parameters for PM_EXEC */
800 # define PM_PATH m7_p1 /* executable */
801 # define PM_PATH_LEN m7_i2 /* length of path including
802 * terminating null character
804 # define PM_FRAME m7_p2 /* arguments and environment */
805 # define PM_FRAME_LEN m7_i3 /* size of frame */
806 # define PM_EXECFLAGS m7_i4 /* PMEXEC_FLAGS */
808 /* Additional parameters for PM_EXEC_REPLY and PM_CORE_REPLY */
809 # define PM_STATUS m7_i2 /* OK or failure */
810 # define PM_PC m7_p1 /* program counter */
811 # define PM_NEWSP m7_p2 /* possibly-changed stack ptr */
813 /* Additional parameters for PM_FORK and PM_SRV_FORK */
814 # define PM_PPROC m7_i2 /* parent process endpoint */
815 # define PM_CPID m7_i3 /* child pid */
816 # define PM_REUID m7_i4 /* real and effective uid */
817 # define PM_REGID m7_i5 /* real and effective gid */
819 /* Additional parameters for PM_DUMPCORE */
820 # define PM_TERM_SIG m7_i2 /* process's termination signal */
821 # define PM_TRACED_PROC m7_i3 /* required for T_DUMPCORE */
823 /* Parameters for the EXEC_NEWMEM call */
824 #define EXC_NM_PROC m1_i1 /* process that needs new map */
825 #define EXC_NM_PTR m1_p1 /* parameters in struct exec_info */
826 /* Results:
827 * the status will be in m_type.
828 * the top of the stack will be in m1_i1.
829 * the following flags will be in m1_i2:
831 #define EXC_NM_RF_LOAD_TEXT 1 /* Load text segment (otherwise the
832 * text segment is already present)
834 #define EXC_NM_RF_ALLOW_SETUID 2 /* Setuid execution is allowed (tells
835 * FS to update its uid and gid
836 * fields.
838 #define EXC_NM_RF_FULLVM 4
840 /* Parameters for the EXEC_RESTART call */
841 #define EXC_RS_PROC m1_i1 /* process that needs to be restarted */
842 #define EXC_RS_RESULT m1_i2 /* result of the exec */
843 #define EXC_RS_PC m1_p1 /* program counter */
845 /*===========================================================================*
846 * Messages used from VFS to file servers *
847 *===========================================================================*/
849 #define VFS_BASE 0xA00 /* Requests sent by VFS to filesystem
850 * implementations. See <minix/vfsif.h>
853 /*===========================================================================*
854 * Common requests and miscellaneous field names *
855 *===========================================================================*/
857 #define COMMON_RQ_BASE 0xE00
859 /* Field names for system signals (sent by a signal manager). */
860 #define SIGS_SIGNAL_RECEIVED (COMMON_RQ_BASE+0)
861 # define SIGS_SIG_NUM m2_i1
863 /* Common request to all processes: gcov data. */
864 #define COMMON_REQ_GCOV_DATA (COMMON_RQ_BASE+1)
865 # define GCOV_GRANT m1_i2
866 # define GCOV_PID m1_i3
867 # define GCOV_BUFF_P m1_p1
868 # define GCOV_BUFF_SZ m1_i1
870 /* Common request to several system servers: retrieve system information. */
871 #define COMMON_GETSYSINFO (COMMON_RQ_BASE+2)
872 # define SI_WHAT m1_i1
873 # define SI_WHERE m1_p1
874 # define SI_SIZE m1_i2
876 /* PM field names */
877 /* BRK */
878 #define PMBRK_ADDR m1_p1
880 /* TRACE */
881 #define PMTRACE_ADDR m2_l1
883 #define PM_ENDPT m1_i1
884 #define PM_PENDPT m1_i2
886 #define PM_NUID m2_i1
887 #define PM_NGID m2_i2
889 #define PM_GETSID_PID m1_i1
891 /* Field names for SELECT (FS). */
892 #define SEL_NFDS m8_i1
893 #define SEL_READFDS m8_p1
894 #define SEL_WRITEFDS m8_p2
895 #define SEL_ERRORFDS m8_p3
896 #define SEL_TIMEOUT m8_p4
898 /* Field names for the fstatvfs call */
899 #define FSTATVFS_FD m1_i1
900 #define FSTATVFS_BUF m1_p1
902 /* Field names for the statvfs call */
903 #define STATVFS_LEN m1_i1
904 #define STATVFS_NAME m1_p1
905 #define STATVFS_BUF m1_p2
907 /*===========================================================================*
908 * Messages for VM server *
909 *===========================================================================*/
910 #define VM_RQ_BASE 0xC00
912 /* Calls from PM */
913 #define VM_EXIT (VM_RQ_BASE+0)
914 # define VME_ENDPOINT m1_i1
915 #define VM_FORK (VM_RQ_BASE+1)
916 # define VMF_ENDPOINT m1_i1
917 # define VMF_SLOTNO m1_i2
918 # define VMF_CHILD_ENDPOINT m1_i3 /* result */
919 #define VM_BRK (VM_RQ_BASE+2)
920 # define VMB_ENDPOINT m1_i1
921 # define VMB_ADDR m1_p1
922 # define VMB_RETADDR m1_p2 /* result */
923 #define VM_EXEC_NEWMEM (VM_RQ_BASE+3)
924 # define VMEN_ENDPOINT m1_i1
925 # define VMEN_ARGSPTR m1_p1
926 # define VMEN_ARGSSIZE m1_i2
927 # define VMEN_FLAGS m1_i3 /* result */
928 # define VMEN_STACK_TOP m1_p2 /* result */
929 #define VM_WILLEXIT (VM_RQ_BASE+5)
930 # define VMWE_ENDPOINT m1_i1
932 /* General calls. */
933 #define VM_MMAP (VM_RQ_BASE+10)
934 # define VMM_ADDR m5_l1
935 # define VMM_LEN m5_l2
936 # define VMM_PROT m5_s1
937 # define VMM_FLAGS m5_s2
938 # define VMM_FD m5_i1
939 # define VMM_OFFSET m5_i2
940 # define VMM_FORWHOM m5_l3
941 # define VMM_RETADDR m5_l1 /* result */
942 #define VM_UMAP (VM_RQ_BASE+11)
943 # define VMU_SEG m1_i1
944 # define VMU_OFFSET m1_p1
945 # define VMU_LENGTH m1_p2
946 # define VMU_RETADDR m1_p3
948 /* to VM: inform VM about a region of memory that is used for
949 * bus-master DMA
951 #define VM_ADDDMA (VM_RQ_BASE+12)
952 # define VMAD_EP m2_i1
953 # define VMAD_START m2_l1
954 # define VMAD_SIZE m2_l2
956 /* to VM: inform VM that a region of memory that is no longer
957 * used for bus-master DMA
959 #define VM_DELDMA (VM_RQ_BASE+13)
960 # define VMDD_EP m2_i1
961 # define VMDD_START m2_l1
962 # define VMDD_SIZE m2_l2
964 /* to VM: ask VM for a region of memory that should not
965 * be used for bus-master DMA any longer
967 #define VM_GETDMA (VM_RQ_BASE+14)
968 # define VMGD_PROCP m2_i1
969 # define VMGD_BASEP m2_l1
970 # define VMGD_SIZEP m2_l2
972 #define VM_MAP_PHYS (VM_RQ_BASE+15)
973 # define VMMP_EP m1_i1
974 # define VMMP_PHADDR m1_p2
975 # define VMMP_LEN m1_i2
976 # define VMMP_VADDR_REPLY m1_p3
978 #define VM_UNMAP_PHYS (VM_RQ_BASE+16)
979 # define VMUP_EP m1_i1
980 # define VMUP_VADDR m1_p1
982 #define VM_MUNMAP (VM_RQ_BASE+17)
983 # define VMUM_ADDR m1_p1
984 # define VMUM_LEN m1_i1
986 /* To VM: forget all my yielded blocks. */
987 #define VM_FORGETBLOCKS (VM_RQ_BASE+22)
989 /* To VM: forget this block. */
990 #define VM_FORGETBLOCK (VM_RQ_BASE+23)
991 #define VMFB_IDHI m1_i1
992 #define VMFB_IDLO m1_i2
994 /* To VM: combined yield+get call. */
995 #define VM_YIELDBLOCKGETBLOCK (VM_RQ_BASE+25)
996 #define VMYBGB_VADDR m2_p1
997 #define VMYBGB_GETIDHI m2_i1
998 #define VMYBGB_GETIDLO m2_i2
999 #define VMYBGB_LEN m2_i3
1000 #define VMYBGB_YIELDIDHI m2_l1
1001 #define VMYBGB_YIELDIDLO m2_l2
1003 /* Calls from VFS. */
1004 # define VMV_ENDPOINT m1_i1 /* for all VM_VFS_REPLY_* */
1005 #define VM_VFS_REPLY_OPEN (VM_RQ_BASE+30)
1006 # define VMVRO_FD m1_i2
1007 #define VM_VFS_REPLY_MMAP (VM_RQ_BASE+31)
1008 #define VM_VFS_REPLY_CLOSE (VM_RQ_BASE+32)
1010 #define VM_REMAP (VM_RQ_BASE+33)
1011 # define VMRE_D m1_i1
1012 # define VMRE_S m1_i2
1013 # define VMRE_DA m1_p1
1014 # define VMRE_SA m1_p2
1015 # define VMRE_RETA m1_p3
1016 # define VMRE_SIZE m1_i3
1017 # define VMRE_FLAGS m1_i3
1019 #define VM_SHM_UNMAP (VM_RQ_BASE+34)
1020 # define VMUN_ENDPT m2_i1
1021 # define VMUN_ADDR m2_l1
1023 #define VM_GETPHYS (VM_RQ_BASE+35)
1024 # define VMPHYS_ENDPT m2_i1
1025 # define VMPHYS_ADDR m2_l1
1026 # define VMPHYS_RETA m2_l2
1028 #define VM_GETREF (VM_RQ_BASE+36)
1029 # define VMREFCNT_ENDPT m2_i1
1030 # define VMREFCNT_ADDR m2_l1
1031 # define VMREFCNT_RETC m2_i2
1033 #define VM_RS_SET_PRIV (VM_RQ_BASE+37)
1034 # define VM_RS_NR m2_i1
1035 # define VM_RS_BUF m2_l1
1037 #define VM_QUERY_EXIT (VM_RQ_BASE+38)
1038 # define VM_QUERY_RET_PT m2_i1
1039 # define VM_QUERY_IS_MORE m2_i2
1041 #define VM_NOTIFY_SIG (VM_RQ_BASE+39)
1042 # define VM_NOTIFY_SIG_ENDPOINT m1_i1
1043 # define VM_NOTIFY_SIG_IPC m1_i2
1045 #define VM_INFO (VM_RQ_BASE+40)
1046 # define VMI_WHAT m2_i1
1047 # define VMI_EP m2_i2
1048 # define VMI_COUNT m2_i3
1049 # define VMI_PTR m2_p1
1050 # define VMI_NEXT m2_l1
1052 /* VMI_WHAT values. */
1053 #define VMIW_STATS 1
1054 #define VMIW_USAGE 2
1055 #define VMIW_REGION 3
1057 #define VM_RS_UPDATE (VM_RQ_BASE+41)
1058 # define VM_RS_SRC_ENDPT m1_i1
1059 # define VM_RS_DST_ENDPT m1_i2
1061 #define VM_RS_MEMCTL (VM_RQ_BASE+42)
1062 # define VM_RS_CTL_ENDPT m1_i1
1063 # define VM_RS_CTL_REQ m1_i2
1064 # define VM_RS_MEM_PIN 0 /* pin memory */
1065 # define VM_RS_MEM_MAKE_VM 1 /* make VM instance */
1067 #define VM_WATCH_EXIT (VM_RQ_BASE+43)
1068 # define VM_WE_EP m1_i1
1070 #define VM_REMAP_RO (VM_RQ_BASE+44)
1071 /* same args as VM_REMAP */
1073 #define VM_PROCCTL (VM_RQ_BASE+45)
1074 #define VMPCTL_PARAM m1_i1
1075 #define VMPCTL_WHO m1_i2
1077 #define VMPPARAM_CLEAR 1 /* values for VMPCTL_PARAM */
1079 /* Total. */
1080 #define NR_VM_CALLS 46
1081 #define VM_CALL_MASK_SIZE BITMAP_CHUNKS(NR_VM_CALLS)
1083 /* not handled as a normal VM call, thus at the end of the reserved rage */
1084 #define VM_PAGEFAULT (VM_RQ_BASE+0xff)
1085 # define VPF_ADDR m1_i1
1086 # define VPF_FLAGS m1_i2
1088 /* Basic vm calls allowed to every process. */
1089 #define VM_BASIC_CALLS \
1090 VM_MMAP, VM_MUNMAP, VM_MAP_PHYS, VM_UNMAP_PHYS, \
1091 VM_FORGETBLOCKS, VM_FORGETBLOCK, VM_YIELDBLOCKGETBLOCK, VM_INFO
1093 /*===========================================================================*
1094 * Messages for IPC server *
1095 *===========================================================================*/
1096 #define IPC_BASE 0xD00
1098 /* Shared Memory */
1099 #define IPC_SHMGET (IPC_BASE+1)
1100 # define SHMGET_KEY m2_l1
1101 # define SHMGET_SIZE m2_l2
1102 # define SHMGET_FLAG m2_i1
1103 # define SHMGET_RETID m2_i2
1104 #define IPC_SHMAT (IPC_BASE+2)
1105 # define SHMAT_ID m2_i1
1106 # define SHMAT_ADDR m2_l1
1107 # define SHMAT_FLAG m2_i2
1108 # define SHMAT_RETADDR m2_l2
1109 #define IPC_SHMDT (IPC_BASE+3)
1110 # define SHMDT_ADDR m2_l1
1111 #define IPC_SHMCTL (IPC_BASE+4)
1112 # define SHMCTL_ID m2_i1
1113 # define SHMCTL_CMD m2_i2
1114 # define SHMCTL_BUF m2_l1
1115 # define SHMCTL_RET m2_i3
1117 /* Semaphore */
1118 #define IPC_SEMGET (IPC_BASE+5)
1119 # define SEMGET_KEY m2_l1
1120 # define SEMGET_NR m2_i1
1121 # define SEMGET_FLAG m2_i2
1122 # define SEMGET_RETID m2_i3
1123 #define IPC_SEMCTL (IPC_BASE+6)
1124 # define SEMCTL_ID m2_i1
1125 # define SEMCTL_NUM m2_i2
1126 # define SEMCTL_CMD m2_i3
1127 # define SEMCTL_OPT m2_l1
1128 #define IPC_SEMOP (IPC_BASE+7)
1129 # define SEMOP_ID m2_i1
1130 # define SEMOP_OPS m2_l1
1131 # define SEMOP_SIZE m2_i2
1133 /*===========================================================================*
1134 * Messages for Scheduling *
1135 *===========================================================================*/
1136 #define SCHEDULING_BASE 0xF00
1138 #define SCHEDULING_NO_QUANTUM (SCHEDULING_BASE+1)
1139 # define SCHEDULING_ACNT_DEQS m9_l1
1140 # define SCHEDULING_ACNT_IPC_SYNC m9_l2
1141 # define SCHEDULING_ACNT_IPC_ASYNC m9_l3
1142 # define SCHEDULING_ACNT_PREEMPT m9_l4
1143 # define SCHEDULING_ACNT_QUEUE m9_l5
1144 # define SCHEDULING_ACNT_CPU m9_s1
1145 # define SCHEDULING_ACNT_CPU_LOAD m9_s2
1146 /* These are used for SYS_SCHEDULE, a reply to SCHEDULING_NO_QUANTUM */
1147 # define SCHEDULING_ENDPOINT m9_l1
1148 # define SCHEDULING_QUANTUM m9_l2
1149 # define SCHEDULING_PRIORITY m9_s1
1150 # define SCHEDULING_CPU m9_l4
1153 * SCHEDULING_START uses _ENDPOINT, _PRIORITY and _QUANTUM from
1154 * SCHEDULING_NO_QUANTUM/SYS_SCHEDULE
1156 #define SCHEDULING_START (SCHEDULING_BASE+2)
1157 # define SCHEDULING_SCHEDULER m9_l1 /* Overrides _ENDPOINT on return*/
1158 # define SCHEDULING_PARENT m9_l3
1159 # define SCHEDULING_MAXPRIO m9_l4
1161 #define SCHEDULING_STOP (SCHEDULING_BASE+3)
1163 #define SCHEDULING_SET_NICE (SCHEDULING_BASE+4)
1165 /* SCHEDULING_INHERIT is like SCHEDULING_START, but without _QUANTUM field */
1166 #define SCHEDULING_INHERIT (SCHEDULING_BASE+5)
1168 /*===========================================================================*
1169 * Messages for USB *
1170 *===========================================================================*/
1172 #define USB_BASE 0x1100
1174 /* those are from driver to USBD */
1175 #define USB_RQ_INIT (USB_BASE + 0) /* First message to HCD driver */
1176 #define USB_RQ_DEINIT (USB_BASE + 1) /* Quit the session */
1177 #define USB_RQ_SEND_URB (USB_BASE + 2) /* Send URB */
1178 #define USB_RQ_CANCEL_URB (USB_BASE + 3) /* Cancel URB */
1179 #define USB_REPLY (USB_BASE + 4)
1182 /* those are from USBD to driver */
1183 #define USB_COMPLETE_URB (USB_BASE + 6)
1184 #define USB_ANNOUCE_DEV (USB_BASE + 7) /* Announce a new USB Device */
1185 #define USB_WITHDRAW_DEV (USB_BASE + 8) /* Withdraw a allready anncounced
1186 USB device*/
1187 # define USB_GRANT_ID m4_l1
1188 # define USB_GRANT_SIZE m4_l2
1190 # define USB_URB_ID m4_l1
1191 # define USB_RESULT m4_l2
1192 # define USB_DEV_ID m4_l1
1193 # define USB_DRIVER_EP m4_l2
1194 # define USB_INTERFACES m4_l3
1195 # define USB_RB_INIT_NAME m3_ca1
1197 /*===========================================================================*
1198 * Messages for DeviceManager (s/t like SysFS) *
1199 *===========================================================================*/
1201 #define DEVMAN_BASE 0x1200
1203 #define DEVMAN_ADD_DEV (DEVMAN_BASE + 0)
1204 #define DEVMAN_DEL_DEV (DEVMAN_BASE + 1)
1205 #define DEVMAN_ADD_BUS (DEVMAN_BASE + 2)
1206 #define DEVMAN_DEL_BUS (DEVMAN_BASE + 3)
1207 #define DEVMAN_ADD_DEVFILE (DEVMAN_BASE + 4)
1208 #define DEVMAN_DEL_DEVFILE (DEVMAN_BASE + 5)
1210 #define DEVMAN_REQUEST (DEVMAN_BASE + 6)
1211 #define DEVMAN_REPLY (DEVMAN_BASE + 7)
1213 #define DEVMAN_BIND (DEVMAN_BASE + 8)
1214 #define DEVMAN_UNBIND (DEVMAN_BASE + 9)
1216 # define DEVMAN_GRANT_ID m4_l1
1217 # define DEVMAN_GRANT_SIZE m4_l2
1219 # define DEVMAN_ENDPOINT m4_l3
1220 # define DEVMAN_DEVICE_ID m4_l2
1221 # define DEVMAN_RESULT m4_l1
1223 /*===========================================================================*
1224 * TTY INPUT INJECTION *
1225 *===========================================================================*/
1227 #define INPUT_BASE 0x1300
1229 #define INPUT_EVENT (INPUT_BASE + 0)
1231 # define INPUT_TYPE m4_l1
1232 # define INPUT_CODE m4_l2
1233 # define INPUT_VALUE m4_l3
1235 #endif
1237 /*===========================================================================*
1238 * VFS-FS TRANSACTION IDs *
1239 *===========================================================================*/
1241 #define VFS_TRANSACTION_BASE 0x1400
1243 #define VFS_TRANSID (VFS_TRANSACTION_BASE + 1)
1244 #define IS_VFS_FS_TRANSID(type) (((type) & ~0xff) == VFS_TRANSACTION_BASE)
1246 /*===========================================================================*
1247 * Messages for block devices *
1248 *===========================================================================*/
1250 /* Base type for block device requests and responses. */
1251 #define BDEV_RQ_BASE 0x1500
1252 #define BDEV_RS_BASE 0x1580
1254 #define IS_BDEV_RQ(type) (((type) & ~0x7f) == BDEV_RQ_BASE)
1255 #define IS_BDEV_RS(type) (((type) & ~0x7f) == BDEV_RS_BASE)
1257 /* Message types for block device requests. */
1258 #define BDEV_OPEN (BDEV_RQ_BASE + 0) /* open a minor device */
1259 #define BDEV_CLOSE (BDEV_RQ_BASE + 1) /* close a minor device */
1260 #define BDEV_READ (BDEV_RQ_BASE + 2) /* read into a buffer */
1261 #define BDEV_WRITE (BDEV_RQ_BASE + 3) /* write from a buffer */
1262 #define BDEV_GATHER (BDEV_RQ_BASE + 4) /* read into a vector */
1263 #define BDEV_SCATTER (BDEV_RQ_BASE + 5) /* write from a vector */
1264 #define BDEV_IOCTL (BDEV_RQ_BASE + 6) /* I/O control operation */
1266 /* Message types for block device responses. */
1267 #define BDEV_REPLY (BDEV_RS_BASE + 0) /* general reply code */
1269 /* Field names for block device messages. */
1270 #define BDEV_MINOR m10_i1 /* minor device number */
1271 #define BDEV_STATUS m10_i1 /* OK or error code */
1272 #define BDEV_ACCESS m10_i2 /* access bits for open requests */
1273 #define BDEV_REQUEST m10_i2 /* I/O control request */
1274 #define BDEV_COUNT m10_i2 /* number of bytes or elements in transfer */
1275 #define BDEV_GRANT m10_i3 /* grant ID of buffer or vector */
1276 #define BDEV_FLAGS m10_i4 /* transfer flags */
1277 #define BDEV_ID m10_l1 /* opaque request ID */
1278 #define BDEV_POS_LO m10_l2 /* transfer position (low bits) */
1279 #define BDEV_POS_HI m10_l3 /* transfer position (high bits) */
1281 /* Bits in 'BDEV_FLAGS' field of block device transfer requests. */
1282 # define BDEV_NOFLAGS 0x00 /* no flags are set */
1283 # define BDEV_FORCEWRITE 0x01 /* force write to disk immediately */
1285 /* _MINIX_COM_H */