Commit graph

198 commits

Author SHA1 Message Date
Jorrit Herder 941b5ebd1c Fix to device table at FS.
BIOS and AT installed in /sbin.
Floppy boot fixed.
2005-08-05 18:57:20 +00:00
Jorrit Herder 1c570a7d93 Second try to fix tick delay problem ... 2005-08-05 17:02:37 +00:00
Jorrit Herder e396496d8c Fixed small bug in alarm code.
Kernel timer count was not reset after expiry.
2005-08-05 16:46:27 +00:00
Jorrit Herder b96c389e78 Various small cleanups and comments added. 2005-08-05 09:41:15 +00:00
Jorrit Herder 74711a3b14 Check if kernel calls is allowed (from process' call mask) added. Not yet
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.
2005-08-04 19:23:03 +00:00
Jorrit Herder e561081545 Miscellaneous clean ups and fixes to the kernel.
Support for FLOPPY in boot image. (Set controller=fd at boot monitor.)
Moved major device numbers to <minix/dmap.h> (maybe rename to dev.h?)
2005-08-04 09:26:36 +00:00
Jorrit Herder 89cf745fe2 Single boot driver loaded, while multiple can be included in the boot image.
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).
2005-08-03 16:06:35 +00:00
Jorrit Herder 1ae4d41d0d Without /dev/boot ... 2005-08-03 14:17:28 +00:00
Jorrit Herder 375f6f8754 Miscellaneous cleanups. 2005-08-03 11:53:36 +00:00
Jorrit Herder 1f450f4959 Test .. no update. 2005-08-03 08:15:36 +00:00
Jorrit Herder b69ca94efb Fixed 'bug' in log driver that caused kernel messages not to be displayed.
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.
2005-08-03 08:14:08 +00:00
Jorrit Herder ab7c0a9926 Cleaned up table. Moved policies to table.
Small fixes to do_copy, do_privctl and do_fork.
2005-08-02 15:28:09 +00:00
Jorrit Herder 0946d128cd - Kernel call handlers cleaned up. More strict checking of input parameters.
- Moved generic_handler() from system.c to system/do_irqctl.c.
- Set privileges of system processes somewhat stricter.
2005-07-29 15:26:23 +00:00
Jorrit Herder d62e515660 Small update to SYS_IRQCTL -> setting an interrupt policy now allows the caller
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.
2005-07-29 12:44:42 +00:00
Jorrit Herder bd8762263a *** empty log message *** 2005-07-29 11:50:58 +00:00
Philip Homburg 49c25df569 bios_wini driver 2005-07-29 10:21:04 +00:00
Jorrit Herder fe0dcb5c00 AT driver is not modified (debugging only);
TTY: select and revive with new notify and FS call back;
kernel: removed old notify code; removed ugly prepare_shutdown timer
kputc: don't send to FS if PRINTF_PROC fails
2005-07-27 14:32:16 +00:00
Ben Gras 31042a5a05 Added SENDREC_BUSY flag to indicate that process is doing sendrec() -
if so, alerts are not received before reply message.
2005-07-27 14:08:59 +00:00
Philip Homburg 93fc19de2c The priority of FS should be lower than that of PM to avoid race conditions
when processes are killed due to a signal.
2005-07-27 11:48:13 +00:00
Ben Gras dd1186d65d No RDY_Q_HEAD business.. 2005-07-27 07:01:46 +00:00
Jorrit Herder 30d95cad82 Removed debug output. 2005-07-26 14:54:49 +00:00
Jorrit Herder a41eb700e8 Minor fixes and improvements for sys_call(). 2005-07-26 13:51:21 +00:00
Jorrit Herder 8866b4d0ef Kernel changes:
- reinstalled priority changing, now in sched() and unready()
- reinstalled check on message buffer in sys_call()
- reinstalled check in send masks in sys_call()
- changed do_fork() to get new privilege structure for SYS_PROCs
- removed some processes from boot image---will be dynamically started later
2005-07-26 12:48:34 +00:00
Philip Homburg 153fdabb26 Fixed do_trace to properly return (status) information. 2005-07-25 12:15:05 +00:00
Jorrit Herder 954865e389 *** empty log message *** 2005-07-22 09:59:37 +00:00
Jorrit Herder 80816ab001 *** empty log message *** 2005-07-22 09:20:43 +00:00
Jorrit Herder f0594a9e6d - Fixed comments in various system call handlers. Work in progress on new
sys_privctl() call to dynamically start servers and drivers.

