Commit graph

265 commits

Author SHA1 Message Date
Ben Gras
1588a9ba77 slightly more accurate and verbose sanity checking 2007-03-15 10:57:39 +00:00
Ben Gras
98410fd5fe remove extra arg 2007-03-15 10:54:35 +00:00
Ben Gras
f4b7a16f7b output CRLF instead of just LF to serial 2007-03-09 15:45:35 +00:00
Ben Gras
6d50591226 . let kernel use read_tsc() from sysutil library
. read_tsc() in sysutil library saves edx and eax now
 . added read_tsc_64() by Antonio Mancina to load tsc into
   a 64-bit data type directly
 . deleted read_tsc.h in favour of a prototype in <minix/syslib.h>
2007-03-08 15:39:14 +00:00
Ben Gras
238ae978ba Don't allow sys_kill to SELF alltogether. 2007-02-23 13:01:55 +00:00
Ben Gras
a9f2f36f46 If a process does sys_kill on SELF (such as in panic() of servers and drivers
if a PM exit fails, until they are compiled with the new panic() function that
is), don't reply to it as the endpoint has been cleared.
2007-02-23 12:55:29 +00:00
Ben Gras
3bb73b431b add/re-enable at_wini debug output 2007-02-21 17:49:35 +00:00
Ben Gras
3275602598 . made memory parsing function into a library call
(moved 'struct memory' to <minix/type.h> for this library call)
 . removed some debugging messages from pci library
2007-02-16 15:54:28 +00:00
Ben Gras
a47531cc97 removed some verbose messages 2007-02-16 15:53:10 +00:00
Ben Gras
9f2f3dd488 don't call mkdep with an absolute path 2007-02-08 16:26:20 +00:00
Ben Gras
3c907e6ef1 Sanity check in clock - process is supposed to be runnable when it's
interrupted.
2007-02-08 12:59:29 +00:00
Ben Gras
41e9fedf87 Mostly bugfixes of bugs triggered by the test set.
bugfixes:
 SYSTEM:
 . removed
        rc->p_priv->s_flags = 0;
   for the priv struct shared by all user processes in get_priv(). this
   should only be done once. doing a SYS_PRIV_USER in sys_privctl()
   caused the flags of all user processes to be reset, so they were no
   longer PREEMPTIBLE. this happened when RS executed a policy script.
   (this broke test1 in the test set)

 VFS/MFS:
 . chown can change the mode of a file, and chmod arguments are only
   part of the full file mode so the full filemode is slightly magic.
   changed these calls so that the final modes are returned to VFS, so
   that the vnode can be kept up-to-date.
   (this broke test11 in the test set)

 MFS:
 . lookup() checked for sizeof(string) instead of sizeof(user_path),
   truncating long path names
   (caught by test 23)
 . truncate functions neglected to update ctime
   (this broke test16)

 VFS:
 . corner case of an empty filename lookup caused fields of a request
   not to be filled in in the lookup functions, not making it clear
   that the lookup had failed, causing messages to garbage processes,
   causing strange failures.
   (caught by test 30)
 . trust v_size in vnode when doing reads or writes on non-special
   files, truncating i/o where necessary; this is necessary for pipes,
   as MFS can't tell when a pipe has been truncated without it being
   told explicitly each time.
   when the last reader/writer on a pipe closes, tell FS about
   the new size using truncate_vn().
   (this broke test 25, among others)
 . permission check for chdir() had disappeared; added a
   forbidden() call
   (caught by test 23)

new code, shouldn't change anything:
 . introduced RTS_SET, RTS_UNSET, and RTS_ISSET macro's, and their
   LOCK variants. These macros set and clear the p_rts_flags field,
   causing a lot of duplicated logic like

       old_flags = rp->p_rts_flags;            /* save value of the flags */
       rp->p_rts_flags &= ~NO_PRIV;
       if (old_flags != 0 && rp->p_rts_flags == 0) lock_enqueue(rp);

   to change into the simpler

       RTS_LOCK_UNSET(rp, NO_PRIV);

   so the macros take care of calling dequeue() and enqueue() (or lock_*()),
   as the case may be). This makes the code a bit more readable and a
   bit less fragile.
 . removed return code from do_clocktick in CLOCK as it currently
   never replies
 . removed some debug code from VFS
 . fixed grant debug message in device.c
 
