minix/include/minix/syslib.h

273 lines
12 KiB
C
Raw Normal View History

/* Prototypes for system library functions. */
2005-04-21 16:53:53 +02:00
#ifndef _SYSLIB_H
#define _SYSLIB_H
#ifndef _TYPES_H
#include <minix/types.h>
2005-04-21 16:53:53 +02:00
#endif
#ifndef _IPC_H
#include <minix/ipc.h>
#endif
#include <minix/u64.h>
2005-04-21 16:53:53 +02:00
#ifndef _DEVIO_H
#include <minix/devio.h>
#endif
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
#include <minix/safecopies.h>
Basic System Event Framework (SEF) with ping and live update. SYSLIB CHANGES: - SEF must be used by every system process and is thereby part of the system library. - The framework provides a receive() interface (sef_receive) for system processes to automatically catch known system even messages and process them. - SEF provides a default behavior for each type of system event, but allows system processes to register callbacks to override the default behavior. - Custom (local to the process) or predefined (provided by SEF) callback implementations can be registered to SEF. - SEF currently includes support for 2 types of system events: 1. SEF Ping. The event occurs every time RS sends a ping to figure out whether a system process is still alive. The default callback implementation provided by SEF is to notify RS back to let it know the process is alive and kicking. 2. SEF Live update. The event occurs every time RS sends a prepare to update message to let a system process know an update is available and to prepare for it. The live update support is very basic for now. SEF only deals with verifying if the prepare state can be supported by the process, dumping the state for debugging purposes, and providing an event-driven programming model to the process to react to state changes check-in when ready to update. - SEF should be extended in the future to integrate support for more types of system events. Ideally, all the cross-cutting concerns should be integrated into SEF to avoid duplicating code and ease extensibility. Examples include: * PM notify messages primarily used at shutdown. * SYSTEM notify messages primarily used for signals. * CLOCK notify messages used for system alarms. * Debug messages. IS could still be in charge of fkey handling but would forward the debug message to the target process (e.g. PM, if the user requested debug information about PM). SEF would then catch the message and do nothing unless the process has registered an appropriate callback to deal with the event. This simplifies the programming model to print debug information, avoids duplicating code, and reduces the effort to print debug information. SYSTEM PROCESSES CHANGES: - Every system process registers SEF callbacks it needs to override the default system behavior and calls sef_startup() right after being started. - sef_startup() does almost nothing now, but will be extended in the future to support callbacks of its own to let RS control and synchronize with every system process at initialization time. - Every system process calls sef_receive() now rather than receive() directly, to let SEF handle predefined system events. RS CHANGES: - RS supports a basic single-component live update protocol now, as follows: * When an update command is issued (via "service update *"), RS notifies the target system process to prepare for a specific update state. * If the process doesn't respond back in time, the update is aborted. * When the process responds back, RS kills it and marks it for refreshing. * The process is then automatically restarted as for a buggy process and can start running again. * Live update is currently prototyped as a controlled failure.
2009-12-21 15:12:21 +01:00
#include <minix/sef.h>
#include <machine/mcontext.h>
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
2005-07-29 12:21:04 +02:00
/* Forward declaration */
struct reg86u;
struct rs_pci;
2005-07-29 12:21:04 +02:00
#define SYSTASK SYSTEM
2005-04-21 16:53:53 +02:00
/*==========================================================================*
* Minix system library. *
*==========================================================================*/
_PROTOTYPE( int _taskcall, (endpoint_t who, int syscallnr, message *msgptr));
_PROTOTYPE( int _kernel_call, (int syscallnr, message *msgptr));
2005-04-21 16:53:53 +02:00
2005-07-29 17:02:27 +02:00
_PROTOTYPE( int sys_abort, (int how, ...));
_PROTOTYPE( int sys_enable_iop, (endpoint_t proc_ep));
_PROTOTYPE( int sys_exec, (endpoint_t proc_ep, char *ptr,
2005-07-29 17:02:27 +02:00
char *aout, vir_bytes initpc));
_PROTOTYPE( int sys_fork, (endpoint_t parent, endpoint_t child, endpoint_t *,
struct mem_map *ptr, u32_t vm, vir_bytes *));
_PROTOTYPE( int sys_newmap, (endpoint_t proc_ep, struct mem_map *ptr));
New RS and new signal handling for system processes. UPDATING INFO: 20100317: /usr/src/etc/system.conf updated to ignore default kernel calls: copy it (or merge it) to /etc/system.conf. The hello driver (/dev/hello) added to the distribution: # cd /usr/src/commands/scripts && make clean install # cd /dev && MAKEDEV hello KERNEL CHANGES: - Generic signal handling support. The kernel no longer assumes PM as a signal manager for every process. The signal manager of a given process can now be specified in its privilege slot. When a signal has to be delivered, the kernel performs the lookup and forwards the signal to the appropriate signal manager. PM is the default signal manager for user processes, RS is the default signal manager for system processes. To enable ptrace()ing for system processes, it is sufficient to change the default signal manager to PM. This will temporarily disable crash recovery, though. - sys_exit() is now split into sys_exit() (i.e. exit() for system processes, which generates a self-termination signal), and sys_clear() (i.e. used by PM to ask the kernel to clear a process slot when a process exits). - Added a new kernel call (i.e. sys_update()) to swap two process slots and implement live update. PM CHANGES: - Posix signal handling is no longer allowed for system processes. System signals are split into two fixed categories: termination and non-termination signals. When a non-termination signaled is processed, PM transforms the signal into an IPC message and delivers the message to the system process. When a termination signal is processed, PM terminates the process. - PM no longer assumes itself as the signal manager for system processes. It now makes sure that every system signal goes through the kernel before being actually processes. The kernel will then dispatch the signal to the appropriate signal manager which may or may not be PM. SYSLIB CHANGES: - Simplified SEF init and LU callbacks. - Added additional predefined SEF callbacks to debug crash recovery and live update. - Fixed a temporary ack in the SEF init protocol. SEF init reply is now completely synchronous. - Added SEF signal event type to provide a uniform interface for system processes to deal with signals. A sef_cb_signal_handler() callback is available for system processes to handle every received signal. A sef_cb_signal_manager() callback is used by signal managers to process system signals on behalf of the kernel. - Fixed a few bugs with memory mapping and DS. VM CHANGES: - Page faults and memory requests coming from the kernel are now implemented using signals. - Added a new VM call to swap two process slots and implement live update. - The call is used by RS at update time and in turn invokes the kernel call sys_update(). RS CHANGES: - RS has been reworked with a better functional decomposition. - Better kernel call masks. com.h now defines the set of very basic kernel calls every system service is allowed to use. This makes system.conf simpler and easier to maintain. In addition, this guarantees a higher level of isolation for system libraries that use one or more kernel calls internally (e.g. printf). - RS is the default signal manager for system processes. By default, RS intercepts every signal delivered to every system process. This makes crash recovery possible before bringing PM and friends in the loop. - RS now supports fast rollback when something goes wrong while initializing the new version during a live update. - Live update is now implemented by keeping the two versions side-by-side and swapping the process slots when the old version is ready to update. - Crash recovery is now implemented by keeping the two versions side-by-side and cleaning up the old version only when the recovery process is complete. DS CHANGES: - Fixed a bug when the process doing ds_publish() or ds_delete() is not known by DS. - Fixed the completely broken support for strings. String publishing is now implemented in the system library and simply wraps publishing of memory ranges. Ideally, we should adopt a similar approach for other data types as well. - Test suite fixed. DRIVER CHANGES: - The hello driver has been added to the Minix distribution to demonstrate basic live update and crash recovery functionalities. - Other drivers have been adapted to conform the new SEF interface.
2010-03-17 02:15:29 +01:00
_PROTOTYPE( int sys_clear, (endpoint_t proc_ep));
_PROTOTYPE( int sys_exit, (void));
_PROTOTYPE( int sys_trace, (int req, endpoint_t proc_ep, long addr, long *data_p));
_PROTOTYPE( int sys_schedule, (endpoint_t proc_ep, int priority,
int quantum, int cpu));
_PROTOTYPE( int sys_schedctl, (unsigned flags, endpoint_t proc_ep,
int priority, int quantum, int cpu));
Userspace scheduling - cotributed by Bjorn Swift - In this first phase, scheduling is moved from the kernel to the PM server. The next steps are to a) moving scheduling to its own server and b) include useful information in the "out of quantum" message, so that the scheduler can make use of this information. - The kernel process table now keeps record of who is responsible for scheduling each process (p_scheduler). When this pointer is NULL, the process will be scheduled by the kernel. If such a process runs out of quantum, the kernel will simply renew its quantum an requeue it. - When PM loads, it will take over scheduling of all running processes, except system processes, using sys_schedctl(). Essentially, this only results in taking over init. As children inherit a scheduler from their parent, user space programs forked by init will inherit PM (for now) as their scheduler. - Once a process has been assigned a scheduler, and runs out of quantum, its RTS_NO_QUANTUM flag will be set and the process dequeued. The kernel will send a message to the scheduler, on the process' behalf, informing the scheduler that it has run out of quantum. The scheduler can take what ever action it pleases, based on its policy, and then reschedule the process using the sys_schedule() system call. - Balance queues does not work as before. While the old in-kernel function used to renew the quantum of processes in the highest priority run queue, the user-space implementation only acts on processes that have been bumped down to a lower priority queue. This approach reacts slower to changes than the old one, but saves us sending a sys_schedule message for each process every time we balance the queues. Currently, when processes are moved up a priority queue, their quantum is also renewed, but this can be fiddled with. - do_nice has been removed from kernel. PM answers to get- and setpriority calls, updates it's own nice variable as well as the max_run_queue. This will be refactored once scheduling is moved to a separate server. We will probably have PM update it's local nice value and then send a message to whoever is scheduling the process. - changes to fix an issue in do_fork() where processes could run out of quantum but bypassing the code path that handles it correctly. The future plan is to remove the policy from do_fork() and implement it in userspace too.
2010-03-29 13:07:20 +02:00
Merge of David's ptrace branch. Summary: o Support for ptrace T_ATTACH/T_DETACH and T_SYSCALL o PM signal handling logic should now work properly, even with debuggers being present o Asynchronous PM/VFS protocol, full IPC support for senda(), and AMF_NOREPLY senda() flag DETAILS Process stop and delay call handling of PM: o Added sys_runctl() kernel call with sys_stop() and sys_resume() aliases, for PM to stop and resume a process o Added exception for sending/syscall-traced processes to sys_runctl(), and matching SIGKREADY pseudo-signal to PM o Fixed PM signal logic to deal with requests from a process after stopping it (so-called "delay calls"), using the SIGKREADY facility o Fixed various PM panics due to race conditions with delay calls versus VFS calls o Removed special PRIO_STOP priority value o Added SYS_LOCK RTS kernel flag, to stop an individual process from running while modifying its process structure Signal and debugger handling in PM: o Fixed debugger signals being dropped if a second signal arrives when the debugger has not retrieved the first one o Fixed debugger signals being sent to the debugger more than once o Fixed debugger signals unpausing process in VFS; removed PM_UNPAUSE_TR protocol message o Detached debugger signals from general signal logic and from being blocked on VFS calls, meaning that even VFS can now be traced o Fixed debugger being unable to receive more than one pending signal in one process stop o Fixed signal delivery being delayed needlessly when multiple signals are pending o Fixed wait test for tracer, which was returning for children that were not waited for o Removed second parallel pending call from PM to VFS for any process o Fixed process becoming runnable between exec() and debugger trap o Added support for notifying the debugger before the parent when a debugged child exits o Fixed debugger death causing child to remain stopped forever o Fixed consistently incorrect use of _NSIG Extensions to ptrace(): o Added T_ATTACH and T_DETACH ptrace request, to attach and detach a debugger to and from a process o Added T_SYSCALL ptrace request, to trace system calls o Added T_SETOPT ptrace request, to set trace options o Added TO_TRACEFORK trace option, to attach automatically to children of a traced process o Added TO_ALTEXEC trace option, to send SIGSTOP instead of SIGTRAP upon a successful exec() of the tracee o Extended T_GETUSER ptrace support to allow retrieving a process's priv structure o Removed T_STOP ptrace request again, as it does not help implementing debuggers properly o Added MINIX3-specific ptrace test (test42) o Added proper manual page for ptrace(2) Asynchronous PM/VFS interface: o Fixed asynchronous messages not being checked when receive() is called with an endpoint other than ANY o Added AMF_NOREPLY senda() flag, preventing such messages from satisfying the receive part of a sendrec() o Added asynsend3() that takes optional flags; asynsend() is now a #define passing in 0 as third parameter o Made PM/VFS protocol asynchronous; reintroduced tell_fs() o Made PM_BASE request/reply number range unique o Hacked in a horrible temporary workaround into RS to deal with newly revealed RS-PM-VFS race condition triangle until VFS is asynchronous System signal handling: o Fixed shutdown logic of device drivers; removed old SIGKSTOP signal o Removed is-superuser check from PM's do_procstat() (aka getsigset()) o Added sigset macros to allow system processes to deal with the full signal set, rather than just the POSIX subset Miscellaneous PM fixes: o Split do_getset into do_get and do_set, merging common code and making structure clearer o Fixed setpriority() being able to put to sleep processes using an invalid parameter, or revive zombie processes o Made find_proc() global; removed obsolete proc_from_pid() o Cleanup here and there Also included: o Fixed false-positive boot order kernel warning o Removed last traces of old NOTIFY_FROM code THINGS OF POSSIBLE INTEREST o It should now be possible to run PM at any priority, even lower than user processes o No assumptions are made about communication speed between PM and VFS, although communication must be FIFO o A debugger will now receive incoming debuggee signals at kill time only; the process may not yet be fully stopped o A first step has been made towards making the SYSTEM task preemptible
2009-09-30 11:57:22 +02:00
/* Shorthands for sys_runctl() system call. */
#define sys_stop(proc_ep) sys_runctl(proc_ep, RC_STOP, 0)
#define sys_delay_stop(proc_ep) sys_runctl(proc_ep, RC_STOP, RC_DELAY)
#define sys_resume(proc_ep) sys_runctl(proc_ep, RC_RESUME, 0)
_PROTOTYPE( int sys_runctl, (endpoint_t proc_ep, int action, int flags));
Merge of David's ptrace branch. Summary: o Support for ptrace T_ATTACH/T_DETACH and T_SYSCALL o PM signal handling logic should now work properly, even with debuggers being present o Asynchronous PM/VFS protocol, full IPC support for senda(), and AMF_NOREPLY senda() flag DETAILS Process stop and delay call handling of PM: o Added sys_runctl() kernel call with sys_stop() and sys_resume() aliases, for PM to stop and resume a process o Added exception for sending/syscall-traced processes to sys_runctl(), and matching SIGKREADY pseudo-signal to PM o Fixed PM signal logic to deal with requests from a process after stopping it (so-called "delay calls"), using the SIGKREADY facility o Fixed various PM panics due to race conditions with delay calls versus VFS calls o Removed special PRIO_STOP priority value o Added SYS_LOCK RTS kernel flag, to stop an individual process from running while modifying its process structure Signal and debugger handling in PM: o Fixed debugger signals being dropped if a second signal arrives when the debugger has not retrieved the first one o Fixed debugger signals being sent to the debugger more than once o Fixed debugger signals unpausing process in VFS; removed PM_UNPAUSE_TR protocol message o Detached debugger signals from general signal logic and from being blocked on VFS calls, meaning that even VFS can now be traced o Fixed debugger being unable to receive more than one pending signal in one process stop o Fixed signal delivery being delayed needlessly when multiple signals are pending o Fixed wait test for tracer, which was returning for children that were not waited for o Removed second parallel pending call from PM to VFS for any process o Fixed process becoming runnable between exec() and debugger trap o Added support for notifying the debugger before the parent when a debugged child exits o Fixed debugger death causing child to remain stopped forever o Fixed consistently incorrect use of _NSIG Extensions to ptrace(): o Added T_ATTACH and T_DETACH ptrace request, to attach and detach a debugger to and from a process o Added T_SYSCALL ptrace request, to trace system calls o Added T_SETOPT ptrace request, to set trace options o Added TO_TRACEFORK trace option, to attach automatically to children of a traced process o Added TO_ALTEXEC trace option, to send SIGSTOP instead of SIGTRAP upon a successful exec() of the tracee o Extended T_GETUSER ptrace support to allow retrieving a process's priv structure o Removed T_STOP ptrace request again, as it does not help implementing debuggers properly o Added MINIX3-specific ptrace test (test42) o Added proper manual page for ptrace(2) Asynchronous PM/VFS interface: o Fixed asynchronous messages not being checked when receive() is called with an endpoint other than ANY o Added AMF_NOREPLY senda() flag, preventing such messages from satisfying the receive part of a sendrec() o Added asynsend3() that takes optional flags; asynsend() is now a #define passing in 0 as third parameter o Made PM/VFS protocol asynchronous; reintroduced tell_fs() o Made PM_BASE request/reply number range unique o Hacked in a horrible temporary workaround into RS to deal with newly revealed RS-PM-VFS race condition triangle until VFS is asynchronous System signal handling: o Fixed shutdown logic of device drivers; removed old SIGKSTOP signal o Removed is-superuser check from PM's do_procstat() (aka getsigset()) o Added sigset macros to allow system processes to deal with the full signal set, rather than just the POSIX subset Miscellaneous PM fixes: o Split do_getset into do_get and do_set, merging common code and making structure clearer o Fixed setpriority() being able to put to sleep processes using an invalid parameter, or revive zombie processes o Made find_proc() global; removed obsolete proc_from_pid() o Cleanup here and there Also included: o Fixed false-positive boot order kernel warning o Removed last traces of old NOTIFY_FROM code THINGS OF POSSIBLE INTEREST o It should now be possible to run PM at any priority, even lower than user processes o No assumptions are made about communication speed between PM and VFS, although communication must be FIFO o A debugger will now receive incoming debuggee signals at kill time only; the process may not yet be fully stopped o A first step has been made towards making the SYSTEM task preemptible
2009-09-30 11:57:22 +02:00
New RS and new signal handling for system processes. UPDATING INFO: 20100317: /usr/src/etc/system.conf updated to ignore default kernel calls: copy it (or merge it) to /etc/system.conf. The hello driver (/dev/hello) added to the distribution: # cd /usr/src/commands/scripts && make clean install # cd /dev && MAKEDEV hello KERNEL CHANGES: - Generic signal handling support. The kernel no longer assumes PM as a signal manager for every process. The signal manager of a given process can now be specified in its privilege slot. When a signal has to be delivered, the kernel performs the lookup and forwards the signal to the appropriate signal manager. PM is the default signal manager for user processes, RS is the default signal manager for system processes. To enable ptrace()ing for system processes, it is sufficient to change the default signal manager to PM. This will temporarily disable crash recovery, though. - sys_exit() is now split into sys_exit() (i.e. exit() for system processes, which generates a self-termination signal), and sys_clear() (i.e. used by PM to ask the kernel to clear a process slot when a process exits). - Added a new kernel call (i.e. sys_update()) to swap two process slots and implement live update. PM CHANGES: - Posix signal handling is no longer allowed for system processes. System signals are split into two fixed categories: termination and non-termination signals. When a non-termination signaled is processed, PM transforms the signal into an IPC message and delivers the message to the system process. When a termination signal is processed, PM terminates the process. - PM no longer assumes itself as the signal manager for system processes. It now makes sure that every system signal goes through the kernel before being actually processes. The kernel will then dispatch the signal to the appropriate signal manager which may or may not be PM. SYSLIB CHANGES: - Simplified SEF init and LU callbacks. - Added additional predefined SEF callbacks to debug crash recovery and live update. - Fixed a temporary ack in the SEF init protocol. SEF init reply is now completely synchronous. - Added SEF signal event type to provide a uniform interface for system processes to deal with signals. A sef_cb_signal_handler() callback is available for system processes to handle every received signal. A sef_cb_signal_manager() callback is used by signal managers to process system signals on behalf of the kernel. - Fixed a few bugs with memory mapping and DS. VM CHANGES: - Page faults and memory requests coming from the kernel are now implemented using signals. - Added a new VM call to swap two process slots and implement live update. - The call is used by RS at update time and in turn invokes the kernel call sys_update(). RS CHANGES: - RS has been reworked with a better functional decomposition. - Better kernel call masks. com.h now defines the set of very basic kernel calls every system service is allowed to use. This makes system.conf simpler and easier to maintain. In addition, this guarantees a higher level of isolation for system libraries that use one or more kernel calls internally (e.g. printf). - RS is the default signal manager for system processes. By default, RS intercepts every signal delivered to every system process. This makes crash recovery possible before bringing PM and friends in the loop. - RS now supports fast rollback when something goes wrong while initializing the new version during a live update. - Live update is now implemented by keeping the two versions side-by-side and swapping the process slots when the old version is ready to update. - Crash recovery is now implemented by keeping the two versions side-by-side and cleaning up the old version only when the recovery process is complete. DS CHANGES: - Fixed a bug when the process doing ds_publish() or ds_delete() is not known by DS. - Fixed the completely broken support for strings. String publishing is now implemented in the system library and simply wraps publishing of memory ranges. Ideally, we should adopt a similar approach for other data types as well. - Test suite fixed. DRIVER CHANGES: - The hello driver has been added to the Minix distribution to demonstrate basic live update and crash recovery functionalities. - Other drivers have been adapted to conform the new SEF interface.
2010-03-17 02:15:29 +01:00
_PROTOTYPE( int sys_update, (endpoint_t src_ep, endpoint_t dst_ep));
Driver refactory for live update and crash recovery. SYSLIB CHANGES: - DS calls to publish / retrieve labels consider endpoints instead of u32_t. VFS CHANGES: - mapdriver() only adds an entry in the dmap table in VFS. - dev_up() is only executed upon reception of a driver up event. INET CHANGES: - INET no longer searches for existing drivers instances at startup. - A newtwork driver is (re)initialized upon reception of a driver up event. - Networking startup is now race-free by design. No need to waste 5 seconds at startup any more. DRIVER CHANGES: - Every driver publishes driver up events when starting for the first time or in case of restart when recovery actions must be taken in the upper layers. - Driver up events are published by drivers through DS. - For regular drivers, VFS is normally the only subscriber, but not necessarily. For instance, when the filter driver is in use, it must subscribe to driver up events to initiate recovery. - For network drivers, inet is the only subscriber for now. - Every VFS driver is statically linked with libdriver, every network driver is statically linked with libnetdriver. DRIVER LIBRARIES CHANGES: - Libdriver is extended to provide generic receive() and ds_publish() interfaces for VFS drivers. - driver_receive() is a wrapper for sef_receive() also used in driver_task() to discard spurious messages that were meant to be delivered to a previous version of the driver. - driver_receive_mq() is the same as driver_receive() but integrates support for queued messages. - driver_announce() publishes a driver up event for VFS drivers and marks the driver as initialized and expecting a DEV_OPEN message. - Libnetdriver is introduced to provide similar receive() and ds_publish() interfaces for network drivers (netdriver_announce() and netdriver_receive()). - Network drivers all support live update with no state transfer now. KERNEL CHANGES: - Added kernel call statectl for state management. Used by driver_announce() to unblock eventual callers sendrecing to the driver.
2010-04-08 15:41:35 +02:00
_PROTOTYPE( int sys_statectl, (int request));
_PROTOTYPE( int sys_privctl, (endpoint_t proc_ep, int req, void *p));
_PROTOTYPE( int sys_privquery_mem, (endpoint_t proc_ep,
phys_bytes physstart, phys_bytes physlen));
2006-06-23 17:35:05 +02:00
_PROTOTYPE( int sys_setgrant, (cp_grant_t *grants, int ngrants));
2005-04-21 16:53:53 +02:00
2005-07-29 17:02:27 +02:00
_PROTOTYPE( int sys_int86, (struct reg86u *reg86p));
_PROTOTYPE( int sys_vm_setbuf, (phys_bytes base, phys_bytes size,
phys_bytes high));
_PROTOTYPE( int sys_vm_map, (endpoint_t proc_ep, int do_map,
phys_bytes base, phys_bytes size, phys_bytes offset));
_PROTOTYPE( int sys_vmctl, (endpoint_t who, int param, u32_t value));
_PROTOTYPE( int sys_vmctl_get_cr3_i386, (endpoint_t who, u32_t *cr3) );
_PROTOTYPE( int sys_vmctl_get_memreq, (endpoint_t *who, vir_bytes *mem,
vir_bytes *len, int *wrflag, endpoint_t *who_s, vir_bytes *mem_s,
endpoint_t *) );
_PROTOTYPE( int sys_vmctl_enable_paging, (void * data));
2005-04-21 16:53:53 +02:00
_PROTOTYPE( int sys_readbios, (phys_bytes address, void *buf, size_t size));
_PROTOTYPE( int sys_stime, (time_t boottime));
_PROTOTYPE( int sys_sysctl, (int ctl, char *arg1, int arg2));
_PROTOTYPE( int sys_sysctl_stacktrace, (endpoint_t who));
_PROTOTYPE( int sys_vmctl_get_mapping, (int index, phys_bytes *addr,
phys_bytes *len, int *flags));
_PROTOTYPE( int sys_vmctl_reply_mapping, (int index, vir_bytes addr));
_PROTOTYPE( int sys_vmctl_set_addrspace, (endpoint_t who,
phys_bytes ptroot, void *ptroot_v));
2005-04-21 16:53:53 +02:00
/* Shorthands for sys_sdevio() system call. */
#define sys_insb(port, proc_ep, buffer, count) \
sys_sdevio(DIO_INPUT_BYTE, port, proc_ep, buffer, count, 0)
#define sys_insw(port, proc_ep, buffer, count) \
sys_sdevio(DIO_INPUT_WORD, port, proc_ep, buffer, count, 0)
#define sys_outsb(port, proc_ep, buffer, count) \
sys_sdevio(DIO_OUTPUT_BYTE, port, proc_ep, buffer, count, 0)
#define sys_outsw(port, proc_ep, buffer, count) \
sys_sdevio(DIO_OUTPUT_WORD, port, proc_ep, buffer, count, 0)
#define sys_safe_insb(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_INPUT_BYTE, port, ept, (void*)grant, count, offset)
#define sys_safe_outsb(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_OUTPUT_BYTE, port, ept, (void*)grant, count, offset)
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
#define sys_safe_insw(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_INPUT_WORD, port, ept, (void*)grant, count, offset)
#define sys_safe_outsw(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_OUTPUT_WORD, port, ept, (void*)grant, count, offset)
_PROTOTYPE( int sys_sdevio, (int req, long port, endpoint_t proc_ep,
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
void *buffer, int count, vir_bytes offset));
_PROTOTYPE(void *alloc_contig, (size_t len, int flags, phys_bytes *phys));
_PROTOTYPE(int free_contig, (void *addr, size_t len));
#define AC_ALIGN4K 0x01
#define AC_LOWER16M 0x02
#define AC_ALIGN64K 0x04
#define AC_LOWER1M 0x08
2005-04-21 16:53:53 +02:00
/* Clock functionality: get system times, (un)schedule an alarm call, or
* retrieve/set a process-virtual timer.
*/
_PROTOTYPE( int sys_times, (endpoint_t proc_ep, clock_t *user_time,
Rewrite of boot process KERNEL CHANGES: - The kernel only knows about privileges of kernel tasks and the root system process (now RS). - Kernel tasks and the root system process are the only processes that are made schedulable by the kernel at startup. All the other processes in the boot image don't get their privileges set at startup and are inhibited from running by the RTS_NO_PRIV flag. - Removed the assumption on the ordering of processes in the boot image table. System processes can now appear in any order in the boot image table. - Privilege ids can now be assigned both statically or dynamically. The kernel assigns static privilege ids to kernel tasks and the root system process. Each id is directly derived from the process number. - User processes now all share the static privilege id of the root user process (now INIT). - sys_privctl split: we have more calls now to let RS set privileges for system processes. SYS_PRIV_ALLOW / SYS_PRIV_DISALLOW are only used to flip the RTS_NO_PRIV flag and allow / disallow a process from running. SYS_PRIV_SET_SYS / SYS_PRIV_SET_USER are used to set privileges for a system / user process. - boot image table flags split: PROC_FULLVM is the only flag that has been moved out of the privilege flags and is still maintained in the boot image table. All the other privilege flags are out of the kernel now. RS CHANGES: - RS is the only user-space process who gets to run right after in-kernel startup. - RS uses the boot image table from the kernel and three additional boot image info table (priv table, sys table, dev table) to complete the initialization of the system. - RS checks that the entries in the priv table match the entries in the boot image table to make sure that every process in the boot image gets schedulable. - RS only uses static privilege ids to set privileges for system services in the boot image. - RS includes basic memory management support to allocate the boot image buffer dynamically during initialization. The buffer shall contain the executable image of all the system services we would like to restart after a crash. - First step towards decoupling between resource provisioning and resource requirements in RS: RS must know what resources it needs to restart a process and what resources it has currently available. This is useful to tradeoff reliability and resource consumption. When required resources are missing, the process cannot be restarted. In that case, in the future, a system flag will tell RS what to do. For example, if CORE_PROC is set, RS should trigger a system-wide panic because the system can no longer function correctly without a core system process. PM CHANGES: - The process tree built at initialization time is changed to have INIT as root with pid 0, RS child of INIT and all the system services children of RS. This is required to make RS in control of all the system services. - PM no longer registers labels for system services in the boot image. This is now part of RS's initialization process.
2009-12-11 01:08:19 +01:00
clock_t *sys_time, clock_t *uptime, time_t *boottime));
2005-07-29 17:02:27 +02:00
_PROTOTYPE(int sys_setalarm, (clock_t exp_time, int abs_time));
_PROTOTYPE( int sys_vtimer, (endpoint_t proc_nr, int which, clock_t *newval,
clock_t *oldval));
2005-04-21 16:53:53 +02:00
/* Shorthands for sys_irqctl() system call. */
2005-05-02 16:30:04 +02:00
#define sys_irqdisable(hook_id) \
sys_irqctl(IRQ_DISABLE, 0, 0, hook_id)
#define sys_irqenable(hook_id) \
sys_irqctl(IRQ_ENABLE, 0, 0, hook_id)
#define sys_irqsetpolicy(irq_vec, policy, hook_id) \
sys_irqctl(IRQ_SETPOLICY, irq_vec, policy, hook_id)
#define sys_irqrmpolicy(hook_id) \
sys_irqctl(IRQ_RMPOLICY, 0, 0, hook_id)
2005-04-21 16:53:53 +02:00
_PROTOTYPE ( int sys_irqctl, (int request, int irq_vec, int policy,
2005-05-02 16:30:04 +02:00
int *irq_hook_id) );
2005-04-21 16:53:53 +02:00
2005-04-29 17:36:43 +02:00
/* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
2005-04-21 16:53:53 +02:00
#define sys_biosin(bios_vir, dst_vir, bytes) \
sys_vircopy(SELF, BIOS_SEG, bios_vir, SELF, D, dst_vir, bytes)
#define sys_biosout(src_vir, bios_vir, bytes) \
sys_vircopy(SELF, D, src_vir, SELF, BIOS_SEG, bios_vir, bytes)
#define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
#define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, T, src_vir, dst_proc, T, dst_vir, bytes)
#define sys_stackcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, S, src_vir, dst_proc, S, dst_vir, bytes)
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
_PROTOTYPE(int sys_vircopy, (endpoint_t src_proc, int src_s, vir_bytes src_v,
endpoint_t dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
2005-04-21 16:53:53 +02:00
2005-04-29 17:36:43 +02:00
#define sys_abscopy(src_phys, dst_phys, bytes) \
sys_physcopy(NONE, PHYS_SEG, src_phys, NONE, PHYS_SEG, dst_phys, bytes)
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
_PROTOTYPE(int sys_physcopy, (endpoint_t src_proc, int src_seg, vir_bytes src_vir,
endpoint_t dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
/* Grant-based copy functions. */
_PROTOTYPE(int sys_safecopyfrom, (endpoint_t source, cp_grant_id_t grant,
vir_bytes grant_offset, vir_bytes my_address, size_t bytes, int my_seg));
_PROTOTYPE(int sys_safecopyto, (endpoint_t dest, cp_grant_id_t grant,
vir_bytes grant_offset, vir_bytes my_address, size_t bytes, int my_seg));
_PROTOTYPE(int sys_vsafecopy, (struct vscp_vec *copyvec, int elements));
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
2005-07-29 17:02:27 +02:00
_PROTOTYPE(int sys_memset, (unsigned long pattern,
phys_bytes base, phys_bytes bytes));
/* Grant-based map functions. */
_PROTOTYPE(int sys_safemap, (endpoint_t grantor, cp_grant_id_t grant,
vir_bytes grant_offset, vir_bytes my_address, size_t bytes, int my_seg,
int writable));
_PROTOTYPE(int sys_saferevmap_gid, (cp_grant_id_t grant));
_PROTOTYPE(int sys_saferevmap_addr, (vir_bytes addr));
_PROTOTYPE(int sys_safeunmap, (int my_seg, vir_bytes my_address));
_PROTOTYPE(int sys_umap, (endpoint_t proc_ep, int seg, vir_bytes vir_addr,
2005-07-29 17:02:27 +02:00
vir_bytes bytes, phys_bytes *phys_addr));
_PROTOTYPE(int sys_umap_data_fb, (endpoint_t proc_ep, vir_bytes vir_addr,
vir_bytes bytes, phys_bytes *phys_addr));
2005-04-29 17:36:43 +02:00
_PROTOTYPE(int sys_segctl, (int *index, u16_t *seg, vir_bytes *off,
phys_bytes phys, vir_bytes size));
2005-04-21 16:53:53 +02:00
/* Shorthands for sys_getinfo() system call. */
#define sys_getkmessages(dst) sys_getinfo(GET_KMESSAGES, dst, 0,0,0)
2005-04-29 17:36:43 +02:00
#define sys_getkinfo(dst) sys_getinfo(GET_KINFO, dst, 0,0,0)
2005-11-14 16:58:07 +01:00
#define sys_getloadinfo(dst) sys_getinfo(GET_LOADINFO, dst, 0,0,0)
2005-04-29 17:36:43 +02:00
#define sys_getmachine(dst) sys_getinfo(GET_MACHINE, dst, 0,0,0)
2010-10-26 23:07:50 +02:00
#define sys_getcpuinfo(dst) sys_getinfo(GET_CPUINFO, dst, 0,0,0)
2005-04-21 16:53:53 +02:00
#define sys_getproctab(dst) sys_getinfo(GET_PROCTAB, dst, 0,0,0)
#define sys_getprivtab(dst) sys_getinfo(GET_PRIVTAB, dst, 0,0,0)
2005-04-21 16:53:53 +02:00
#define sys_getproc(dst,nr) sys_getinfo(GET_PROC, dst, 0,0, nr)
#define sys_getrandomness(dst) sys_getinfo(GET_RANDOMNESS, dst, 0,0,0)
#define sys_getrandom_bin(d,b) sys_getinfo(GET_RANDOMNESS_BIN, d, 0,0,b)
2005-04-21 16:53:53 +02:00
#define sys_getimage(dst) sys_getinfo(GET_IMAGE, dst, 0,0,0)
2005-05-02 16:30:04 +02:00
#define sys_getirqhooks(dst) sys_getinfo(GET_IRQHOOKS, dst, 0,0,0)
#define sys_getirqactids(dst) sys_getinfo(GET_IRQACTIDS, dst, 0,0,0)
2005-04-21 16:53:53 +02:00
#define sys_getmonparams(v,vl) sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
#define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
#define sys_getlocktimings(dst) sys_getinfo(GET_LOCKTIMING, dst, 0,0,0)
Rewrite of boot process KERNEL CHANGES: - The kernel only knows about privileges of kernel tasks and the root system process (now RS). - Kernel tasks and the root system process are the only processes that are made schedulable by the kernel at startup. All the other processes in the boot image don't get their privileges set at startup and are inhibited from running by the RTS_NO_PRIV flag. - Removed the assumption on the ordering of processes in the boot image table. System processes can now appear in any order in the boot image table. - Privilege ids can now be assigned both statically or dynamically. The kernel assigns static privilege ids to kernel tasks and the root system process. Each id is directly derived from the process number. - User processes now all share the static privilege id of the root user process (now INIT). - sys_privctl split: we have more calls now to let RS set privileges for system processes. SYS_PRIV_ALLOW / SYS_PRIV_DISALLOW are only used to flip the RTS_NO_PRIV flag and allow / disallow a process from running. SYS_PRIV_SET_SYS / SYS_PRIV_SET_USER are used to set privileges for a system / user process. - boot image table flags split: PROC_FULLVM is the only flag that has been moved out of the privilege flags and is still maintained in the boot image table. All the other privilege flags are out of the kernel now. RS CHANGES: - RS is the only user-space process who gets to run right after in-kernel startup. - RS uses the boot image table from the kernel and three additional boot image info table (priv table, sys table, dev table) to complete the initialization of the system. - RS checks that the entries in the priv table match the entries in the boot image table to make sure that every process in the boot image gets schedulable. - RS only uses static privilege ids to set privileges for system services in the boot image. - RS includes basic memory management support to allocate the boot image buffer dynamically during initialization. The buffer shall contain the executable image of all the system services we would like to restart after a crash. - First step towards decoupling between resource provisioning and resource requirements in RS: RS must know what resources it needs to restart a process and what resources it has currently available. This is useful to tradeoff reliability and resource consumption. When required resources are missing, the process cannot be restarted. In that case, in the future, a system flag will tell RS what to do. For example, if CORE_PROC is set, RS should trigger a system-wide panic because the system can no longer function correctly without a core system process. PM CHANGES: - The process tree built at initialization time is changed to have INIT as root with pid 0, RS child of INIT and all the system services children of RS. This is required to make RS in control of all the system services. - PM no longer registers labels for system services in the boot image. This is now part of RS's initialization process.
2009-12-11 01:08:19 +01:00
#define sys_getpriv(dst, nr) sys_getinfo(GET_PRIV, dst, 0,0, nr)
#define sys_getidletsc(dst) sys_getinfo(GET_IDLETSC, dst, 0,0,0)
Rewrite of boot process KERNEL CHANGES: - The kernel only knows about privileges of kernel tasks and the root system process (now RS). - Kernel tasks and the root system process are the only processes that are made schedulable by the kernel at startup. All the other processes in the boot image don't get their privileges set at startup and are inhibited from running by the RTS_NO_PRIV flag. - Removed the assumption on the ordering of processes in the boot image table. System processes can now appear in any order in the boot image table. - Privilege ids can now be assigned both statically or dynamically. The kernel assigns static privilege ids to kernel tasks and the root system process. Each id is directly derived from the process number. - User processes now all share the static privilege id of the root user process (now INIT). - sys_privctl split: we have more calls now to let RS set privileges for system processes. SYS_PRIV_ALLOW / SYS_PRIV_DISALLOW are only used to flip the RTS_NO_PRIV flag and allow / disallow a process from running. SYS_PRIV_SET_SYS / SYS_PRIV_SET_USER are used to set privileges for a system / user process. - boot image table flags split: PROC_FULLVM is the only flag that has been moved out of the privilege flags and is still maintained in the boot image table. All the other privilege flags are out of the kernel now. RS CHANGES: - RS is the only user-space process who gets to run right after in-kernel startup. - RS uses the boot image table from the kernel and three additional boot image info table (priv table, sys table, dev table) to complete the initialization of the system. - RS checks that the entries in the priv table match the entries in the boot image table to make sure that every process in the boot image gets schedulable. - RS only uses static privilege ids to set privileges for system services in the boot image. - RS includes basic memory management support to allocate the boot image buffer dynamically during initialization. The buffer shall contain the executable image of all the system services we would like to restart after a crash. - First step towards decoupling between resource provisioning and resource requirements in RS: RS must know what resources it needs to restart a process and what resources it has currently available. This is useful to tradeoff reliability and resource consumption. When required resources are missing, the process cannot be restarted. In that case, in the future, a system flag will tell RS what to do. For example, if CORE_PROC is set, RS should trigger a system-wide panic because the system can no longer function correctly without a core system process. PM CHANGES: - The process tree built at initialization time is changed to have INIT as root with pid 0, RS child of INIT and all the system services children of RS. This is required to make RS in control of all the system services. - PM no longer registers labels for system services in the boot image. This is now part of RS's initialization process.
2009-12-11 01:08:19 +01:00
#define sys_getaoutheader(dst,nr) sys_getinfo(GET_AOUTHEADER, dst, 0,0,nr)
2005-04-21 16:53:53 +02:00
_PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
void *val_ptr2, int val_len2) );
2010-07-07 00:05:21 +02:00
_PROTOTYPE(int sys_whoami, (endpoint_t *ep, char *name, int namelen,
int *priv_flags));
2005-04-21 16:53:53 +02:00
2005-04-29 17:36:43 +02:00
/* Signal control. */
_PROTOTYPE(int sys_kill, (endpoint_t proc_ep, int sig) );
_PROTOTYPE(int sys_sigsend, (endpoint_t proc_ep, struct sigmsg *sig_ctxt) );
_PROTOTYPE(int sys_sigreturn, (endpoint_t proc_ep, struct sigmsg *sig_ctxt) );
_PROTOTYPE(int sys_getksig, (endpoint_t *proc_ep, sigset_t *k_sig_map) );
_PROTOTYPE(int sys_endksig, (endpoint_t proc_ep) );
2005-04-21 16:53:53 +02:00
/* NOTE: two different approaches were used to distinguish the device I/O
* types 'byte', 'word', 'long': the latter uses #define and results in a
* smaller implementation, but looses the static type checking.
*/
_PROTOTYPE(int sys_voutb, (pvb_pair_t *pvb_pairs, int nr_ports) );
_PROTOTYPE(int sys_voutw, (pvw_pair_t *pvw_pairs, int nr_ports) );
_PROTOTYPE(int sys_voutl, (pvl_pair_t *pvl_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinb, (pvb_pair_t *pvb_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinw, (pvw_pair_t *pvw_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinl, (pvl_pair_t *pvl_pairs, int nr_ports) );
/* Shorthands for sys_out() system call. */
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
#define sys_outb(p,v) sys_out((p), (unsigned long) (v), _DIO_BYTE)
#define sys_outw(p,v) sys_out((p), (unsigned long) (v), _DIO_WORD)
#define sys_outl(p,v) sys_out((p), (unsigned long) (v), _DIO_LONG)
2005-04-21 16:53:53 +02:00
_PROTOTYPE(int sys_out, (int port, unsigned long value, int type) );
/* Shorthands for sys_in() system call. */
. introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
2006-06-20 10:38:15 +02:00
#define sys_inb(p,v) sys_in((p), (v), _DIO_BYTE)
#define sys_inw(p,v) sys_in((p), (v), _DIO_WORD)
#define sys_inl(p,v) sys_in((p), (v), _DIO_LONG)
2005-04-21 16:53:53 +02:00
_PROTOTYPE(int sys_in, (int port, unsigned long *value, int type) );
2005-12-02 15:40:51 +01:00
/* pci.c */
_PROTOTYPE( void pci_init, (void) );
_PROTOTYPE( void pci_init1, (char *name) );
2005-12-02 15:40:51 +01:00
_PROTOTYPE( int pci_first_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
_PROTOTYPE( int pci_next_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
_PROTOTYPE( int pci_find_dev, (u8_t bus, u8_t dev, u8_t func,
2005-12-02 15:40:51 +01:00
int *devindp) );
_PROTOTYPE( void pci_reserve, (int devind) );
_PROTOTYPE( int pci_reserve_ok, (int devind) );
2005-12-02 15:40:51 +01:00
_PROTOTYPE( void pci_ids, (int devind, u16_t *vidp, u16_t *didp) );
_PROTOTYPE( void pci_rescan_bus, (u8_t busnr) );
2005-12-02 15:40:51 +01:00
_PROTOTYPE( u8_t pci_attr_r8, (int devind, int port) );
_PROTOTYPE( u16_t pci_attr_r16, (int devind, int port) );
_PROTOTYPE( u32_t pci_attr_r32, (int devind, int port) );
_PROTOTYPE( void pci_attr_w8, (int devind, int port, u8_t value) );
_PROTOTYPE( void pci_attr_w16, (int devind, int port, u16_t value) );
2005-12-02 15:40:51 +01:00
_PROTOTYPE( void pci_attr_w32, (int devind, int port, u32_t value) );
_PROTOTYPE( char *pci_dev_name, (u16_t vid, u16_t did) );
2005-12-02 15:40:51 +01:00
_PROTOTYPE( char *pci_slot_name, (int devind) );
_PROTOTYPE( int pci_set_acl, (struct rs_pci *rs_pci) );
_PROTOTYPE( int pci_del_acl, (endpoint_t proc_ep) );
2010-07-01 11:10:16 +02:00
_PROTOTYPE( int pci_get_bar, (int devind, int port, u32_t *base,
u32_t *size, int *ioflag) );
2005-12-02 15:40:51 +01:00
/* Profiling. */
_PROTOTYPE( int sys_sprof, (int action, int size, int freq, int type,
endpoint_t endpt, void *ctl_ptr, void *mem_ptr) );
_PROTOTYPE( int sys_cprof, (int action, int size, endpoint_t endpt,
void *ctl_ptr, void *mem_ptr) );
_PROTOTYPE( int sys_profbuf, (void *ctl_ptr, void *mem_ptr) );
/* machine context */
_PROTOTYPE( int sys_getmcontext, (endpoint_t proc, mcontext_t *mcp) );
_PROTOTYPE( int sys_setmcontext, (endpoint_t proc, mcontext_t *mcp) );
2005-04-21 16:53:53 +02:00
#endif /* _SYSLIB_H */