- Shutdown sequence slightly adjusted: called as watchdog timer to let the
  busy sys_abort() call from the PM return first.

- Changed umap_bios() to have more restrictive check: BIOS memory is now
  allowed in BIOS_MEM_BEGIN to END (interrupt vectors) and BASE_MEM_TOP
  to UPPER_MEM_END. Hopefully this keeps QEMU and Bochs happy.
2005-07-21 18:36:40 +00:00
Jorrit Herder c0718054e9 Various fixes and improvements.
- fixed bug that caused IDLE to panic (irq hook inconsistency);
- kprintf() now accepts multiple arguments; moved to utility.c;
- prepare_shutdown() signals system processes with SIGKSTOP;
- phys_fill() renamed to phys_memset(), argument order changed;
- kmemset() removed in favor of phys_kmemset();
- kstrncpy() removed in favor of phys_copy();
- katoi, kstrncmp replaced by normal library procedure again;
- rm_irq_handler() interface changed (simply pass hook pointer);
2005-07-20 15:25:38 +00:00
Ben Gras c24f72d433 Made phys_fill fill its 4-byte pattern any number of bytes (instead of
rounded down to a 4-byte multiple)

Fixed dependency omission
2005-07-19 16:00:25 +00:00
Jorrit Herder 1d7bdd4ab1 *** empty log message *** 2005-07-19 15:01:47 +00:00
Jorrit Herder b3a28466bb *** empty log message *** 2005-07-19 14:03:21 +00:00
Jorrit Herder 198c976f7e System processes can be signaled; signals are transformed in SYS_EVENT message
that passes signal map along. This mechanisms is also used for nonuser signals
like SIGKMESS, SIGKSTOP, SIGKSIG.

Revised comments of many system call handlers. Renamed setpriority to nice.
2005-07-19 12:21:36 +00:00
Philip Homburg 7d4e914618 Random number generator 2005-07-18 15:40:24 +00:00
Ben Gras 1f756d377a Made memset system call listen to character argument 2005-07-18 12:31:11 +00:00
Ben Gras 42e6d20afe Changed phys_zero to phys_fill, which accepts a 4-byte argument saying what
to fill with. Changed prototype and call to match.
2005-07-18 12:18:16 +00:00
Jorrit Herder 2c730e8a8c Renamed file. 2005-07-14 15:27:40 +00:00
Jorrit Herder 312c004519 *** empty log message *** 2005-07-14 15:26:26 +00:00
Jorrit Herder 42ab148155 Reorganized system call library; uses separate file per call now.
New configuration header file to include/ exclude functionality.
Extracted privileged features from struct proc and create new struct priv.
Renamed various system calls for readability.
2005-07-14 15:12:12 +00:00
Ben Gras f96645a4eb Fixed a bug in kstrncpy() that caused mayhem whenever the buffer to be
copied into was the same size as the source string - it will keep on
filling with zeroes forever. This was a signed/unsigned bug, fixed by
making the kstrncpy argument ssize_t instead of size_t. This bug was
triggered by Chris Young <teddga@earthlink.net>, by dazzling coincedence -
changing OS_VERSION into something with one more character (exactly the
same size as the buffer in the kinfo struct).