preemptive checks, tests, changes:
 . added return code checks of receive() to SYSTEM and CLOCK
 . O_TRUNC should never arrive at MFS (added sanity check and removed
   O_TRUNC code)
 . user_path declared with PATH_MAX+1 to let it be null-terminated
 . checks in MFS to see if strings passed by VFS are null-terminated
 
 IS:
 . static irq name table thrown out
2007-02-01 17:50:02 +00:00
Ben Gras
d954a122f7 Added register clobber warning to read_tsc. 2007-01-22 15:15:30 +00:00
Ben Gras
f65b3b8fbf Use bitwise not instead of logical not on PIE flag when disabling periodic
interrupts to avoid clobbering register B. This seems to have fixed the
corrupting-CMOS bug when enabling profiling.
2007-01-12 16:33:41 +00:00
Ben Gras
dfaf30e54d interface.h is unused (remainder from Ingmar's work) 2006-12-22 15:50:17 +00:00
Ben Gras
53a6054b66 arch/i386/include/protect.h is unnecessary; add make.conf to etc/ and
note about it in docs/UPDATING.
2006-12-22 15:48:27 +00:00
Ben Gras
6f77685609 Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.

 . kernel does not program the interrupt controller directly, do any
   other architecture-dependent operations, or contain assembly any more,
   but uses architecture-dependent functions in arch/$(ARCH)/.
 . architecture-dependent constants and types defined in arch/$(ARCH)/include.
 . <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
   architecture-independent functions.
 . int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
   and live in arch/i386/do_* now.
 . i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
   gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
   If 86 support is to return, it should be a new architecture.
 . prototypes for the architecture-dependent functions defined in
   kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
 . /etc/make.conf included in makefiles and shell scripts that need to
   know the building architecture; it defines ARCH=<arch>, currently only
   i386.
 . some basic per-architecture build support outside of the kernel (lib)
 . in clock.c, only dequeue a process if it was ready
 . fixes for new include files

files deleted:
 . mpx/klib.s - only for choosing between mpx/klib86 and -386
 . klib86.s - only for 86

i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
 . mpx386.s (entry point)
 . klib386.s
 . sconst.h
 . exception.c
 . protect.c
 . protect.h
 . i8269.c
2006-12-22 15:22:27 +00:00
David van Moolenbroek
d4e6fe3546 Setjmp/longjmp updates and cleanup. 2006-12-08 16:23:18 +00:00
Philip Homburg
954ad990e5 at_wini now calls pci_reserve. 2006-11-01 14:55:00 +00:00
Ben Gras
7195fe3325 System statistical and call profiling
support by Rogier Meurs <rogier@meurs.org>.
2006-10-30 15:53:38 +00:00
Ben Gras
fa0ba56bc9 Merge of VFS by Balasz Gerofi with Minix trunk. 2006-10-25 13:40:36 +00:00
Ben Gras
65a1d21963 Part of wait()/waitpid() fix in revision 2629:2634 in PM - kernel
unblocks a process that has no priority (stopped with sys_nice()
and PRIO_STOP) and reschedules it if that gives it RTS flags of 0.
2006-10-25 13:38:31 +00:00
Philip Homburg
fd448c332b Access control in do_sdevio and do_vdevio 2006-10-20 14:46:55 +00:00
Philip Homburg
dd3ee082b2 Initialize priv from user supplied priv structure in SYS_PRIV_INIT.
Added SYS_PRIV_USER call to downgrade a privileged process to a user process.
2006-10-20 14:42:48 +00:00
Philip Homburg
d9bfb27282 Missing negation in comment 2006-09-21 13:33:23 +00:00
Philip Homburg
4cc6be8532 NUL terminate timingdata[cat].names instead of timingdata[0].names. Reported
by <devel@pop3.ru>.
2006-08-28 15:30:14 +00:00
Philip Homburg
c5efbf71c0 first commit of extra ptrace code for fault injection 2006-08-28 14:59:56 +00:00
Philip Homburg
62cb625f1b Removed superfluous assignment to text_base. Reported by Ildar Ismagilov. 2006-08-28 14:59:55 +00:00
Philip Homburg
4ba5826ba6 Improved access checks in system.c. Grant drivers and FS the rights they need. 2006-08-10 10:56:16 +00:00
Ben Gras
ec4223d96a More stack for system. 2006-07-25 09:38:24 +00:00
Philip Homburg
d40007667c Do not report non-safe sys_sdevio calls when the address is 'SELF' 2006-07-13 14:46:53 +00:00
Philip Homburg
6f4091eb8c Added do_readbios. Added debugging output for unexpected use of unsafe copy
functions.
2006-07-10 12:27:26 +00:00
Ben Gras
407eefe63a Compile fix 2006-06-29 14:23:33 +00:00
Ben Gras
f1222a09a6 Make stack traces on exceptions possible. 2006-06-29 13:35:27 +00:00
Ben Gras
607fb6bf7f Add a flag to grants system indicating a slot is VALID; so a slot
can be reserved (USED), while toggling VALID on and off.
2006-06-27 12:19:45 +00:00
Ben Gras
3b814d36d1 Rename paramctl to setgrant. 2006-06-23 15:35:05 +00:00
Philip Homburg
add4be444f get_sys_bits 2006-06-23 15:32:24 +00:00
Ben Gras
002922fa4c New kernel call, SYS_PARAMCTL, that sets parameters of the caller
and is therefore unprivileged. Used to set grant tables.
2006-06-23 15:07:41 +00:00
Ben Gras
d402047222 Added vectored variant of sys_safecopy*. 2006-06-23 11:54:03 +00:00
Ben Gras
3061d7b17a Changed do_devio not to require DIO_TYPE, but to extract type
from DIO_REQUEST. Also do_vdevio. Also do_sdevio, but this
function also supports grant id's and offsets.

do_segctl: rename protected to prot.

do_umap: support for GRANT_SEG umap.

do_privctl: support SYS_PRIV_SET_GRANTS, which sets location and size
of in-own-address-space grant table.

do_safecopy: functions to verify and perform 'safe' (grant-based) copies.
2006-06-20 10:03:10 +00:00
Ben Gras
ada6592af9 Prototype of do_safecopy 2006-06-20 09:59:50 +00:00
Ben Gras
bf6fa2acd0 Introduced global sys_call_code to check in called kernel call
implementation functions.

Changed check in system.c to check compile-time-sized bitmap of
kernel calls.

Added SYS_SAFECOPYFROM and SYS_SAFECOPYTO, both mapping to
do_safecopy (that's what sys_call_code is used for).
2006-06-20 09:58:58 +00:00
Ben Gras
b89c6634f5 Use endpoint_t. New prototypes for related to grants and safecopy functions. 2006-06-20 09:57:00 +00:00
Ben Gras
2e89eb5270 Change allowed kernel call bitmap to an array of bitmaps to allow
any number of kernel calls.

Allowed kernel calls are stored in table.c for every image process as a
variably-sized array of allowed calls. This is used to fill the bitmap
of size determined at compile time by the number of kernel calls. This
filling is done by main.c. There is a special call called SYS_ALL_CALLS
which fills the bitmap of allowed calls completely, if that is the only
entry in the array.
2006-06-20 09:56:06 +00:00
Ben Gras
eecb40cf21 Rename protected to prot for g++ 2006-06-20 09:52:11 +00:00
Ben Gras
28950e6104 Use endpoint_t type 2006-06-20 09:51:49 +00:00
Ben Gras
831bc7ecd1 Move bitmap manipulation macros to <minix/bitmap.h> 2006-06-20 09:50:26 +00:00
Philip Homburg
15b8fe54a8 Better initialization of the memory map of processes that are part of the
image. Removed NO_MAP flag.
2006-05-11 14:49:46 +00:00
Ben Gras
3172b4d0ad Patches by Jeff Bailey for posixifications. 2006-04-09 23:16:13 +00:00
Ben Gras
eae250dea4 . load average calculation changed to calculate it all over every tick
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
2006-03-16 09:33:35 +00:00
Philip Homburg
7f861650b0 Use the sysutil library's printf code also for the kernel. 2006-03-15 16:15:23 +00:00
Philip Homburg
c1da6e6e24 Allow a process to kill itself. Remove the endpoint of a process that kills
itself before reporting the singal to pm.
2006-03-15 12:01:59 +00:00
Ben Gras
55bdde85f0 Hack out of proc.c; function and flags width in ipc.h back to nibbles
instead of bytes for backwards compatability
2006-03-15 11:29:54 +00:00
Ben Gras
8500d0f238 Backwards compatability hack 2006-03-15 11:11:54 +00:00
Ben Gras
c236121692 Let reboot work again by making PM check for RBT_REBOOT 2006-03-10 16:50:27 +00:00
Jorrit Herder
021e3234d8 Jorrit's ... "progress?" 2006-03-10 16:10:05 +00:00
Ben Gras
0d831b9c22 Don't print anything if anything is wrong in send_sig() 2006-03-09 14:02:56 +00:00
Ben Gras
6d98f7205a Verify if log process numbers are sensible 2006-03-09 14:00:33 +00:00
Ben Gras
5498a74d87 Typo in comment. 2006-03-09 13:59:59 +00:00
Philip Homburg
4b62006c04 Fixed typo. 2006-03-08 12:30:43 +00:00
Philip Homburg
167ea0faa5 Added some disabled debug code. 2006-03-08 12:06:33 +00:00
Philip Homburg
9a1dfc5128 Do not confuse proc with proc_addr if you want a bug free kernel. 2006-03-08 11:59:59 +00:00
Ben Gras
1335d5d700 'proc number' is process slot, 'endpoint' are generation-aware process
instance numbers, encoded and decoded using macros in <minix/endpoint.h>.

proc number -> endpoint migration
  . proc_nr in the interrupt hook is now an endpoint, proc_nr_e.
  . m_source for messages and notifies is now an endpoint, instead of
    proc number.
  . isokendpt() converts an endpoint to a process number, returns
    success (but fails if the process number is out of range, the
    process slot is not a living process, or the given endpoint
    number does not match the endpoint number in the process slot,
    indicating an old process).
  . okendpt() is the same as isokendpt(), but panic()s if the conversion
    fails. This is mainly used for decoding message.m_source endpoints,
    and other endpoint numbers in kernel data structures, which should
    always be correct.
  . if DEBUG_ENABLE_IPC_WARNINGS is enabled, isokendpt() and okendpt()
    get passed the __FILE__ and __LINE__ of the calling lines, and
    print messages about what is wrong with the endpoint number
    (out of range proc, empty proc, or inconsistent endpoint number),
    with the caller, making finding where the conversion failed easy
    without having to include code for every call to print where things
    went wrong. Sometimes this is harmless (wrong arg to a kernel call),
    sometimes it's a fatal internal inconsistency (bogus m_source).
  . some process table fields have been appended an _e to indicate it's
    become and endpoint.
  . process endpoint is stored in p_endpoint, without generation number.
    it turns out the kernel never needs the generation number, except
    when fork()ing, so it's decoded then.
  . kernel calls all take endpoints as arguments, not proc numbers.
    the one exception is sys_fork(), which needs to know in which slot
    to put the child.
2006-03-03 10:00:02 +00:00
Philip Homburg
7034c0795d Moved PCI driver to the ramdisk. 2006-02-15 14:21:56 +00:00
Philip Homburg
c3a88d15d8 Initial root filesystem is now on a ramdisk that is part of the image. 2006-02-15 11:18:21 +00:00
Ben Gras
88ba4b5268 added reenter check to lock_dequeue() to avoid unlocking of interrupts
via cause_sig() during an exception.

moved lock check configuration to <minix/sys_config.h> instead of
kernel/config.h, because the 'relocking' field in kinfo depends on it.

other prettification: common locking macro, whether lock timing is on or
not.
2006-02-10 16:53:51 +00:00
Ben Gras
0a02bfb056 Moved ipc debug out of conditional.
Gave pci server sys_getinfo privilege.
2006-02-06 15:16:14 +00:00
Philip Homburg
38a16399f8 Store resource lists for drivers. Limited checks to enforce those lists. 2006-01-27 13:21:12 +00:00
Philip Homburg
d9d970bdfa GET_IRQACTIDS, allow SELF in do_vm_map. 2006-01-12 14:38:51 +00:00
Philip Homburg
eec836014a PCI support in a separate driver 2005-12-02 14:45:38 +00:00
Ben Gras
87f2236ad2 load average measurement implementation, accessable through
getloadavg() system call in the library.
2005-11-14 15:50:46 +00:00
Philip Homburg
b85736bd7b Grant tty permission to use SYS_VM_MAP and SYS_IOPENABLE. 2005-11-09 15:48:41 +00:00
Philip Homburg
0b7fcbfd70 Only the memory driver should be allowed access to SYS_IOPENABLE 2005-11-04 17:06:49 +00:00
Philip Homburg
bfa0a555ad Removed debug printfs. 2005-10-24 13:48:50 +00:00
Ben Gras
85209d2e29 Test for SENDING else RECEIVING should be SENDING, then RECEIVING. 2005-10-21 18:13:10 +00:00
Ben Gras
81fa8fc3b8 Don't enqueue processes unless their flags have become 0 2005-10-21 17:35:39 +00:00
Jorrit Herder
78f20c3959 Rest ... 2005-10-21 13:46:47 +00:00
Ben Gras
cf16c73e62 . check for notify() from NONE (shouldn't happen any more)
. test for cleared process slots when checking processes on exiting
 . clear process slot first, then do cleanup on exiting
2005-10-20 20:59:02 +00:00
Jorrit Herder
86e3333454 New error codes for IPC errors.
Made VM code debug output disappear.
2005-10-20 20:25:32 +00:00
Ben Gras
2bf8bfe126 Turn IPC warning messages off by default
(because inet deadlocks are normal and will confuse our users).
2005-10-18 16:13:12 +00:00
Ben Gras
ea75918df1 printf() by kernel and servers now send messages to an array of processes,
OUTPUT_PROCS_ARRAY in <minix/config.h>, in that order, terminated by NONE.
log no longer forwards messages to tty itself. This leads to less funny
loops and more robust debug-message handling. Also the list of
processes receiving messages can easily be changed around or disabled by
editing the array (e.g. disable it by changing the array to { NONE }.).
2005-10-18 10:34:54 +00:00
Ben Gras
61b6139752 Al's system -> kernel call change 2005-10-14 09:13:52 +00:00
Ben Gras
32514fb5f9 Al's system call -> kernel call renaming 2005-10-14 08:58:59 +00:00
Ben Gras
ee9b08e5c0 Comment fix about sys_abort() 2005-10-13 09:43:39 +00:00
Jorrit Herder
b16a88692a New deadlock check at proc.c.
New exit checks (stop IPC).
2005-10-12 15:08:23 +00:00
Ben Gras
cc3201bacd Al's cosmetic rearrangement 2005-10-09 19:58:25 +00:00
Ben Gras
ab1374a9cb Comment corrections from Al 2005-10-07 13:23:18 +00:00
Ben Gras
4fc5f85a88 Corrected correction of clock's 2005-10-06 10:21:24 +00:00
Ben Gras
293e1ea70d Missing comma 2005-10-06 09:39:36 +00:00
Ben Gras
b46a51cfd6 Semidefinitive copyright statement. 2005-10-06 09:38:55 +00:00
Jorrit Herder
32c05f45c6 Minor bug fixes in proc.c and utility.c;
Removed debug dumps on panic from main.c;
Return error on exit when other process does IPC to/from exiting process.
2005-10-05 09:51:50 +00:00
Ben Gras
71b6f31d4e Let TTY call SYS_ABORT 2005-10-05 08:45:55 +00:00
Ben Gras
afc6721239 Al's comment fixes 2005-10-05 08:21:35 +00:00
Ben Gras
7ca48023af Al's comment bug. 2005-10-04 08:29:44 +00:00
Ben Gras
e32131bb05 Fixed wrong comment. 2005-10-04 08:28:07 +00:00
Ben Gras
15c6f7182b Al's comment fixes 2005-10-02 19:02:05 +00:00
Philip Homburg
9bee3f4b08 IOPL, VM, and serial debug output (disabled). 2005-09-30 12:54:59 +00:00
Ben Gras
b2dd3ff593 New copyright statement. 2005-09-23 22:10:11 +00:00
Ben Gras
1d0852bcd4 Enforce system call bitmask 2005-09-20 12:24:19 +00:00
Ben Gras
5ae6f98dea Andy's formatting fixes. 2005-09-11 16:44:06 +00:00