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 * 0x00 - 0xFF Process Manager (PM) requests (see callnr.h)
9 * 0x100 - 0x1FF Virtual File System (VFS) requests (see callnr.h)
10 * 0x200 - 0x2FF Data link layer requests and responses
11 * 0x300 - 0x3FF Bus controller requests and responses
12 * 0x400 - 0x4FF Character device requests and responses
13 * 0x500 - 0x5FF Block device requests and responses
14 * 0x600 - 0x6FF Kernel calls
15 * 0x700 - 0x7FF Reincarnation Server (RS) requests
16 * 0x800 - 0x8FF Data Store (DS) requests
17 * 0x900 - 0x9FF Requests from PM to VFS, and responses
18 * 0xA00 - 0xAFF Requests from VFS to file systems (see vfsif.h)
19 * 0xB00 - 0xBFF Transaction IDs from VFS to file systems (see vfsif.h)
20 * 0xC00 - 0xCFF Virtual Memory (VM) requests
21 * 0xD00 - 0xDFF IPC server requests
22 * 0xE00 - 0xEFF Common system messages (e.g. system signals)
23 * 0xF00 - 0xFFF Scheduling messages
24 * 0x1000 - 0x10FF Notify messages
26 * 0x1200 - 0x12FF Devman
27 * 0x1300 - 0x13FF TTY requests
28 * 0x1400 - 0x14FF Real Time Clock requests and responses
29 * 0x1500 - 0x15FF Input server messages
30 * 0x1600 - 0x16FF VirtualBox (VBOX) requests (see vboxif.h)
32 * Zero and negative values are widely used for OK and error responses.
38 /*===========================================================================*
39 * Magic process numbers *
40 *===========================================================================*/
42 /* These may not be any valid endpoint (see <minix/endpoint.h>). */
43 #define ANY ((endpoint_t) 0x7ace) /* used to indicate 'any process' */
44 #define NONE ((endpoint_t) 0x6ace) /* used to indicate 'no process at all' */
45 #define SELF ((endpoint_t) 0x8ace) /* used to indicate 'own process' */
46 #define _MAX_MAGIC_PROC (SELF) /* used by <minix/endpoint.h>
47 to determine generation size */
49 /*===========================================================================*
50 * Process numbers of processes in the system image *
51 *===========================================================================*/
53 /* The values of several task numbers depend on whether they or other tasks
54 * are enabled. They are defined as (PREVIOUS_TASK - ENABLE_TASK) in general.
55 * ENABLE_TASK is either 0 or 1, so a task either gets a new number, or gets
56 * the same number as the previous task and is further unused. Note that the
57 * order should correspond to the order in the task table defined in table.c.
60 /* Kernel tasks. These all run in the same address space. */
61 #define ASYNCM ((endpoint_t) -5) /* notifies about finished async sends */
62 #define IDLE ((endpoint_t) -4) /* runs when no one else can run */
63 #define CLOCK ((endpoint_t) -3) /* alarms and other clock functions */
64 #define SYSTEM ((endpoint_t) -2) /* request system functionality */
65 #define KERNEL ((endpoint_t) -1) /* pseudo-process for IPC and scheduling */
66 #define HARDWARE KERNEL /* for hardware interrupt handlers */
68 /* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
69 #define MAX_NR_TASKS 1023
72 /* User-space processes, that is, device drivers, servers, and INIT. */
73 #define PM_PROC_NR ((endpoint_t) 0) /* process manager */
74 #define VFS_PROC_NR ((endpoint_t) 1) /* file system */
75 #define RS_PROC_NR ((endpoint_t) 2) /* reincarnation server */
76 #define MEM_PROC_NR ((endpoint_t) 3) /* memory driver (RAM disk, null, etc.) */
77 #define SCHED_PROC_NR ((endpoint_t) 4) /* scheduler */
78 #define TTY_PROC_NR ((endpoint_t) 5) /* terminal (TTY) driver */
79 #define DS_PROC_NR ((endpoint_t) 6) /* data store server */
80 #define MFS_PROC_NR ((endpoint_t) 7) /* minix root filesystem */
81 #define VM_PROC_NR ((endpoint_t) 8) /* memory server */
82 #define PFS_PROC_NR ((endpoint_t) 9) /* pipe filesystem */
83 #define LAST_SPECIAL_PROC_NR 10 /* An untyped version for
84 computation in macros.*/
85 #define INIT_PROC_NR ((endpoint_t) LAST_SPECIAL_PROC_NR) /* init
87 #define NR_BOOT_MODULES (INIT_PROC_NR+1)
89 /* Root system process and root user process. */
90 #define ROOT_SYS_PROC_NR RS_PROC_NR
91 #define ROOT_USR_PROC_NR INIT_PROC_NR
93 /*===========================================================================*
94 * Kernel notification types *
95 *===========================================================================*/
97 /* Kernel notification types. In principle, these can be sent to any process,
98 * so make sure that these types do not interfere with other message types.
99 * Notifications are prioritized because of the way they are unhold() and
100 * blocking notifications are delivered. The lowest numbers go first. The
101 * offset are used for the per-process notification bit maps.
103 #define NOTIFY_MESSAGE 0x1000
104 /* FIXME the old is_notify(a) should be replaced by is_ipc_notify(status). */
105 #define is_ipc_notify(ipc_status) (IPC_STATUS_CALL(ipc_status) == NOTIFY)
106 #define is_notify(a) ((unsigned) ((a) - NOTIFY_MESSAGE) < 0x100)
107 #define is_ipc_asynch(ipc_status) \
108 (is_ipc_notify(ipc_status) || IPC_STATUS_CALL(ipc_status) == SENDA)
110 /*===========================================================================*
111 * Messages for BUS controller drivers *
112 *===========================================================================*/
113 #define BUSC_RQ_BASE 0x300 /* base for request types */
114 #define BUSC_RS_BASE 0x380 /* base for response types */
116 #define BUSC_PCI_INIT (BUSC_RQ_BASE + 0) /* First message to
119 #define BUSC_PCI_FIRST_DEV (BUSC_RQ_BASE + 1) /* Get index (and
123 #define BUSC_PCI_NEXT_DEV (BUSC_RQ_BASE + 2) /* Get index (and
127 #define BUSC_PCI_FIND_DEV (BUSC_RQ_BASE + 3) /* Get index of a
128 * PCI device based on
131 #define BUSC_PCI_IDS (BUSC_RQ_BASE + 4) /* Get vid/did from an
134 #define BUSC_PCI_RESERVE (BUSC_RQ_BASE + 7) /* Reserve a PCI dev */
135 #define BUSC_PCI_ATTR_R8 (BUSC_RQ_BASE + 8) /* Read 8-bit
138 #define BUSC_PCI_ATTR_R16 (BUSC_RQ_BASE + 9) /* Read 16-bit
141 #define BUSC_PCI_ATTR_R32 (BUSC_RQ_BASE + 10) /* Read 32-bit
144 #define BUSC_PCI_ATTR_W8 (BUSC_RQ_BASE + 11) /* Write 8-bit
147 #define BUSC_PCI_ATTR_W16 (BUSC_RQ_BASE + 12) /* Write 16-bit
150 #define BUSC_PCI_ATTR_W32 (BUSC_RQ_BASE + 13) /* Write 32-bit
153 #define BUSC_PCI_RESCAN (BUSC_RQ_BASE + 14) /* Rescan bus */
154 #define BUSC_PCI_DEV_NAME_S (BUSC_RQ_BASE + 15) /* Get the name of a
158 #define BUSC_PCI_SLOT_NAME_S (BUSC_RQ_BASE + 16) /* Get the name of a
159 * PCI slot (safecopy)
161 #define BUSC_PCI_SET_ACL (BUSC_RQ_BASE + 17) /* Set the ACL for a
164 #define BUSC_PCI_DEL_ACL (BUSC_RQ_BASE + 18) /* Delete the ACL of a
167 #define BUSC_PCI_GET_BAR (BUSC_RQ_BASE + 19) /* Get Base Address
168 * Register properties
170 #define BUSC_PGB_DEVIND m2_i1 /* device index */
171 #define BUSC_PGB_PORT m2_i2 /* port (BAR offset) */
172 #define BUSC_PGB_BASE m2_l1 /* BAR base address */
173 #define BUSC_PGB_SIZE m2_l2 /* BAR size */
174 #define BUSC_PGB_IOFLAG m2_i1 /* I/O space? */
175 #define IOMMU_MAP (BUSC_RQ_BASE + 32) /* Ask IOMMU to map
176 * a segment of memory
179 #define BUSC_I2C_RESERVE (BUSC_RQ_BASE + 64) /* reserve i2c device */
180 #define BUSC_I2C_ADDR m2_i1 /* slave address */
181 #define BUSC_I2C_EXEC (BUSC_RQ_BASE + 65) /* perform i2c action */
182 #define BUSC_I2C_GRANT m2_i1 /* grant for request */
184 /*===========================================================================*
185 * Messages for networking layer *
186 *===========================================================================*/
188 /* Base type for data link layer requests and responses. */
189 #define DL_RQ_BASE 0x200
190 #define DL_RS_BASE 0x280
192 #define IS_DL_RQ(type) (((type) & ~0x7f) == DL_RQ_BASE)
193 #define IS_DL_RS(type) (((type) & ~0x7f) == DL_RS_BASE)
195 /* Message types for data link layer requests. */
196 #define DL_CONF (DL_RQ_BASE + 0)
197 #define DL_GETSTAT_S (DL_RQ_BASE + 1)
198 #define DL_WRITEV_S (DL_RQ_BASE + 2)
199 #define DL_READV_S (DL_RQ_BASE + 3)
201 /* Message type for data link layer replies. */
202 #define DL_CONF_REPLY (DL_RS_BASE + 0)
203 #define DL_STAT_REPLY (DL_RS_BASE + 1)
204 #define DL_TASK_REPLY (DL_RS_BASE + 2)
206 /* Field names for data link layer messages. */
207 #define DL_COUNT m2_i3
208 #define DL_MODE m2_l1
209 #define DL_FLAGS m2_l1
210 #define DL_GRANT m2_l2
211 #define DL_STAT m3_i1
212 #define DL_HWADDR m3_ca1
214 /* Bits in 'DL_FLAGS' field of DL replies. */
215 # define DL_NOFLAGS 0x00
216 # define DL_PACK_SEND 0x01
217 # define DL_PACK_RECV 0x02
219 /* Bits in 'DL_MODE' field of DL requests. */
220 # define DL_NOMODE 0x0
221 # define DL_PROMISC_REQ 0x1
222 # define DL_MULTI_REQ 0x2
223 # define DL_BROAD_REQ 0x4
225 /*===========================================================================*
226 * SYSTASK request types and field names *
227 *===========================================================================*/
229 /* System library calls are dispatched via a call vector, so be careful when
230 * modifying the system call numbers. The numbers here determine which call
231 * is made from the call vector.
233 #define KERNEL_CALL 0x600 /* base for kernel calls to SYSTEM */
235 # define SYS_FORK (KERNEL_CALL + 0) /* sys_fork() */
236 # define SYS_EXEC (KERNEL_CALL + 1) /* sys_exec() */
237 # define SYS_CLEAR (KERNEL_CALL + 2) /* sys_clear() */
238 # define SYS_SCHEDULE (KERNEL_CALL + 3) /* sys_schedule() */
239 # define SYS_PRIVCTL (KERNEL_CALL + 4) /* sys_privctl() */
240 # define SYS_TRACE (KERNEL_CALL + 5) /* sys_trace() */
241 # define SYS_KILL (KERNEL_CALL + 6) /* sys_kill() */
243 # define SYS_GETKSIG (KERNEL_CALL + 7) /* sys_getsig() */
244 # define SYS_ENDKSIG (KERNEL_CALL + 8) /* sys_endsig() */
245 # define SYS_SIGSEND (KERNEL_CALL + 9) /* sys_sigsend() */
246 # define SYS_SIGRETURN (KERNEL_CALL + 10) /* sys_sigreturn() */
248 # define SYS_MEMSET (KERNEL_CALL + 13) /* sys_memset() */
250 # define SYS_UMAP (KERNEL_CALL + 14) /* sys_umap() */
251 # define SYS_VIRCOPY (KERNEL_CALL + 15) /* sys_vircopy() */
252 # define SYS_PHYSCOPY (KERNEL_CALL + 16) /* sys_physcopy() */
253 # define SYS_UMAP_REMOTE (KERNEL_CALL + 17) /* sys_umap_remote() */
254 # define SYS_VUMAP (KERNEL_CALL + 18) /* sys_vumap() */
256 # define SYS_IRQCTL (KERNEL_CALL + 19) /* sys_irqctl() */
257 # define SYS_INT86 (KERNEL_CALL + 20) /* sys_int86() */
258 # define SYS_DEVIO (KERNEL_CALL + 21) /* sys_devio() */
259 # define SYS_SDEVIO (KERNEL_CALL + 22) /* sys_sdevio() */
260 # define SYS_VDEVIO (KERNEL_CALL + 23) /* sys_vdevio() */
262 # define SYS_SETALARM (KERNEL_CALL + 24) /* sys_setalarm() */
263 # define SYS_TIMES (KERNEL_CALL + 25) /* sys_times() */
264 # define SYS_GETINFO (KERNEL_CALL + 26) /* sys_getinfo() */
265 # define SYS_ABORT (KERNEL_CALL + 27) /* sys_abort() */
266 # define SYS_IOPENABLE (KERNEL_CALL + 28) /* sys_enable_iop() */
267 # define SYS_SAFECOPYFROM (KERNEL_CALL + 31) /* sys_safecopyfrom() */
268 # define SYS_SAFECOPYTO (KERNEL_CALL + 32) /* sys_safecopyto() */
269 # define SYS_VSAFECOPY (KERNEL_CALL + 33) /* sys_vsafecopy() */
270 # define SYS_SETGRANT (KERNEL_CALL + 34) /* sys_setgrant() */
271 # define SYS_READBIOS (KERNEL_CALL + 35) /* sys_readbios() */
273 # define SYS_SPROF (KERNEL_CALL + 36) /* sys_sprof() */
274 # define SYS_CPROF (KERNEL_CALL + 37) /* sys_cprof() */
275 # define SYS_PROFBUF (KERNEL_CALL + 38) /* sys_profbuf() */
277 # define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
278 # define SYS_SETTIME (KERNEL_CALL + 40) /* sys_settime() */
280 # define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
282 # define SYS_DIAGCTL (KERNEL_CALL + 44) /* sys_diagctl() */
284 # define SYS_VTIMER (KERNEL_CALL + 45) /* sys_vtimer() */
285 # define SYS_RUNCTL (KERNEL_CALL + 46) /* sys_runctl() */
286 # define SYS_GETMCONTEXT (KERNEL_CALL + 50) /* sys_getmcontext() */
287 # define SYS_SETMCONTEXT (KERNEL_CALL + 51) /* sys_setmcontext() */
289 # define SYS_UPDATE (KERNEL_CALL + 52) /* sys_update() */
290 # define SYS_EXIT (KERNEL_CALL + 53) /* sys_exit() */
292 # define SYS_SCHEDCTL (KERNEL_CALL + 54) /* sys_schedctl() */
293 # define SYS_STATECTL (KERNEL_CALL + 55) /* sys_statectl() */
295 # define SYS_SAFEMEMSET (KERNEL_CALL + 56) /* sys_safememset() */
297 # define SYS_PADCONF (KERNEL_CALL + 57) /* sys_padconf() */
300 #define NR_SYS_CALLS 58 /* number of kernel calls */
302 #define SYS_CALL_MASK_SIZE BITMAP_CHUNKS(NR_SYS_CALLS)
304 /* Basic kernel calls allowed to every system process. */
305 #define SYS_BASIC_CALLS \
306 SYS_EXIT, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, SYS_VSAFECOPY, SYS_GETINFO, \
307 SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \
308 SYS_PROFBUF, SYS_DIAGCTL, SYS_STATECTL, SYS_SAFEMEMSET
310 /* Field names for SYS_MEMSET. */
311 #define MEM_PTR m2_p1 /* base */
312 #define MEM_COUNT m2_l1 /* count */
313 #define MEM_PATTERN m2_l2 /* pattern to write */
314 #define MEM_PROCESS m2_i1 /* NONE (phys) or process id (vir) */
316 /* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
317 #define DIO_REQUEST m2_i3 /* device in or output */
318 # define _DIO_INPUT 0x001
319 # define _DIO_OUTPUT 0x002
320 # define _DIO_DIRMASK 0x00f
321 # define _DIO_BYTE 0x010
322 # define _DIO_WORD 0x020
323 # define _DIO_LONG 0x030
324 # define _DIO_TYPEMASK 0x0f0
325 # define _DIO_SAFE 0x100
326 # define _DIO_SAFEMASK 0xf00
327 # define DIO_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE)
328 # define DIO_INPUT_WORD (_DIO_INPUT|_DIO_WORD)
329 # define DIO_INPUT_LONG (_DIO_INPUT|_DIO_LONG)
330 # define DIO_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE)
331 # define DIO_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD)
332 # define DIO_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG)
333 # define DIO_SAFE_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
334 # define DIO_SAFE_INPUT_WORD (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
335 # define DIO_SAFE_INPUT_LONG (_DIO_INPUT|_DIO_LONG|_DIO_SAFE)
336 # define DIO_SAFE_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
337 # define DIO_SAFE_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
338 # define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
339 #define DIO_PORT m2_l1 /* single port address */
340 #define DIO_VALUE m2_l2 /* single I/O value */
341 #define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */
342 #define DIO_VEC_SIZE m2_l2 /* number of elements in vector */
343 #define DIO_VEC_ENDPT m2_i2 /* number of process where vector is */
344 #define DIO_OFFSET m2_i1 /* offset from grant */
346 /* Field names for SYS_SETALARM. */
347 #define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */
348 #define ALRM_ABS_TIME m2_i2 /* set to 1 to use absolute alarm time */
349 #define ALRM_TIME_LEFT m2_l1 /* how many ticks were remaining */
351 /* Field names for SYS_IRQCTL. */
352 #define IRQ_REQUEST m5_s1 /* what to do? */
353 # define IRQ_SETPOLICY 1 /* manage a slot of the IRQ table */
354 # define IRQ_RMPOLICY 2 /* remove a slot of the IRQ table */
355 # define IRQ_ENABLE 3 /* enable interrupts */
356 # define IRQ_DISABLE 4 /* disable interrupts */
357 #define IRQ_VECTOR m5_s2 /* irq vector */
358 #define IRQ_POLICY m5_i1 /* options for IRQCTL request */
359 # define IRQ_REENABLE 0x001 /* reenable IRQ line after interrupt */
360 # define IRQ_BYTE 0x100 /* byte values */
361 # define IRQ_WORD 0x200 /* word values */
362 # define IRQ_LONG 0x400 /* long values */
363 #define IRQ_HOOK_ID m5_l3 /* id of irq hook at kernel */
365 /* Field names for SYS_ABORT. */
366 #define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */
368 /* Field names for SYS_IOPENABLE. */
369 #define IOP_ENDPT m2_l1 /* target endpoint */
371 /* Field names for _UMAP, _VIRCOPY, _PHYSCOPY. */
372 #define CP_SRC_ENDPT m5_i1 /* process to copy from */
373 #define CP_SRC_ADDR m5_l1 /* address where data come from */
374 #define CP_DST_ENDPT m5_i2 /* process to copy to */
375 #define CP_DST_ADDR m5_l2 /* address where data go to */
376 #define CP_NR_BYTES m5_l3 /* number of bytes to copy */
378 #define UMAP_SEG m5_s1
380 /* only used for backwards compatability */
381 #define CP_SRC_SPACE_OBSOLETE m5_s1 /* T or D space (stack is also D) */
382 #define CP_DST_SPACE_OBSOLETE m5_s2 /* T or D space (stack is also D) */
384 /* Field names for SYS_VUMAP. */
385 #define VUMAP_ENDPT m10_i1 /* grant owner, or SELF for local addresses */
386 #define VUMAP_VADDR m10_l1 /* address of virtual (input) vector */
387 #define VUMAP_VCOUNT m10_i2 /* number of elements in virtual vector */
388 #define VUMAP_OFFSET m10_l2 /* offset into first entry of input vector */
389 #define VUMAP_ACCESS m10_i3 /* access requested for input (VUA_ flags) */
390 #define VUMAP_PADDR m10_l3 /* address of physical (output) vector */
391 #define VUMAP_PMAX m10_i4 /* max number of physical vector elements */
392 #define VUMAP_PCOUNT m10_i1 /* upon return: number of elements filled */
394 /* Field names for SYS_GETINFO. */
395 #define I_REQUEST m7_i3 /* what info to get */
396 # define GET_KINFO 0 /* get kernel information structure */
397 # define GET_IMAGE 1 /* get system image table */
398 # define GET_PROCTAB 2 /* get kernel process table */
399 # define GET_RANDOMNESS 3 /* get randomness buffer */
400 # define GET_MONPARAMS 4 /* get monitor parameters */
401 # define GET_KENV 5 /* get kernel environment string */
402 # define GET_IRQHOOKS 6 /* get the IRQ table */
403 # define GET_PRIVTAB 8 /* get kernel privileges table */
404 # define GET_KADDRESSES 9 /* get various kernel addresses */
405 # define GET_SCHEDINFO 10 /* get scheduling queues */
406 # define GET_PROC 11 /* get process slot if given process */
407 # define GET_MACHINE 12 /* get machine information */
408 # define GET_LOCKTIMING 13 /* get lock()/unlock() latency timing */
409 # define GET_BIOSBUFFER 14 /* get a buffer for BIOS calls */
410 # define GET_LOADINFO 15 /* get load average information */
411 # define GET_IRQACTIDS 16 /* get the IRQ masks */
412 # define GET_PRIV 17 /* get privilege structure */
413 # define GET_HZ 18 /* get HZ value */
414 # define GET_WHOAMI 19 /* get own name, endpoint, and privileges */
415 # define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
416 # define GET_IDLETSC 21 /* get cumulative idle time stamp counter */
417 # define GET_CPUINFO 23 /* get information about cpus */
418 # define GET_REGS 24 /* get general process registers */
419 # define GET_RUSAGE 25 /* get resource usage */
420 #define I_ENDPT m7_i4 /* calling process (may only be SELF) */
421 #define I_VAL_PTR m7_p1 /* virtual address at caller */
422 #define I_VAL_LEN m7_i1 /* max length of value */
423 #define I_VAL_PTR2 m7_p2 /* second virtual address */
424 #define I_VAL_LEN2_E m7_i2 /* second length, or proc nr */
426 /* GET_WHOAMI fields. */
427 #define GIWHO_EP m3_i1
428 #define GIWHO_NAME m3_ca1
429 #define GIWHO_PRIVFLAGS m3_i2
431 /* Field names for SYS_TIMES. */
432 #define T_ENDPT m4_l1 /* process to request time info for */
433 #define T_USER_TIME m4_l1 /* user time consumed by process */
434 #define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
435 #define T_BOOTTIME m4_ll1 /* Boottime in seconds (also for SYS_STIME) */
436 #define T_REAL_TICKS m4_l4 /* number of wall clock ticks since boottime */
437 #define T_BOOT_TICKS m4_l5 /* number of hard clock ticks since boottime */
439 /* Field names for SYS_SETTIME. */
440 #define T_SETTIME_NOW m4_l2 /* non-zero for immediate, 0 for adjtime */
441 #define T_CLOCK_ID m4_l3 /* clock to adjust */
442 #define T_TIME_SEC m4_ll1 /* time in seconds since 1970 */
443 #define T_TIME_NSEC m4_l5 /* number of nano seconds */
445 /* Field names for SYS_TRACE, SYS_PRIVCTL, SYS_STATECTL. */
446 #define CTL_ENDPT m2_i1 /* process number of the caller */
447 #define CTL_REQUEST m2_i2 /* server control request */
448 #define CTL_ARG_PTR m2_p1 /* pointer to argument */
449 #define CTL_ADDRESS m2_l1 /* address at traced process' space */
450 #define CTL_DATA m2_l2 /* data field for tracing */
452 /* SYS_PRIVCTL with CTL_REQUEST == SYS_PRIV_QUERY_MEM */
453 #define CTL_PHYSSTART m2_l1 /* physical memory start in bytes*/
454 #define CTL_PHYSLEN m2_l2 /* length in bytes */
456 /* Subfunctions for SYS_PRIVCTL */
457 #define SYS_PRIV_ALLOW 1 /* Allow process to run */
458 #define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
459 #define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
460 #define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
461 #define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
462 #define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
464 #define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
465 #define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
466 #define SYS_PRIV_UPDATE_SYS 9 /* Update a sys privilege structure. */
467 #define SYS_PRIV_YIELD 10 /* Allow process to run and suspend */
469 /* Field names for SYS_SETGRANT */
470 #define SG_ADDR m2_p1 /* address */
471 #define SG_SIZE m2_i2 /* no. of entries */
473 /* Field names for SYS_FORK, _EXEC, _EXIT, GETMCONTEXT, SETMCONTEXT.*/
474 #define PR_ENDPT m1_i1 /* indicates a process */
475 #define PR_PRIORITY m1_i2 /* process priority */
476 #define PR_SLOT m1_i2 /* indicates a process slot */
477 #define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
478 #define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
479 #define PR_IP_PTR m1_p3 /* initial value for ip after exec */
480 #define PR_PS_STR_PTR m1_p4 /* pointer to ps_strings, expected by __start */
481 #define PR_FORK_FLAGS m1_i3 /* optional flags for fork operation */
482 #define PR_FORK_MSGADDR m1_p1 /* reply message address of forked child */
483 #define PR_CTX_PTR m1_p1 /* pointer to mcontext_t structure */
485 /* Constants for exec. FIXME: these do not belong here. */
486 #define PMEF_AUXVECTORS 20
487 #define PMEF_EXECNAMELEN1 PATH_MAX
489 /* Flags for PR_FORK_FLAGS. */
490 #define PFF_VMINHIBIT 0x01 /* Don't schedule until release by VM. */
492 /* Field names for SYS_INT86 */
493 #define INT86_REG86 m1_p1 /* pointer to registers */
495 /* Field names for SYS_SAFECOPY* */
496 #define SCP_FROM_TO m2_i1 /* from/to whom? */
497 #define SCP_SEG_OBSOLETE m2_i2 /* my own segment */
498 #define SCP_GID m2_i3 /* grant id */
499 #define SCP_OFFSET m2_l1 /* offset within grant */
500 #define SCP_ADDRESS m2_p1 /* my own address */
501 #define SCP_BYTES m2_l2 /* bytes from offset */
504 #define SMS_DST m2_i1 /* dst endpoint */
505 #define SMS_GID m2_i3 /* grant id */
506 #define SMS_OFFSET m2_l1 /* offset within grant */
507 #define SMS_BYTES m2_l2 /* bytes from offset */
508 #define SMS_PATTERN m2_i2 /* memset() pattern */
510 /* Field names for SYS_VSAFECOPY* */
511 #define VSCP_VEC_ADDR m2_p1 /* start of vector */
512 #define VSCP_VEC_SIZE m2_l2 /* elements in vector */
514 #define SMAP_SEG_OBSOLETE m2_p1
516 /* Field names for SYS_SPROF, _CPROF, _PROFBUF. */
517 #define PROF_ACTION m7_i1 /* start/stop/reset/get */
518 #define PROF_MEM_SIZE m7_i2 /* available memory for data */
519 #define PROF_FREQ m7_i3 /* sample frequency */
520 #define PROF_ENDPT m7_i4 /* endpoint of caller */
521 #define PROF_INTR_TYPE m7_i5 /* interrupt type */
522 #define PROF_CTL_PTR m7_p1 /* location of info struct */
523 #define PROF_MEM_PTR m7_p2 /* location of profiling data */
525 /* Field names for SYS_READBIOS. */
526 #define RDB_SIZE m2_i1
527 #define RDB_ADDR m2_l1
528 #define RDB_BUF m2_p1
530 /* Field names for SYS_VMCTL. */
531 #define SVMCTL_WHO m1_i1
532 #define SVMCTL_PARAM m1_i2 /* All SYS_VMCTL requests. */
533 #define SVMCTL_VALUE m1_i3
534 #define SVMCTL_MRG_TARGET m2_i1 /* MEMREQ_GET reply: target process */
535 #define SVMCTL_MRG_ADDR m2_i2 /* MEMREQ_GET reply: address */
536 #define SVMCTL_MRG_LENGTH m2_i3 /* MEMREQ_GET reply: length */
537 #define SVMCTL_MRG_FLAG m2_s1 /* MEMREQ_GET reply: flag */
538 #define SVMCTL_MRG_EP2 m2_l1 /* MEMREQ_GET reply: source process */
539 #define SVMCTL_MRG_ADDR2 m2_l2 /* MEMREQ_GET reply: source address */
540 #define SVMCTL_MRG_REQUESTOR m2_p1 /* MEMREQ_GET reply: requestor */
541 #define SVMCTL_MAP_VIR_ADDR m1_p1
542 #define SVMCTL_PTROOT m1_i3
543 #define SVMCTL_PTROOT_V m1_p1
545 /* Reply message for VMCTL_KERN_PHYSMAP */
546 #define SVMCTL_MAP_FLAGS m2_i1 /* VMMF_* */
547 #define SVMCTL_MAP_PHYS_ADDR m2_l1
548 #define SVMCTL_MAP_PHYS_LEN m2_l2
550 #define VMMF_UNCACHED (1L << 0)
551 #define VMMF_USER (1L << 1)
552 #define VMMF_WRITE (1L << 2)
553 #define VMMF_GLO (1L << 3)
555 /* Values for SVMCTL_PARAM. */
556 #define VMCTL_CLEAR_PAGEFAULT 12
557 #define VMCTL_GET_PDBR 13
558 #define VMCTL_MEMREQ_GET 14
559 #define VMCTL_MEMREQ_REPLY 15
560 #define VMCTL_NOPAGEZERO 18
561 #define VMCTL_I386_KERNELLIMIT 19
562 #define VMCTL_I386_INVLPG 25
563 #define VMCTL_FLUSHTLB 26
564 #define VMCTL_KERN_PHYSMAP 27
565 #define VMCTL_KERN_MAP_REPLY 28
566 #define VMCTL_SETADDRSPACE 29
567 #define VMCTL_VMINHIBIT_SET 30
568 #define VMCTL_VMINHIBIT_CLEAR 31
569 #define VMCTL_CLEARMAPCACHE 32
570 #define VMCTL_BOOTINHIBIT_CLEAR 33
572 /* Codes and field names for SYS_DIAGCTL. */
573 #define DIAGCTL_CODE m1_i1 /* DIAGCTL_CODE_* below */
574 #define DIAGCTL_ARG1 m1_p1
575 #define DIAGCTL_ARG2 m1_i2
576 #define DIAGCTL_CODE_DIAG 1 /* Print diagnostics. */
577 #define DIAGCTL_CODE_STACKTRACE 2 /* Print process stack. */
578 #define DIAGCTL_CODE_REGISTER 3 /* Register for diagnostic signals */
579 #define DIAGCTL_CODE_UNREGISTER 4 /* Unregister for diagnostic signals */
580 #define DIAG_BUFSIZE (80*25)
582 /* Field names for SYS_VTIMER. */
583 #define VT_WHICH m2_i1 /* which timer to set/retrieve */
584 # define VT_VIRTUAL 1 /* the ITIMER_VIRTUAL timer */
585 # define VT_PROF 2 /* the ITIMER_PROF timer */
586 #define VT_SET m2_i2 /* 1 for setting a timer, 0 retrieval only */
587 #define VT_VALUE m2_l1 /* new/previous value of the timer */
588 #define VT_ENDPT m2_l2 /* process to set/retrieve the timer for */
590 /* Field names for SYS_RUNCTL. */
591 #define RC_ENDPT m1_i1 /* which process to stop or resume */
592 #define RC_ACTION m1_i2 /* set or clear stop flag */
593 # define RC_STOP 0 /* stop the process */
594 # define RC_RESUME 1 /* clear the stop flag */
595 #define RC_FLAGS m1_i3 /* request flags */
596 # define RC_DELAY 1 /* delay stop if process is sending */
598 /* Field names for SYS_UPDATE. */
599 #define SYS_UPD_SRC_ENDPT m1_i1 /* source endpoint */
600 #define SYS_UPD_DST_ENDPT m1_i2 /* destination endpoint */
602 /* Subfunctions for SYS_STATECTL */
603 #define SYS_STATE_CLEAR_IPC_REFS 1 /* clear IPC references */
605 /* Subfunctions for SYS_SCHEDCTL */
606 #define SCHEDCTL_FLAGS m9_l1 /* flags for setting the scheduler */
607 # define SCHEDCTL_FLAG_KERNEL 1 /* mark kernel scheduler and remove
608 * RTS_NO_QUANTUM; otherwise caller is
611 #define SCHEDCTL_ENDPOINT m9_l2 /* endpt of process to be scheduled */
612 #define SCHEDCTL_QUANTUM m9_l3 /* current scheduling quantum */
613 #define SCHEDCTL_PRIORITY m9_s4 /* current scheduling priority */
614 #define SCHEDCTL_CPU m9_l5 /* where to place this process */
616 /* Field names for SYS_PADCONF */
617 #define PADCONF_PADCONF m2_i1 /* pad to configure */
618 #define PADCONF_MASK m2_i2 /* mask to apply */
619 #define PADCONF_VALUE m2_i3 /* value to write */
621 /*===========================================================================*
622 * Messages for the Reincarnation Server *
623 *===========================================================================*/
625 #define RS_RQ_BASE 0x700
627 #define RS_UP (RS_RQ_BASE + 0) /* start system service */
628 #define RS_DOWN (RS_RQ_BASE + 1) /* stop system service */
629 #define RS_REFRESH (RS_RQ_BASE + 2) /* refresh system service */
630 #define RS_RESTART (RS_RQ_BASE + 3) /* restart system service */
631 #define RS_SHUTDOWN (RS_RQ_BASE + 4) /* alert about shutdown */
632 #define RS_UPDATE (RS_RQ_BASE + 5) /* update system service */
633 #define RS_CLONE (RS_RQ_BASE + 6) /* clone system service */
634 #define RS_EDIT (RS_RQ_BASE + 7) /* edit system service */
636 #define RS_LOOKUP (RS_RQ_BASE + 8) /* lookup server name */
638 #define RS_GETSYSINFO (RS_RQ_BASE + 9) /* get system information */
640 #define RS_INIT (RS_RQ_BASE + 20) /* service init message */
641 #define RS_LU_PREPARE (RS_RQ_BASE + 21) /* prepare to update message */
643 # define RS_CMD_ADDR m1_p1 /* command string */
644 # define RS_CMD_LEN m1_i1 /* length of command */
645 # define RS_PERIOD m1_i2 /* heartbeat period */
646 # define RS_DEV_MAJOR m1_i3 /* major device number */
648 # define RS_ENDPOINT m1_i1 /* endpoint number in reply */
650 # define RS_NAME m1_p1 /* name */
651 # define RS_NAME_LEN m1_i1 /* namelen */
653 # define RS_INIT_RESULT m7_i1 /* init result */
654 # define RS_INIT_TYPE m7_i2 /* init type */
655 # define RS_INIT_RPROCTAB_GID m7_i3 /* init rproc table gid */
656 # define RS_INIT_OLD_ENDPOINT m7_i4 /* init old endpoint */
658 # define RS_LU_RESULT m1_i1 /* live update result */
659 # define RS_LU_STATE m1_i2 /* state required to update */
660 # define RS_LU_PREPARE_MAXTIME m1_i3 /* the max time to prepare */
662 /*===========================================================================*
663 * Messages for the Data Store Server *
664 *===========================================================================*/
666 #define DS_RQ_BASE 0x800
668 #define DS_PUBLISH (DS_RQ_BASE + 0) /* publish data */
669 #define DS_RETRIEVE (DS_RQ_BASE + 1) /* retrieve data by name */
670 #define DS_SUBSCRIBE (DS_RQ_BASE + 2) /* subscribe to data updates */
671 #define DS_CHECK (DS_RQ_BASE + 3) /* retrieve updated data */
672 #define DS_DELETE (DS_RQ_BASE + 4) /* delete data */
673 #define DS_SNAPSHOT (DS_RQ_BASE + 5) /* take a snapshot */
674 #define DS_RETRIEVE_LABEL (DS_RQ_BASE + 6) /* retrieve label's name */
675 #define DS_GETSYSINFO (DS_RQ_BASE + 7) /* get system information */
678 # define DS_KEY_GRANT m2_i1 /* key for the data */
679 # define DS_KEY_LEN m2_s1 /* length of key incl. '\0' */
680 # define DS_FLAGS m2_i2 /* flags provided by caller */
682 # define DS_VAL m2_l1 /* data (u32, char *, etc.) */
683 # define DS_VAL_LEN m2_l2 /* data length */
684 # define DS_NR_SNAPSHOT m2_i3 /* number of snapshot */
685 # define DS_OWNER m2_i3 /* owner */
687 /*===========================================================================*
688 * Messages used between PM and VFS *
689 *===========================================================================*/
691 #define VFS_PM_RQ_BASE 0x900
692 #define VFS_PM_RS_BASE 0x980
694 #define IS_VFS_PM_RQ(type) (((type) & ~0x7f) == VFS_PM_RQ_BASE)
695 #define IS_VFS_PM_RS(type) (((type) & ~0x7f) == VFS_PM_RS_BASE)
697 /* Requests from PM to VFS. */
698 #define VFS_PM_INIT (VFS_PM_RQ_BASE + 0) /* Process table exchange */
699 #define VFS_PM_SETUID (VFS_PM_RQ_BASE + 1) /* Set new user ID */
700 #define VFS_PM_SETGID (VFS_PM_RQ_BASE + 2) /* Set group ID */
701 #define VFS_PM_SETSID (VFS_PM_RQ_BASE + 3) /* Set session leader */
702 #define VFS_PM_EXIT (VFS_PM_RQ_BASE + 4) /* Process exits */
703 #define VFS_PM_DUMPCORE (VFS_PM_RQ_BASE + 5) /* Process is to dump core */
704 #define VFS_PM_EXEC (VFS_PM_RQ_BASE + 6) /* Forwarded exec call */
705 #define VFS_PM_FORK (VFS_PM_RQ_BASE + 7) /* Newly forked process */
706 #define VFS_PM_SRV_FORK (VFS_PM_RQ_BASE + 8) /* fork for system services */
707 #define VFS_PM_UNPAUSE (VFS_PM_RQ_BASE + 9) /* Interrupt process call */
708 #define VFS_PM_REBOOT (VFS_PM_RQ_BASE + 10) /* System reboot */
709 #define VFS_PM_SETGROUPS (VFS_PM_RQ_BASE + 11) /* Set groups */
711 /* Replies from VFS to PM */
712 #define VFS_PM_SETUID_REPLY (VFS_PM_RS_BASE + 1)
713 #define VFS_PM_SETGID_REPLY (VFS_PM_RS_BASE + 2)
714 #define VFS_PM_SETSID_REPLY (VFS_PM_RS_BASE + 3)
715 #define VFS_PM_EXIT_REPLY (VFS_PM_RS_BASE + 4)
716 #define VFS_PM_CORE_REPLY (VFS_PM_RS_BASE + 5)
717 #define VFS_PM_EXEC_REPLY (VFS_PM_RS_BASE + 6)
718 #define VFS_PM_FORK_REPLY (VFS_PM_RS_BASE + 7)
719 #define VFS_PM_SRV_FORK_REPLY (VFS_PM_RS_BASE + 8)
720 #define VFS_PM_UNPAUSE_REPLY (VFS_PM_RS_BASE + 9)
721 #define VFS_PM_REBOOT_REPLY (VFS_PM_RS_BASE + 10)
722 #define VFS_PM_SETGROUPS_REPLY (VFS_PM_RS_BASE + 11)
724 /* Standard parameters for all requests and replies, except PM_REBOOT */
725 # define VFS_PM_ENDPT m7_i1 /* process endpoint */
727 /* Additional parameters for PM_INIT */
728 # define VFS_PM_SLOT m7_i2 /* process slot number */
729 # define VFS_PM_PID m7_i3 /* process pid */
731 /* Additional parameters for PM_SETUID and PM_SETGID */
732 # define VFS_PM_EID m7_i2 /* effective user/group id */
733 # define VFS_PM_RID m7_i3 /* real user/group id */
735 /* Additional parameter for PM_SETGROUPS */
736 # define VFS_PM_GROUP_NO m7_i2 /* number of groups */
737 # define VFS_PM_GROUP_ADDR m7_p1 /* struct holding group data */
739 /* Additional parameters for PM_EXEC */
740 # define VFS_PM_PATH m7_p1 /* executable */
741 # define VFS_PM_PATH_LEN m7_i2 /* length of path including
742 * terminating null character
744 # define VFS_PM_FRAME m7_p2 /* arguments and environment */
745 # define VFS_PM_FRAME_LEN m7_i3 /* size of frame */
746 # define VFS_PM_PS_STR m7_i5 /* ps_strings pointer */
748 /* Additional parameters for PM_EXEC_REPLY and PM_CORE_REPLY */
749 # define VFS_PM_STATUS m7_i2 /* OK or failure */
750 # define VFS_PM_PC m7_p1 /* program counter */
751 # define VFS_PM_NEWSP m7_p2 /* possibly-changed stack ptr */
752 # define VFS_PM_NEWPS_STR m7_i5 /* possibly-changed ps_strings ptr */
754 /* Additional parameters for PM_FORK and PM_SRV_FORK */
755 # define VFS_PM_PENDPT m7_i2 /* parent process endpoint */
756 # define VFS_PM_CPID m7_i3 /* child pid */
757 # define VFS_PM_REUID m7_i4 /* real and effective uid */
758 # define VFS_PM_REGID m7_i5 /* real and effective gid */
760 /* Additional parameters for PM_DUMPCORE */
761 # define VFS_PM_TERM_SIG m7_i2 /* process's termination signal */
763 /*===========================================================================*
764 * Messages used from VFS to file servers *
765 *===========================================================================*/
767 #define FS_BASE 0xA00 /* Requests sent by VFS to filesystem
768 * implementations. See <minix/vfsif.h>
771 /*===========================================================================*
772 * Common requests and miscellaneous field names *
773 *===========================================================================*/
775 #define COMMON_RQ_BASE 0xE00
777 /* Field names for system signals (sent by a signal manager). */
778 #define SIGS_SIGNAL_RECEIVED (COMMON_RQ_BASE+0)
779 # define SIGS_SIG_NUM m2_i1
781 /* Common request to all processes: gcov data. */
782 #define COMMON_REQ_GCOV_DATA (COMMON_RQ_BASE+1)
783 # define GCOV_GRANT m1_i2
784 # define GCOV_PID m1_i3
785 # define GCOV_BUFF_P m1_p1
786 # define GCOV_BUFF_SZ m1_i1
788 /*===========================================================================*
789 * Messages for VM server *
790 *===========================================================================*/
791 #define VM_RQ_BASE 0xC00
794 #define VM_EXIT (VM_RQ_BASE+0)
795 # define VME_ENDPOINT m1_i1
796 #define VM_FORK (VM_RQ_BASE+1)
797 # define VMF_ENDPOINT m1_i1
798 # define VMF_SLOTNO m1_i2
799 # define VMF_CHILD_ENDPOINT m1_i3 /* result */
800 #define VM_BRK (VM_RQ_BASE+2)
801 # define VMB_ADDR m1_p1
802 #define VM_EXEC_NEWMEM (VM_RQ_BASE+3)
803 # define VMEN_ENDPOINT m1_i1
804 # define VMEN_ARGSPTR m1_p1
805 # define VMEN_ARGSSIZE m1_i2
806 # define VMEN_FLAGS m1_i3 /* result */
807 # define VMEN_STACK_TOP m1_p2 /* result */
808 #define VM_WILLEXIT (VM_RQ_BASE+5)
809 # define VMWE_ENDPOINT m1_i1
812 #define VM_MMAP (VM_RQ_BASE+10)
813 # define VMM_ADDR m_mmap.addr
814 # define VMM_LEN m_mmap.len
815 # define VMM_PROT m_mmap.prot
816 # define VMM_FLAGS m_mmap.flags
817 # define VMM_FD m_mmap.fd
818 # define VMM_OFFSET m_mmap.offset
819 # define VMM_FORWHOM m_mmap.forwhom
820 # define VMM_RETADDR m_mmap.retaddr
822 #define VM_MUNMAP (VM_RQ_BASE+17)
823 # define VMUM_ADDR m_mmap.addr
824 # define VMUM_LEN m_mmap.len
826 /* to VM: inform VM about a region of memory that is used for
829 #define VM_ADDDMA (VM_RQ_BASE+12)
830 # define VMAD_EP m2_i1
831 # define VMAD_START m2_l1
832 # define VMAD_SIZE m2_l2
834 /* to VM: inform VM that a region of memory that is no longer
835 * used for bus-master DMA
837 #define VM_DELDMA (VM_RQ_BASE+13)
838 # define VMDD_EP m2_i1
839 # define VMDD_START m2_l1
840 # define VMDD_SIZE m2_l2
842 /* to VM: ask VM for a region of memory that should not
843 * be used for bus-master DMA any longer
845 #define VM_GETDMA (VM_RQ_BASE+14)
846 # define VMGD_PROCP m2_i1
847 # define VMGD_BASEP m2_l1
848 # define VMGD_SIZEP m2_l2
850 #define VM_MAP_PHYS (VM_RQ_BASE+15)
851 # define VMMP_EP m1_i1
852 # define VMMP_PHADDR m1_p2
853 # define VMMP_LEN m1_i2
854 # define VMMP_VADDR_REPLY m1_p3
856 #define VM_UNMAP_PHYS (VM_RQ_BASE+16)
857 # define VMUP_EP m1_i1
858 # define VMUP_VADDR m1_p1
860 /* To VM: map in cache block by FS */
861 #define VM_MAPCACHEPAGE (VM_RQ_BASE+26)
863 /* To VM: identify cache block in FS */
864 #define VM_SETCACHEPAGE (VM_RQ_BASE+27)
866 /* To VM: clear all cache blocks for a device */
867 #define VM_CLEARCACHE (VM_RQ_BASE+28)
869 /* To VFS: fields for request from VM. */
870 # define VFS_VMCALL_REQ m10_i1
871 # define VFS_VMCALL_FD m10_i2
872 # define VFS_VMCALL_REQID m10_i3
873 # define VFS_VMCALL_ENDPOINT m10_i4
874 # define VFS_VMCALL_OFFSET_LO m10_l1
875 # define VFS_VMCALL_OFFSET_HI m10_l2
876 # define VFS_VMCALL_LENGTH m10_l3
878 /* Request codes to from VM to VFS */
879 #define VMVFSREQ_FDLOOKUP 101
880 #define VMVFSREQ_FDCLOSE 102
881 #define VMVFSREQ_FDIO 103
883 /* Calls from VFS. */
884 #define VM_VFS_REPLY (VM_RQ_BASE+30)
885 # define VMV_ENDPOINT m10_i1
886 # define VMV_RESULT m10_i2
887 # define VMV_REQID m10_i3
888 # define VMV_DEV m10_i4
889 # define VMV_INO m10_l1
890 # define VMV_FD m10_l2
891 # define VMV_SIZE_PAGES m10_l3
893 #define VM_REMAP (VM_RQ_BASE+33)
894 # define VMRE_D m1_i1
895 # define VMRE_S m1_i2
896 # define VMRE_DA m1_p1
897 # define VMRE_SA m1_p2
898 # define VMRE_RETA m1_p3
899 # define VMRE_SIZE m1_i3
900 # define VMRE_FLAGS m1_i3
902 #define VM_SHM_UNMAP (VM_RQ_BASE+34)
903 # define VMUN_ENDPT m_mmap.forwhom
904 # define VMUN_ADDR m_mmap.addr
906 #define VM_GETPHYS (VM_RQ_BASE+35)
907 # define VMPHYS_ENDPT m2_i1
908 # define VMPHYS_ADDR m2_l1
909 # define VMPHYS_RETA m2_l2
911 #define VM_GETREF (VM_RQ_BASE+36)
912 # define VMREFCNT_ENDPT m2_i1
913 # define VMREFCNT_ADDR m2_l1
914 # define VMREFCNT_RETC m2_i2
916 #define VM_RS_SET_PRIV (VM_RQ_BASE+37)
917 # define VM_RS_NR m2_i1
918 # define VM_RS_BUF m2_l1
919 # define VM_RS_SYS m2_i2
921 #define VM_QUERY_EXIT (VM_RQ_BASE+38)
922 # define VM_QUERY_RET_PT m2_i1
923 # define VM_QUERY_IS_MORE m2_i2
925 #define VM_NOTIFY_SIG (VM_RQ_BASE+39)
926 # define VM_NOTIFY_SIG_ENDPOINT m1_i1
927 # define VM_NOTIFY_SIG_IPC m1_i2
929 #define VM_INFO (VM_RQ_BASE+40)
930 # define VMI_WHAT m2_i1
931 # define VMI_EP m2_i2
932 # define VMI_COUNT m2_i3
933 # define VMI_PTR m2_p1
934 # define VMI_NEXT m2_l1
936 /* VMI_WHAT values. */
939 #define VMIW_REGION 3
941 #define VM_RS_UPDATE (VM_RQ_BASE+41)
942 # define VM_RS_SRC_ENDPT m1_i1
943 # define VM_RS_DST_ENDPT m1_i2
945 #define VM_RS_MEMCTL (VM_RQ_BASE+42)
946 # define VM_RS_CTL_ENDPT m1_i1
947 # define VM_RS_CTL_REQ m1_i2
948 # define VM_RS_MEM_PIN 0 /* pin memory */
949 # define VM_RS_MEM_MAKE_VM 1 /* make VM instance */
951 #define VM_WATCH_EXIT (VM_RQ_BASE+43)
952 # define VM_WE_EP m1_i1
954 #define VM_REMAP_RO (VM_RQ_BASE+44)
955 /* same args as VM_REMAP */
957 #define VM_PROCCTL (VM_RQ_BASE+45)
958 #define VMPCTL_PARAM m1_i1
959 #define VMPCTL_WHO m1_i2
961 #define VMPPARAM_CLEAR 1 /* values for VMPCTL_PARAM */
963 #define VM_VFS_MMAP (VM_RQ_BASE+46)
965 #define VM_GETRUSAGE (VM_RQ_BASE+47)
968 #define NR_VM_CALLS 48
969 #define VM_CALL_MASK_SIZE BITMAP_CHUNKS(NR_VM_CALLS)
971 /* not handled as a normal VM call, thus at the end of the reserved rage */
972 #define VM_PAGEFAULT (VM_RQ_BASE+0xff)
973 # define VPF_ADDR m1_i1
974 # define VPF_FLAGS m1_i2
976 /* Basic vm calls allowed to every process. */
977 #define VM_BASIC_CALLS \
978 VM_BRK, VM_MMAP, VM_MUNMAP, VM_MAP_PHYS, VM_UNMAP_PHYS, VM_INFO, \
981 /*===========================================================================*
982 * Messages for IPC server *
983 *===========================================================================*/
984 #define IPC_BASE 0xD00
987 #define IPC_SHMGET (IPC_BASE+1)
988 # define SHMGET_KEY m2_l1
989 # define SHMGET_SIZE m2_l2
990 # define SHMGET_FLAG m2_i1
991 # define SHMGET_RETID m2_i2
992 #define IPC_SHMAT (IPC_BASE+2)
993 # define SHMAT_ID m2_i1
994 # define SHMAT_ADDR m2_l1
995 # define SHMAT_FLAG m2_i2
996 # define SHMAT_RETADDR m2_l2
997 #define IPC_SHMDT (IPC_BASE+3)
998 # define SHMDT_ADDR m2_l1
999 #define IPC_SHMCTL (IPC_BASE+4)
1000 # define SHMCTL_ID m2_i1
1001 # define SHMCTL_CMD m2_i2
1002 # define SHMCTL_BUF m2_l1
1003 # define SHMCTL_RET m2_i3
1006 #define IPC_SEMGET (IPC_BASE+5)
1007 # define SEMGET_KEY m2_l1
1008 # define SEMGET_NR m2_i1
1009 # define SEMGET_FLAG m2_i2
1010 # define SEMGET_RETID m2_i3
1011 #define IPC_SEMCTL (IPC_BASE+6)
1012 # define SEMCTL_ID m2_i1
1013 # define SEMCTL_NUM m2_i2
1014 # define SEMCTL_CMD m2_i3
1015 # define SEMCTL_OPT m2_l1
1016 #define IPC_SEMOP (IPC_BASE+7)
1017 # define SEMOP_ID m2_i1
1018 # define SEMOP_OPS m2_l1
1019 # define SEMOP_SIZE m2_i2
1021 /*===========================================================================*
1022 * Messages for Scheduling *
1023 *===========================================================================*/
1024 #define SCHEDULING_BASE 0xF00
1026 #define SCHEDULING_NO_QUANTUM (SCHEDULING_BASE+1)
1027 # define SCHEDULING_ACNT_DEQS m9_l1
1028 # define SCHEDULING_ACNT_IPC_SYNC m9_l2
1029 # define SCHEDULING_ACNT_IPC_ASYNC m9_l3
1030 # define SCHEDULING_ACNT_PREEMPT m9_l4
1031 # define SCHEDULING_ACNT_QUEUE m9_l5
1032 # define SCHEDULING_ACNT_CPU m9_s1
1033 # define SCHEDULING_ACNT_CPU_LOAD m9_s2
1034 /* These are used for SYS_SCHEDULE, a reply to SCHEDULING_NO_QUANTUM */
1035 # define SCHEDULING_ENDPOINT m9_l1
1036 # define SCHEDULING_QUANTUM m9_l2
1037 # define SCHEDULING_PRIORITY m9_s1
1038 # define SCHEDULING_CPU m9_l4
1041 * SCHEDULING_START uses _ENDPOINT, _PRIORITY and _QUANTUM from
1042 * SCHEDULING_NO_QUANTUM/SYS_SCHEDULE
1044 #define SCHEDULING_START (SCHEDULING_BASE+2)
1045 # define SCHEDULING_SCHEDULER m9_l1 /* Overrides _ENDPOINT on return*/
1046 # define SCHEDULING_PARENT m9_l3
1047 # define SCHEDULING_MAXPRIO m9_l4
1049 #define SCHEDULING_STOP (SCHEDULING_BASE+3)
1051 #define SCHEDULING_SET_NICE (SCHEDULING_BASE+4)
1053 /* SCHEDULING_INHERIT is like SCHEDULING_START, but without _QUANTUM field */
1054 #define SCHEDULING_INHERIT (SCHEDULING_BASE+5)
1056 /*===========================================================================*
1057 * Messages for USB *
1058 *===========================================================================*/
1060 #define USB_BASE 0x1100
1062 /* those are from driver to USBD */
1063 #define USB_RQ_INIT (USB_BASE + 0) /* First message to HCD driver */
1064 #define USB_RQ_DEINIT (USB_BASE + 1) /* Quit the session */
1065 #define USB_RQ_SEND_URB (USB_BASE + 2) /* Send URB */
1066 #define USB_RQ_CANCEL_URB (USB_BASE + 3) /* Cancel URB */
1067 #define USB_REPLY (USB_BASE + 4)
1070 /* those are from USBD to driver */
1071 #define USB_COMPLETE_URB (USB_BASE + 6)
1072 #define USB_ANNOUCE_DEV (USB_BASE + 7) /* Announce a new USB Device */
1073 #define USB_WITHDRAW_DEV (USB_BASE + 8) /* Withdraw a allready anncounced
1075 # define USB_GRANT_ID m4_l1
1076 # define USB_GRANT_SIZE m4_l2
1078 # define USB_URB_ID m4_l1
1079 # define USB_RESULT m4_l2
1080 # define USB_DEV_ID m4_l1
1081 # define USB_DRIVER_EP m4_l2
1082 # define USB_INTERFACES m4_l3
1083 # define USB_RB_INIT_NAME m3_ca1
1085 /*===========================================================================*
1086 * Messages for DeviceManager (s/t like SysFS) *
1087 *===========================================================================*/
1089 #define DEVMAN_BASE 0x1200
1091 #define DEVMAN_ADD_DEV (DEVMAN_BASE + 0)
1092 #define DEVMAN_DEL_DEV (DEVMAN_BASE + 1)
1093 #define DEVMAN_ADD_BUS (DEVMAN_BASE + 2)
1094 #define DEVMAN_DEL_BUS (DEVMAN_BASE + 3)
1095 #define DEVMAN_ADD_DEVFILE (DEVMAN_BASE + 4)
1096 #define DEVMAN_DEL_DEVFILE (DEVMAN_BASE + 5)
1098 #define DEVMAN_REQUEST (DEVMAN_BASE + 6)
1099 #define DEVMAN_REPLY (DEVMAN_BASE + 7)
1101 #define DEVMAN_BIND (DEVMAN_BASE + 8)
1102 #define DEVMAN_UNBIND (DEVMAN_BASE + 9)
1104 # define DEVMAN_GRANT_ID m4_l1
1105 # define DEVMAN_GRANT_SIZE m4_l2
1107 # define DEVMAN_ENDPOINT m4_l3
1108 # define DEVMAN_DEVICE_ID m4_l2
1109 # define DEVMAN_RESULT m4_l1
1111 /*===========================================================================*
1112 * Messages for TTY *
1113 *===========================================================================*/
1115 #define TTY_RQ_BASE 0x1300
1117 #define TTY_FKEY_CONTROL (TTY_RQ_BASE + 1) /* control an F-key at TTY */
1118 # define FKEY_REQUEST m2_i1 /* request to perform at TTY */
1119 # define FKEY_MAP 10 /* observe function key */
1120 # define FKEY_UNMAP 11 /* stop observing function key */
1121 # define FKEY_EVENTS 12 /* request open key presses */
1122 # define FKEY_FKEYS m2_l1 /* F1-F12 keys pressed */
1123 # define FKEY_SFKEYS m2_l2 /* Shift-F1-F12 keys pressed */
1125 #define TTY_INPUT_UP (TTY_RQ_BASE + 2) /* input server is up */
1126 /* This message uses no message fields. */
1128 #define TTY_INPUT_EVENT (TTY_RQ_BASE + 3) /* relayed input event */
1129 /* This message shares its message fields with INPUT_EVENT. */
1131 /*===========================================================================*
1132 * Messages for input server and drivers *
1133 *===========================================================================*/
1135 /* The input protocol has no real replies. All messages are one-way. */
1136 #define INPUT_RQ_BASE 0x1500 /* from TTY to server, or server to driver */
1137 #define INPUT_RS_BASE 0x1580 /* from input driver to input server */
1139 #define INPUT_CONF (INPUT_RQ_BASE + 0) /* configure driver */
1140 # define INPUT_KBD_ID m7_i1 /* keyboard device ID */
1141 # define INPUT_MOUSE_ID m7_i2 /* mouse device ID */
1142 # define INPUT_RSVD1_ID m7_i3 /* ID for as yet unallocated type */
1143 # define INPUT_RSVD2_ID m7_i4 /* ID for as yet unallocated type */
1145 #define INPUT_SETLEDS (INPUT_RQ_BASE + 1) /* set keyboard LEDs */
1146 # define INPUT_LED_MASK m7_i1 /* status mask of LEDs */
1148 #define INPUT_EVENT (INPUT_RS_BASE + 0) /* send input event */
1149 # define INPUT_ID m7_i1 /* device ID */
1150 # define INPUT_PAGE m7_i2 /* usage page */
1151 # define INPUT_CODE m7_i3 /* usage code */
1152 # define INPUT_VALUE m7_i4 /* event value */
1153 # define INPUT_FLAGS m7_i5 /* flags associated with value */
1155 /*===========================================================================*
1156 * VFS-FS TRANSACTION IDs *
1157 *===========================================================================*/
1159 #define VFS_TRANSACTION_BASE 0xB00
1161 #define VFS_TRANSID (VFS_TRANSACTION_BASE + 1)
1162 #define IS_VFS_FS_TRANSID(type) (((type) & ~0xff) == VFS_TRANSACTION_BASE)
1164 /*===========================================================================*
1165 * Messages for character devices *
1166 *===========================================================================*/
1168 /* Base type for character device requests and responses. */
1169 #define CDEV_RQ_BASE 0x400
1170 #define CDEV_RS_BASE 0x480
1172 #define IS_CDEV_RQ(type) (((type) & ~0x7f) == CDEV_RQ_BASE)
1173 #define IS_CDEV_RS(type) (((type) & ~0x7f) == CDEV_RS_BASE)
1175 /* Message types for character device requests. */
1176 #define CDEV_OPEN (CDEV_RQ_BASE + 0) /* open a minor device */
1177 #define CDEV_CLOSE (CDEV_RQ_BASE + 1) /* close a minor device */
1178 #define CDEV_READ (CDEV_RQ_BASE + 2) /* read into a buffer */
1179 #define CDEV_WRITE (CDEV_RQ_BASE + 3) /* write from a buffer */
1180 #define CDEV_IOCTL (CDEV_RQ_BASE + 4) /* I/O control operation */
1181 #define CDEV_CANCEL (CDEV_RQ_BASE + 5) /* cancel suspended request */
1182 #define CDEV_SELECT (CDEV_RQ_BASE + 6) /* test for ready operations */
1184 /* Message types for character device responses. */
1185 #define CDEV_REPLY (CDEV_RS_BASE + 0) /* general reply code */
1186 #define CDEV_SEL1_REPLY (CDEV_RS_BASE + 1) /* immediate select reply */
1187 #define CDEV_SEL2_REPLY (CDEV_RS_BASE + 2) /* select notification reply */
1189 /* Field names for block device messages. */
1190 #define CDEV_MINOR m10_i1 /* minor device number */
1191 #define CDEV_STATUS m10_i2 /* OK, error code, minor device, operations */
1192 #define CDEV_ACCESS m10_i2 /* access bits for open requests */
1193 #define CDEV_GRANT m10_i2 /* grant ID of buffer */
1194 #define CDEV_OPS m10_i2 /* requested select operations */
1195 #define CDEV_COUNT m10_i3 /* number of bytes to transfer */
1196 #define CDEV_USER m10_i3 /* endpoint of user process */
1197 #define CDEV_FLAGS m10_i4 /* transfer flags */
1198 #define CDEV_ID m10_l1 /* opaque request ID */
1199 #define CDEV_REQUEST m10_l2 /* I/O control request */
1200 #define CDEV_POS_LO m10_l2 /* transfer position (low bits) */
1201 #define CDEV_POS_HI m10_l3 /* transfer position (high bits) */
1203 /* Bits in 'CDEV_ACCESS' field of block device open requests. */
1204 # define CDEV_R_BIT 0x01 /* open with read access */
1205 # define CDEV_W_BIT 0x02 /* open with write access */
1206 # define CDEV_NOCTTY 0x04 /* not to become the controlling TTY */
1208 /* Bits in 'CDEV_FLAGS' field of block device transfer requests. */
1209 # define CDEV_NOFLAGS 0x00 /* no flags are set */
1210 # define CDEV_NONBLOCK 0x01 /* do not suspend I/O request */
1212 /* Bits in 'CDEV_OPS', 'CDEV_STATUS' fields of block device select messages. */
1213 # define CDEV_OP_RD 0x01 /* selected for read operation */
1214 # define CDEV_OP_WR 0x02 /* selected for write operation */
1215 # define CDEV_OP_ERR 0x04 /* selected for error operation */
1216 # define CDEV_NOTIFY 0x08 /* notification requested */
1218 /* Bits in 'CDEV_STATUS' field of block device open responses. */
1219 # define CDEV_CLONED 0x20000000 /* device is cloned */
1220 # define CDEV_CTTY 0x40000000 /* device is controlling TTY */
1222 /*===========================================================================*
1223 * Messages for block devices *
1224 *===========================================================================*/
1226 /* Base type for block device requests and responses. */
1227 #define BDEV_RQ_BASE 0x500
1228 #define BDEV_RS_BASE 0x580
1230 #define IS_BDEV_RQ(type) (((type) & ~0x7f) == BDEV_RQ_BASE)
1231 #define IS_BDEV_RS(type) (((type) & ~0x7f) == BDEV_RS_BASE)
1233 /* Message types for block device requests. */
1234 #define BDEV_OPEN (BDEV_RQ_BASE + 0) /* open a minor device */
1235 #define BDEV_CLOSE (BDEV_RQ_BASE + 1) /* close a minor device */
1236 #define BDEV_READ (BDEV_RQ_BASE + 2) /* read into a buffer */
1237 #define BDEV_WRITE (BDEV_RQ_BASE + 3) /* write from a buffer */
1238 #define BDEV_GATHER (BDEV_RQ_BASE + 4) /* read into a vector */
1239 #define BDEV_SCATTER (BDEV_RQ_BASE + 5) /* write from a vector */
1240 #define BDEV_IOCTL (BDEV_RQ_BASE + 6) /* I/O control operation */
1242 /* Message types for block device responses. */
1243 #define BDEV_REPLY (BDEV_RS_BASE + 0) /* general reply code */
1245 /* Field names for block device messages. */
1246 #define BDEV_MINOR m10_i1 /* minor device number */
1247 #define BDEV_STATUS m10_i1 /* OK or error code */
1248 #define BDEV_ACCESS m10_i2 /* access bits for open requests */
1249 #define BDEV_COUNT m10_i2 /* number of bytes or elements in transfer */
1250 #define BDEV_GRANT m10_i3 /* grant ID of buffer or vector */
1251 #define BDEV_FLAGS m10_i4 /* transfer flags */
1252 #define BDEV_USER m10_i4 /* user endpoint requesting I/O control */
1253 #define BDEV_ID m10_l1 /* opaque request ID */
1254 #define BDEV_REQUEST m10_l2 /* I/O control request */
1255 #define BDEV_POS_LO m10_l2 /* transfer position (low bits) */
1256 #define BDEV_POS_HI m10_l3 /* transfer position (high bits) */
1258 /* Bits in 'BDEV_ACCESS' field of block device open requests. */
1259 # define BDEV_R_BIT 0x01 /* open with read access */
1260 # define BDEV_W_BIT 0x02 /* open with write access */
1262 /* Bits in 'BDEV_FLAGS' field of block device transfer requests. */
1263 # define BDEV_NOFLAGS 0x00 /* no flags are set */
1264 # define BDEV_FORCEWRITE 0x01 /* force write to disk immediately */
1265 # define BDEV_NOPAGE 0x02 /* eeprom: don't send page address */
1267 /*===========================================================================*
1268 * Messages for Real Time Clocks *
1269 *===========================================================================*/
1271 /* Base type for real time clock requests and responses. */
1272 #define RTCDEV_RQ_BASE 0x1400
1273 #define RTCDEV_RS_BASE 0x1480
1275 #define IS_RTCDEV_RQ(type) (((type) & ~0x7f) == RTCDEV_RQ_BASE)
1276 #define IS_RTCDEV_RS(type) (((type) & ~0x7f) == RTCDEV_RS_BASE)
1278 /* Message types for real time clock requests. */
1279 #define RTCDEV_GET_TIME (RTCDEV_RQ_BASE + 0) /* get time from hw clock */
1280 #define RTCDEV_SET_TIME (RTCDEV_RQ_BASE + 1) /* set time in hw clock */
1281 #define RTCDEV_PWR_OFF (RTCDEV_RQ_BASE + 2) /* set time to cut the power */
1283 /* Same as GET/SET above but using grants */
1284 #define RTCDEV_GET_TIME_G (RTCDEV_RQ_BASE + 3) /* get time from hw clock */
1285 #define RTCDEV_SET_TIME_G (RTCDEV_RQ_BASE + 4) /* set time in hw clock */
1287 /* Message types for real time clock responses. */
1288 #define RTCDEV_REPLY (RTCDEV_RS_BASE + 0) /* general reply code */
1290 /* Field names for real time clock messages */
1291 #define RTCDEV_TM m2_p1 /* pointer to struct tm */
1292 #define RTCDEV_FLAGS m2_s1 /* clock flags flags */
1293 #define RTCDEV_STATUS m2_i2 /* OK or error code */
1294 #define RTCDEV_GRANT m2_i3 /* grant containing struct tm */
1296 /* Bits in 'RTCDEV_FLAGS' field of real time clock requests. */
1297 #define RTCDEV_NOFLAGS 0x00 /* no flags are set */
1298 #define RTCDEV_Y2KBUG 0x01 /* Interpret 1980 as 2000 for RTC w/Y2K bug */
1299 #define RTCDEV_CMOSREG 0x02 /* Also set the CMOS clock register bits. */
1301 /*===========================================================================*
1302 * Field names shared across several call codes *
1303 *===========================================================================*/
1305 /* Field names for the getsysinfo(2) call. */
1306 #define SI_WHAT m1_i1 /* int */
1307 #define SI_WHERE m1_p1 /* void */
1308 #define SI_SIZE m1_i2 /* size_t */
1310 /* Field names for the svrctl(2) call. */
1311 #define SVRCTL_REQ m2_i1 /* int */
1312 #define SVRCTL_ARG m2_p1 /* void * */
1314 /* Field names for the getrusage(2) call. */
1315 #define RU_ENDPT m1_i1 /* endpoint_t */
1316 #define RU_WHO m1_i1 /* int */
1317 #define RU_RUSAGE_ADDR m1_p1 /* struct rusage * */
1319 /*===========================================================================*
1320 * Internal codes used by several services *
1321 *===========================================================================*/
1323 #define SUSPEND -998 /* status to suspend caller, reply later */
1325 #endif /* !_MINIX_COM_H */