Also noticed that the kstrncpy() call didn't null-terminate the strings
if necessary, also fixed.
2005-07-13 14:46:11 +00:00
Ben Gras 42050e39f8 kernel and servers send diagnostic messages to IS; IS sends them to TTY
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.
2005-07-08 17:30:01 +00:00
Ben Gras 904cf1f84d A "fix" for bug no. 2 is to check if the process slot has disappeared.
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.
2005-07-04 15:20:46 +00:00
Ben Gras 3dcb2886ff get/setpriority() and fsync() system calls 2005-07-01 18:01:33 +00:00
Ben Gras 2ce80ece5c Fix to check for RDTSC instruction (above 486), and call another timing
function instead if RDTSC is unavailable. This makes minix run on 486
again :) (presumably lower as well).
2005-07-01 09:39:47 +00:00
Jorrit Herder c349ef942a Changes scheduling priorities for nice(). 2005-07-01 09:08:41 +00:00
Jorrit Herder bac6068857 Rewrite of process scheduling:
- current and maximum priority per process;
- quantum size and current ticks left per process;
- max number of full quantums in a row allow
  (otherwise current priority is decremented)
2005-06-30 15:55:19 +00:00
Ben Gras 6be8c4d8a3 Import of dpeth 3c501/3c509b/.. ethernet driver by
Giovanni Falzoni <fgalzoni@inwind.it>.
2005-06-29 10:16:46 +00:00
Jorrit Herder b25146d3de Removed SM server. 2005-06-27 08:11:46 +00:00
Jorrit Herder a408699ce0 Cleaned up process table structure: removed p_type, p_pendcount.
Removed stop sequence when MINIX is shut down.
Disabled send mask checks --- to be replaced by proper mechanism.
Fixed bug relating to 'shutdown -x'.
Simplified clock accounting of realtime.
Updated Makefiles for mkdept script.
2005-06-24 16:24:40 +00:00
Ben Gras 3bb4d191d7 Corrected buffer size calculation from MAX(bufsize,realsize)
to MIN(bufsize,realsize) while copying boot params.
2005-06-21 16:18:23 +00:00
Jorrit Herder 355a10864b Fixed various GCC compiler warnings for the kernel.
Only main() now gives a warning about the return type (GCC wants an int).
2005-06-21 10:47:46 +00:00
Ben Gras 3eeff022fb Added function read_cpu_flags() that returns current cpu flags as a
long.  This is used to check for interrupts being disabled at the time
of a lock() call, if enabled in config.h. The number of times this
happens is then counted in the kinfo structure. These events (recursive
lockings) lead to nasty race conditions.
2005-06-20 14:53:13 +00:00
Jorrit Herder ec24a0798c Updated function key mapping because of possible changes to NOTIFY.
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.
2005-06-20 14:23:31 +00:00
Jorrit Herder 403580e95b Removed unused code in proc.c. New message passing code with pointer pointers
is now in use. Rewrote ready() and unready() fuctions.
2005-06-20 11:26:48 +00:00
Ben Gras 3c7120d830 Changed arguments of timer library functions. 2005-06-17 13:36:01 +00:00
Jorrit Herder 7279bb68ef Applied MINIX 2.0.4 pathes provides by Al Woodhull. 2005-06-17 13:00:04 +00:00
Jorrit Herder ae018feae2 Removed unnecessary call to unlock() from exception(). 2005-06-17 09:50:12 +00:00
Jorrit Herder 47e3d11e42 Fixed code passed to boot monitor after shutdown. 2005-06-17 09:40:02 +00:00
Jorrit Herder e0a98a4d65 * Fixed bug relating to nested locking in interrupt handlers. The nested lock
caused interrupts to be reenabled (due to unlock), which caused a race. The
problems were especially visible on slower machines.
* Relocated free memory parsing to process manager. This saved quite some
code at the kernel level. Text size was reduced by about 650 bytes.
* Removed locks for updating the realtime in the clock's main loop and the
get_uptime function. Interrupts are no longer reentrant, so realtime is
immediately updated.
2005-06-17 09:09:54 +00:00
Jorrit Herder c2cd510adf Removed debug dumps from the PM and FS servers. The dumps are now done by the
IS servers, which obtains a copy of the data through the getsysinfo() system
call. CTRL-F1 now is a special TTY key to shows function key mappings.
2005-06-07 14:43:35 +00:00
Jorrit Herder 0e2a7a9730 Kernel cleanup.
Reduced kernel size by 512KB by moving private buffer into cstart() function.
Replaced assertions with erroneous return values. Removed assertions relating
to isuserp(rp), since all processes should become user processes; system
processes are now treated similar to other processes.
2005-06-07 12:34:25 +00:00
Ben Gras cde16504a1 check relaxation for bios memory 2005-06-06 11:54:58 +00:00
Jorrit Herder c281867f46 Fixed bug relating to FS and MEMORY during startup;
Relocated some syslib functions to utils library;
Changed location of 'Multiuser startup ..." echo in /etc/rc
2005-06-06 09:30:44 +00:00
Jorrit Herder f2a85e58d9 Various updates.
* 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.
2005-06-03 13:55:06 +00:00
Ben Gras 4904a5537a process manager must be able to send to rtl driver 2005-06-03 09:02:19 +00:00
Jorrit Herder e782e76944 Created new findproc system call to the PM (to replace similar kernel
functionality). Currently working on memory allocation (not yet finished).
2005-06-02 12:43:21 +00:00
Ben Gras c977bd8709 Added args to lock() and unlock() to tell them apart, for use
when lock timing is enabled in minix/config.h.

