For character device i/o, FS does a so-called 'magic' grant to let the
driver copy from or to user space. As this is done in FS address space,
the driver is told to do this in FS address space. The redirection to
the right user process then happens at copy-time in the kernel, using the
FS grant table. This also happens for DEV_READ and DEV_WRITE on block
devices.
For other block device i/o, which happens from/to FS buffers, FS does
a 'direct' grant to its own address space for the driver.
After the i/o returns, this access has to be K-I-L-L-E-D, revoked.
Sometimes this is after a SUSPEND and DEV_REVIVE, in which case the
revoking happens in pipe.c.
This conversion happens in safe_io_conversion() in device.c, called
by dev_io and dev_bio.
FS has to pre-allocate its own space for these grant tables. This happens
in main.c.
library to the memory driver. Always put output from within TTY directly on
the console. Removed second include of driver.h from tty.c. Made tty_inrepcode
bigger. First step to move PM and FS calls that are not regular (API)
system calls out of callnr.h (renumbered them, and removed them from the
table.c files). Imported the Minix-vmd uname implementation. This provides
a more stable ABI than the current implementation. Added a bit of security
checking. Unfortunately not nearly enough to get a secure system. Fixed a
bug related to the sizes of the programs in the image (in PM patch_mem_chunks).
instead of keeping a running total of enqueued processes
(because somehow the load average was broken)
. added SI_KPROC_TAB to get a copy of kernel process table from PM, for
a top implementation
. fixed arg to sys_nice() to make it an endpoint, not a slot number
. loops checked for PID_FREE
. exit broken down in exit and cleanup functions; when reboot happens,
cleanup is done but not exit (as processes have not actually exited),
this keeps drivers working
. fixed a few uninitialized and unused variables
scripts:
. new packaging system
pm: fixed rebooting by making a copy of the monitor code from the user
process. this is necessary because that process is dead by the time
sys_abort() is called.
also added more info to the "can't reply" panic.
'who', indicating caller number in pm and fs and some other servers, has
been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.).
In both PM and FS, isokendpt() convert endpoints to process slot
numbers, returning OK if it was a valid and consistent endpoint number.
okendpt() does the same but panic()s if it doesn't succeed. (In PM,
this is pm_isok..)
pm and fs keep their own records of process endpoints in their proc tables,
which are needed to make kernel calls about those processes.
message field names have changed.
fs drivers are endpoints.
fs now doesn't try to get out of driver deadlock, as the protocol isn't
supposed to let that happen any more. (A warning is printed if ELOCKED
is detected though.)
fproc[].fp_task (indicating which driver the process is suspended on)
became an int.
PM and FS now get endpoint numbers of initial boot processes from the
kernel. These happen to be the same as the old proc numbers, to let
user processes reach them with the old numbers, but FS and PM don't know
that. All new processes after INIT, even after the generation number
wraps around, get endpoint numbers with generation 1 and higher, so
the first instances of the boot processes are the only processes ever
to have endpoint numbers in the old proc number range.
More return code checks of sys_* functions have been added.
IS has become endpoint-aware. Ditched the 'text' and 'data' fields
in the kernel dump (which show locations, not sizes, so aren't terribly
useful) in favour of the endpoint number. Proc number is still visible.
Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got
the formatting changed.
PM reading segments using rw_seg() has changed - it uses other fields
in the message now instead of encoding the segment and process number and
fd in the fd field. For that it uses _read_pm() and _write_pm() which to
_taskcall()s directly in pm/misc.c.
PM now sys_exit()s itself on panic(), instead of sys_abort().
RS also talks in endpoints instead of process numbers.
Implemented by changing write_map to accept a WMAP_FREE flag. In that
case, it doesn't update the datablock (creating indirect zones as
necessary) pointer, but it frees the datablock if present. Also it
frees the single and double indirect blocks if unused.
This makes the implementation of truncate_inode() simpler.
truncate_inode() now accepts a truncation length which makes
implementing truncate() and ftruncate() simple.
This also allowed implementing the F_FREESP fcntl().
. new_node() now returns inode of parent dir as argument that
has to be put_node()d again by the caller of new_node().
it can also return the name of the last component as last_dir()
did.
. advance() takes a pointer to a pointer of an inode as the
parent now. This parent can change, in which case the old
one is put_node()d and a new one is put there.
. eat_path() replaced by more flexible parse_path()
. last_dir() replaced by call to parse_path().
. do_slink(), do_readlink(), do_lstat() and slink_traverse() added.
Also added some truncate()/ftruncate()-introduction related changes.
(e.g. renamed truncate() to truncate_inode().)
. When drivers disappear that have pending select()s, wake up
those user processes with EAGAIN so that they can retry their
select() and won't hang forever on it.
. When drivers re-appear and are mapped into the dmap, run through
the list of mounted filesystems and re-dev_open() every one (for
partition tables and such). This can't happen before the driver
has exec()ced itself, so processes that have fork()ed but not
exec()ced yet are marked as DMAP_BABY in the dmap table if they
are dmapped before they are execced. If that happens, the above
procedure happens after the exec(). If the exec() happens before
the dmapping, it (the dev_open()ing) happens right away.
New Shift-F6 dump for RS server at IS.
New getnpid, getnproc, getpproc library calls at PM.
New reincarnation server (basic functionality is there now).
. unmap device drivers from dmap when PM signals they are dead
. new null-io function (no_dev_io) to fill in for io functions
of unmapped drivers
. driver (process number) of unmapped drivers is NONE instead of
0 (a valid process number)
IS:
. print mutable flag of dmap table too
FS changes require sync() to be done 'manually' (currently by
reboot/shutdown) at shutdown time; could be caught by SIGTERM in
the future.
enforced. If a call is denied, this will be kprinted. Please report any such
errors, so that I can adjust the mask before returning errors instead of
warnings.
Wrote CMOS driver. All CMOS code from FS has been removed. Currently the
driver only supports get time calls. Set time is left out as an exercise
for the book readers ... startup scripts were updated because the CMOS driver
is needed early on. (IS got same treatment.) Don't forget to run MAKEDEV cmos
in /dev/, otherwise the driver cannot be loaded.
The user needs to set label=... to choose the driver of his or her choice.
This driver will be mapped onto the controller that is set in controller=...
Minor cleanup of kernel source code (boot image table now is static).
This was caused by a change in the shared driver code. Not log's fault.
Renamed #definitions of driver process numbers, e.g., TTY now is TTY_PROC_NR.
All known (special) processes now have consistent naming scheme. Kernel tasks
don't follow this scheme.
to provide an index (0 .. 31) that is passed in the HARD_INT message when an
interrupt occurs. The NOTIFY_ARG field contains a bitmap with all indexes for
which an interrupt occured.
if the boot monitor parameter is set. it also sets a boot monitor
parameter (by talking to the PM) so userland knows it.
. ramdisk copy code made slightly smarter
. various select() prettifications (work in progress)
Kernel no longer keeps track of user alarms on behalf of the PM.
Instead, the PM maintains its own list of watchdog timers, and
uses one synchronous alarm (at the kernel) to get notifications
for expired user timers.
and the new log driver if enabled.
new usyslogd is started from /usr/etc/rc. New device created by
MAKEDEV.sh. /var/log created by etc/mtree/minix.tree (on root for
now). Made select() slightly more generic, with less code duplication.
Not a really good solution (as it might not catch situations in which this
is caused by another bug), but the forrest of checks necessary might be worse
than this quick fix - because when looking for the cause, I found some other
cases in which the PM would panic as well. See info in bug 2 for details.
Another fix is to delay notification of PM by SYSTASK of signals delivered
internally until after the reply (e.g. of exec()), because the reply would
be messed up otherwise (receiving the notify instead of reply). This caused
SIGTRAP not to be delivered properly with traced processes.
Made /usr/include belong to bin in mtree.
Fixed compiler warning in fs/pipe.c.
Added mdb (minix debugger) manual page.
Added ethernet config function in setup script.
The TTY driver now only notifies the IS server about function key event,
but does not tell which keys are pressed. The IS servers queries the TTY
driver to find out about this.
variable. Parsing worked, but future requests for the variable (such as
by the sysenv command) returned truncated data. This caused the system
(e.g. setup script) to think the amount of memory was tiny, and caused
the enabling of swapspace, while it is unnecessary.
syncing, for instance) if blocks are unwritable. This could happen if:
. write goes beyond device boundary to a block device
. write is done for a complete block or more; thus the
block is not retrieved first (at which point it would be noticed
it doesn't exist), but the buffer is simply allocated
. at write time, the device i/o doesn't succeed, but rw_scattered
doesn't understand this and loops forever trying to get the block
written.
Currently, if no blocks can be written, the loop aborts, leaving all
buffers intact but potentially dirty. When invalidate() is called on the
device, the buffers will disappear (even if dirty). Same story for if
the buffer is removed due to rmed from lru chain. There's not much we
can do about this, however - we can't keep these blocks around, forever
occupying a buffer in the buffer cache.
The second part of the solution is not to let unwritable buffers be
created in the first place. How to do this, however, without doing a
wasteful read first?
It looks like this code was in 2.0.4 too.
Added interface to select() for pipes (also named pipes), and select()
stubs for regular files.
Added timer library in FS that select() is the first customer of.
This is unfinished, but committed anyway to get a new release out to
Al and testers.
need /tmp any more since 16MB root device; increase to 3.0.5 to make new
CD with working FXP driver. (not tagged 3.0.5 yet as at driver bios-copy
workaround hasn't been done.)
* Removed some variants of the SYS_GETINFO calls from the kernel;
replaced them with new PM and utils libary functionality. Fixed
bugs in utils library that used old get_kenv() variant.
* Implemented a buffer in the kernel to gather random data.
Memory driver periodically checks this for /dev/random.
A better random algorithm can now be implemented in the driver.
Removed SYS_RANDOM; the SYS_GETINFO call is used instead.
* Remove SYS_KMALLOC from the kernel. Memory allocation can now
be done at the process manager with new 'other' library functions.
names. All system processes can now either use panic() or report() from
libutils, or redefine their own function. Assertions are done via the standard
<assert.h> functionality.
using phys_copy to copy zeroes there for every kb), which is a big
optimisation in some cases
fixed a bug that was introduced when function keys became notifies
This allowed removing the p_flagarlm timer from the kernel's process table.
Furthermore, I merged p_syncalrm and p_signalrm into p_alarm_timer to save
even more space. Note that processes can no longer have both a signal and
synchronous alarm timer outstanding as of now.
and type) are overwritten with newer flags/ arguments. The interface from
within the kernel is lock_notify(). User processes can make a system call with
notify(). NOTIFY fully replaces the old notification mechanism.
The call works. Permission check, restriction of outstanding notifications
to be added. Low level code to make it work from within interrupt handlers
will be added as well.