Added phys_zero() routine to klib386.s that zeroes a range of memory, and
added corresponding system call.
2005-06-01 09:37:52 +00:00
Jorrit Herder a3d2f35993 Fixed minor bug in PM's child time administration. 2005-06-01 08:55:22 +00:00
Jorrit Herder 0165662cd9 Replaced flagalrm() timers with another technique to check for timeouts.
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.
2005-05-31 14:43:04 +00:00
Jorrit Herder 322ec9ef8b Moved stime, time, times POSIX calls from FS to PM. Removed child time
accounting from kernel (now in PM).  Large amount of files in this commit
is due to system time problems during development.
2005-05-31 09:50:51 +00:00
Jorrit Herder b421423c77 SENDREC now always has flag FRESH_ANSWER to prevent pending notifications
to be used as answer to a SENDREC call.
2005-05-30 11:11:40 +00:00
Jorrit Herder 826fee4c6d Fixed clear_proc(): properly release resources (IRQ hooks, notify buffers);
Cleaned up comments in proc.c (old code still present for comparison);
2005-05-30 11:05:42 +00:00
Jorrit Herder 852008d669 Kinfo counts lock_notify() and lock_send() calls. 2005-05-27 14:54:40 +00:00
Jorrit Herder 8d9c0886cd Created ECHO system call for testing purposes.
Furthermore, a quick way to get one's own process number.
2005-05-27 13:57:00 +00:00
Jorrit Herder c2be104821 Improved NOTIFY system: fixed a minor error, ignore pending notifications
on SENDREC system calls. To be done: resource (buffer pool) management;
make it structurally impossible to run out of buffers.
2005-05-27 12:44:14 +00:00
Jorrit Herder 77c3213948 Optimized scheduling code. Old code is still available withing DEAD_CODE
and NEW_SCHED_Q definitions. Some minor problems are being traced at the
moment. This commit is meant to backup my files.
  --- Jorrit
2005-05-26 13:17:57 +00:00
Jorrit Herder 0899f82ab2 Fixed some minor issues with the NOTIFY call. 2005-05-24 14:35:58 +00:00
Ben Gras 804cb810d0 added a debugging functionality in system/debugging.c (to check sanity of
run queues) and associated prototype in system.h
2005-05-24 12:33:03 +00:00
Ben Gras 168b7f2669 . fixed a recently introduced scheduler (run-queue) bug in proc.c
. a little (optional) debugging code added to proc.c and associated
  data in proc.h
2005-05-24 12:32:34 +00:00
Ben Gras 0f55ebe90a Initialisation required for optional debugging code. 2005-05-24 12:30:51 +00:00
Ben Gras 6a3519f3a8 Added 2 checks to mapping function - one for overflow (virtual address +
size wraparound), one to see if the size fits in the designated segment.

It seems this check wasn't done. This came to light when trying to pre-check
the users buffer for read() and write() in using the vectored virtual
copy system call in servers/fs/read.c.
2005-05-24 12:30:29 +00:00
Jorrit Herder ccd17ecfed New NOTIFY system call! Queued at kernel. Duplicate messages (with same source
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.
2005-05-24 10:06:17 +00:00
Ben Gras cafbbedbba Fix to let FXP driver send messages.
Removed banner talking about the known hang-bug (it's fixed,
practically speaking).
2005-05-20 12:39:36 +00:00
Jorrit Herder d0a5a5d007 New system call added to PM: getprocnr(int *proc_nr) (like getpid);
Minor update to scheduling code (unready().
2005-05-20 09:37:43 +00:00
Jorrit Herder 307c825515 New NOTIFY trap (IPC call) to send queued notification messages.
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.
2005-05-19 14:05:51 +00:00
Philip Homburg 129b82d207 Added fxp driver for the Intel Pro/100 series ethernet cards
Print PC in hex for easier debugging.
2005-05-19 13:27:05 +00:00
Jorrit Herder 1cb880b158 Intermediate update---please await next commit. 2005-05-19 09:36:44 +00:00
Jorrit Herder 614f49b557 Fixed some comments and reorganized some code.
Fixed minor bug in notify() function.
2005-05-18 10:36:23 +00:00
Jorrit Herder 1ecc6bf3b3 Removed 'system process' magic from PM and FS. 2005-05-13 08:57:08 +00:00
Ben Gras d0c3e8f818 . added rm_irq_handler which un-links an irq handler from the linked
list of handlers, callable by irqctl system call
 . workaround for hanging keyboard bug after shutdown.. if key is pressed
   during or after shutdown procedure, keyboard stops working. It looks like
   irq 1 gets stuck high if no keyboard reading is done (e.g. because the
   irq is masked or tty driver has exited). Workaround is to leave irqs
   enabled until the last second, and call shutdown() immediately after the
   last driver has stopped (tty task). This way the chance of an unserviced
   interrupt occuring is negligible.
2005-05-12 16:06:37 +00:00
Jorrit Herder fbe1641bd3 User-space networking!
- RTL8139 driver moved to user-space;
- PCI code moved to user-space;
Fixed IRQ hook dump at IS server.
2005-05-11 09:02:00 +00:00
Jorrit Herder ab39ce451b Fixed some system call checks;
Added SYS_PHYSVCOPY system call;
Fixed IRQ hooks dump in IS server;
2005-05-10 11:06:24 +00:00
Ben Gras 3afa217777 Fixed compiler warnings about kprintf() argument 2005-05-09 08:54:18 +00:00
Ben Gras e8973f33d4 *** empty log message *** 2005-05-04 09:31:54 +00:00
Ben Gras 14b68c70c4 Fixed some compiler breakage (MM_PROC_NR renamed) 2005-05-03 08:54:01 +00:00
Jorrit Herder 83a31f2cda *** empty log message *** 2005-05-02 14:38:21 +00:00
Jorrit Herder ac0995259d *** empty log message *** 2005-05-02 14:30:04 +00:00
Jorrit Herder 89ac678b9b *** empty log message *** 2005-04-29 15:36:43 +00:00
Ben Gras 9865aeaa79 Initial revision 2005-04-21 14:53:53 +00:00