#define MAX_SECS 127 /* but not to a 16 bit process */
#endif
#define MAX_ERRORS 4 /* how often to try rd/wt before quitting */
-#define NR_DEVICES (MAX_DRIVES * DEV_PER_DRIVE)
+#define NR_MINORS (MAX_DRIVES * DEV_PER_DRIVE)
#define SUB_PER_DRIVE (NR_PARTITIONS * NR_PARTITIONS)
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
#define DELAY_USECS 1000 /* controller timeout in microseconds */
/* Prepare for I/O on a device. */
w_device = device;
- if (device < NR_DEVICES) { /* d0, d0p[0-3], d1, ... */
+ if (device < NR_MINORS) { /* d0, d0p[0-3], d1, ... */
w_drive = device / DEV_PER_DRIVE; /* save drive number */
w_wn = &wini[w_drive];
w_dv = &w_wn->part[device % DEV_PER_DRIVE];
/* Parameters for the disk drive. */
#define MAX_DRIVES 4 /* this driver supports 4 drives (d0 - d3)*/
#define MAX_SECS 255 /* bios can transfer this many sectors */
-#define NR_DEVICES (MAX_DRIVES * DEV_PER_DRIVE)
+#define NR_MINORS (MAX_DRIVES * DEV_PER_DRIVE)
#define SUB_PER_DRIVE (NR_PARTITIONS * NR_PARTITIONS)
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
{
/* Prepare for I/O on a device. */
- if (device < NR_DEVICES) { /* d0, d0p[0-3], d1, ... */
+ if (device < NR_MINORS) { /* d0, d0p[0-3], d1, ... */
w_drive = device / DEV_PER_DRIVE; /* save drive number */
w_wn = &wini[w_drive];
w_dv = &w_wn->part[device % DEV_PER_DRIVE];
#include <ansi.h> /* MUST be second */
#include <minix/type.h>
#include <minix/com.h>
+#include <minix/dmap.h>
#include <minix/callnr.h>
#include <sys/types.h>
#include <minix/const.h>
panic("TTY","Couldn't obtain kernel environment.", s);
}
- printf("User-level TTY driver alive!\n");
-
while (TRUE) {
/* Check for and handle any events on any of the ttys. */
# Cleanup.
rm -rf /tmp/. /usr/run/. /usr/spool/lpd/. /usr/spool/locks/.
- echo -n "Starting "
+ # Start servers and drivers set at the boot monitor.
+ echo -n "Starting services:"
up random "" /dev/random
- echo .
# load random number generator
if [ -f $RANDOM_FILE ]
dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1 2> /dev/null
fi
- # Start servers and drivers set at the boot monitor.
- echo -n "Starting services:"
- up rtl8139 ""
- up fxp ""
- up dpeth ""
+ # start only network drivers that are in use
+ for driver in rtl8139 fxp dpeth
+ do
+ if grep " $driver " /etc/inet.conf > /dev/null
+ then
+ up $driver
+ fi
+ done
up inet ""
up is ""
up printer "" /dev/lp
#define NR_BOOT_PROCS (NR_TASKS + INIT_PROC_NR + 1)
-/*===========================================================================*
- * Major and minor device numbers *
- *===========================================================================*/
-
-/* Major and minor device numbers for MEMORY driver. */
-#define MEMORY_MAJOR 1 /* major device for memory devices */
-# define RAM_DEV 0 /* minor device for /dev/ram */
-# define MEM_DEV 1 /* minor device for /dev/mem */
-# define KMEM_DEV 2 /* minor device for /dev/kmem */
-# define NULL_DEV 3 /* minor device for /dev/null */
-# define BOOT_DEV 4 /* minor device for /dev/boot */
-# define ZERO_DEV 6 /* minor device for /dev/zero */
-
-/* Full device numbers that are special to the boot monitor and FS. */
-# define DEV_RAM 0x0100 /* device number of /dev/ram */
-# define DEV_BOOT 0x0104 /* device number of /dev/boot */
-
-#define TTY_MAJOR 4 /* major device for ttys */
-#define CTTY_MAJOR 5 /* major device for /dev/tty */
-
-#define INET_MAJOR 7 /* major device for inet */
-
-#define LOG_MAJOR 15 /* major device for log driver */
-# define IS_KLOG_DEV 0 /* minor device for /dev/klog */
-
-
/*===========================================================================*
* Kernel notification types *
*===========================================================================*/
#include <minix/config.h>
#include <minix/ipc.h>
+/*===========================================================================*
+ * Device <-> Driver Table *
+ *===========================================================================*/
+
/* Device table. This table is indexed by major device number. It provides
* the link between major device numbers and the routines that process them.
* The table can be update dynamically. The field 'dmap_flags' describe an
} dmap[];
+/*===========================================================================*
+ * Major and minor device numbers *
+ *===========================================================================*/
+
+/* Total number of different devices. */
+#define NR_DEVICES 32 /* number of (major) devices */
+
+/* Major and minor device numbers for MEMORY driver. */
+#define MEMORY_MAJOR 1 /* major device for memory devices */
+# define RAM_DEV 0 /* minor device for /dev/ram */
+# define MEM_DEV 1 /* minor device for /dev/mem */
+# define KMEM_DEV 2 /* minor device for /dev/kmem */
+# define NULL_DEV 3 /* minor device for /dev/null */
+# define BOOT_DEV 4 /* minor device for /dev/boot */
+# define ZERO_DEV 6 /* minor device for /dev/zero */
+
+/* Full device numbers that are special to the boot monitor and FS. */
+# define DEV_RAM 0x0100 /* device number of /dev/ram */
+# define DEV_BOOT 0x0104 /* device number of /dev/boot */
+
+#define FLOPPY_MAJOR 2 /* major device for floppy disks */
+#define TTY_MAJOR 4 /* major device for ttys */
+#define CTTY_MAJOR 5 /* major device for /dev/tty */
+
+#define INET_MAJOR 7 /* major device for inet */
+
+#define LOG_MAJOR 15 /* major device for log driver */
+# define IS_KLOG_DEV 0 /* minor device for /dev/klog */
+
+
#endif /* _DMAP_H */
#endif /* (CHIP == INTEL) */
-#if (CHIP == M68000)
-/* Initialize the timer C in the MFP 68901: implement init_clock() here. */
-#endif /* (CHIP == M68000) */
* kernel buffers and to enable or disable debugging code, timing features,
* and individual kernel calls.
*
- * Created: Jul 11, 2005 Jorrit N. Herder
+ * Changes:
+ * Jul 11, 2005 Created. (Jorrit N. Herder)
*/
/* In embedded and sensor applications, not all the kernel calls may be
#ifndef IPC_H
#define IPC_H
+/* This header file defines constants for MINIX inter-process communication.
+ * These definitions are used in the file proc.c.
+ */
#include <minix/com.h>
/* Masks and flags for system calls. */
* user processes share one structure. This setup provides a clear separation
* between common and privileged process fields and is very space efficient.
*
- * Created: Jul 1, 2005 Jorrit N. Herder
+ * Changes:
+ * Jul 01, 2005 Created. (Jorrit N. Herder)
*/
#include <minix/com.h>
#include "protect.h"
* lock_sched: a process has run too long; schedule another one
*
* Changes:
- * Jul 25, 2005 better protection in sys_call() (Jorrit N. Herder)
- * May 26, 2005 optimized message passing functions (Jorrit N. Herder)
+ * Jul 25, 2005 protection and checks in sys_call() (Jorrit N. Herder)
+ * May 26, 2005 rewrite of message passing functions (Jorrit N. Herder)
* May 24, 2005 new, queued NOTIFY system call (Jorrit N. Herder)
* Oct 28, 2004 new, non-blocking SEND and RECEIVE (Jorrit N. Herder)
* Oct 28, 2004 rewrite of sys_call() function (Jorrit N. Herder)
- * Aug 19, 2004 generalized multilevel scheduling (Jorrit N. Herder)
+ * Aug 19, 2004 rewrite of multilevel scheduling (Jorrit N. Herder)
*
* The code here is critical to make everything work and is important for the
* overall performance of the system. A large fraction of the code deals with
U16_t parmoff, U16_t parmsize) );
/* system.c */
+_PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) );
_PROTOTYPE( void send_sig, (int proc_nr, int sig_nr) );
_PROTOTYPE( void cause_sig, (int proc_nr, int sig_nr) );
-_PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) );
-_PROTOTYPE( phys_bytes numap_local, (int proc_nr, vir_bytes vir_addr,
- vir_bytes bytes) );
_PROTOTYPE( void sys_task, (void) );
_PROTOTYPE( void get_randomness, (int source) );
_PROTOTYPE( int virtual_copy, (struct vir_addr *src, struct vir_addr *dst,
vir_bytes bytes) );
+#define numap_local(proc_nr, vir_addr, bytes) \
+ umap_local(proc_addr(proc_nr), D, (vir_addr), (bytes))
_PROTOTYPE( phys_bytes umap_local, (struct proc *rp, int seg,
vir_bytes vir_addr, vir_bytes bytes) );
_PROTOTYPE( phys_bytes umap_remote, (struct proc *rp, int seg,
* umap_local: map virtual address in LOCAL_SEG to physical
* umap_remote: map virtual address in REMOTE_SEG to physical
* umap_bios: map virtual address in BIOS_SEG to physical
- * numap_local: umap_local D segment from proc nr instead of pointer
* virtual_copy: copy bytes from one virtual address to another
* get_randomness: accumulate randomness in a buffer
*
* Changes:
+ * 2004 to 2005 many new system calls (see system.h) (Jorrit N. Herder)
+ * Jul 20, 2005 send signal to services with message (Jorrit N. Herder)
+ * Jan 15, 2005 new, generalized virtual copy function (Jorrit N. Herder)
* Oct 10, 2004 dispatch system calls from call vector (Jorrit N. Herder)
* Sep 30, 2004 source code documentation updated (Jorrit N. Herder)
- * 2004 to 2005 various new syscalls (see system.h) (Jorrit N. Herder)
*/
#include "kernel.h"
call_vec[i] = do_unused;
}
+ /* Process management. */
map(SYS_FORK, do_fork); /* a process forked a new process */
- map(SYS_NEWMAP, do_newmap); /* set up a process memory map */
map(SYS_EXEC, do_exec); /* update process after execute */
map(SYS_EXIT, do_exit); /* clean up after process exit */
map(SYS_NICE, do_nice); /* set scheduling priority */
+ map(SYS_PRIVCTL, do_privctl); /* system privileges control */
map(SYS_TRACE, do_trace); /* request a trace operation */
/* Signal handling. */
map(SYS_SIGSEND, do_sigsend); /* start POSIX-style signal */
map(SYS_SIGRETURN, do_sigreturn); /* return from POSIX-style signal */
- /* Clock functionality. */
- map(SYS_TIMES, do_times); /* get uptime and process times */
- map(SYS_SETALARM, do_setalarm); /* schedule a synchronous alarm */
-
/* Device I/O. */
map(SYS_IRQCTL, do_irqctl); /* interrupt control operations */
map(SYS_DEVIO, do_devio); /* inb, inw, inl, outb, outw, outl */
map(SYS_SDEVIO, do_sdevio); /* phys_insb, _insw, _outsb, _outsw */
map(SYS_VDEVIO, do_vdevio); /* vector with devio requests */
- map(SYS_INT86, do_int86); /* BIOS call */
+ map(SYS_INT86, do_int86); /* real-mode BIOS calls */
- /* System control. */
- map(SYS_ABORT, do_abort); /* abort MINIX */
- map(SYS_GETINFO, do_getinfo); /* request system information */
- map(SYS_PRIVCTL, do_privctl); /* system privileges control */
+ /* Memory management. */
+ map(SYS_NEWMAP, do_newmap); /* set up a process memory map */
map(SYS_SEGCTL, do_segctl); /* add segment and get selector */
+ map(SYS_MEMSET, do_memset); /* write char to memory area */
/* Copying. */
map(SYS_UMAP, do_umap); /* map virtual to physical address */
map(SYS_PHYSCOPY, do_physcopy); /* use physical addressing */
map(SYS_VIRVCOPY, do_virvcopy); /* vector with copy requests */
map(SYS_PHYSVCOPY, do_physvcopy); /* vector with copy requests */
- map(SYS_MEMSET, do_memset); /* write char to memory area */
+
+ /* Clock functionality. */
+ map(SYS_TIMES, do_times); /* get uptime and process times */
+ map(SYS_SETALARM, do_setalarm); /* schedule a synchronous alarm */
+
+ /* System control. */
+ map(SYS_ABORT, do_abort); /* abort MINIX */
+ map(SYS_GETINFO, do_getinfo); /* request system information */
}
} else {
rc->p_priv = &priv[USER_PRIV_ID]; /* use shared slot */
rc->p_priv->s_proc_nr = INIT_PROC_NR; /* set association */
+ rc->p_priv->s_flags = 0; /* no initial flags */
}
return(OK);
}
PUBLIC void get_randomness(source)
int source;
{
-/* Gather random information with help of the CPU's cycle counter. Only use
- * the lowest bytes because the highest bytes won't differ that much.
- */
+/* On machines with the RDTSC (cycle counter read instruction - pentium
+ * and up), use that for high-resolution raw entropy gathering. Otherwise,
+ * use the realtime clock (tick resolution).
+ *
+ * Unfortunately this test is run-time - we don't want to bother with
+ * compiling different kernels for different machines.
+ *
+ * On machines without RDTSC, we use read_clock().
+ */
int r_next;
unsigned long tsc_high, tsc_low;
- /* On machines with the RDTSC (cycle counter read instruction - pentium
- * and up), use that for high-resolution raw entropy gathering. Otherwise,
- * use the realtime clock (tick resolution).
- *
- * Unfortunately this test is run-time - we don't want to bother with
- * compiling different kernels for different machines..
- *
- * On machines without RDTSC, we use read_clock().
- */
source %= RANDOM_SOURCES;
r_next= krandom.bin[source].r_next;
if(machine.processor > 486) {
else if (vir_addr >= BASE_MEM_TOP && vir_addr + bytes <= UPPER_MEM_END)
return (phys_bytes) vir_addr;
-#if DEAD_CODE /* brutal fix for QEMU and Bochs, if above doesn't work */
+#if DEAD_CODE /* brutal fix, if the above is too restrictive */
if (vir_addr >= BIOS_MEM_BEGIN && vir_addr + bytes <= UPPER_MEM_END)
return (phys_bytes) vir_addr;
#endif
#endif
}
-/*==========================================================================*
- * numap_local *
- *==========================================================================*/
-PUBLIC phys_bytes numap_local(proc_nr, vir_addr, bytes)
-int proc_nr; /* process number to be mapped */
-vir_bytes vir_addr; /* virtual address in bytes within D seg */
-vir_bytes bytes; /* # of bytes required in segment */
-{
-/* Do umap_local() starting from a process number instead of a pointer.
- * This function is used by device drivers, so they need not know about the
- * process table. To save time, there is no 'seg' parameter. The segment
- * is always D.
- */
- return(umap_local(proc_addr(proc_nr), D, vir_addr, bytes));
-}
-
/*===========================================================================*
* umap_remote *
/* Common includes for the system library. */
#include "kernel.h"
+#include "proto.h"
#include "proc.h"
/* Default handler for unused kernel calls. */
* m_type: SYS_DEVIO
*
* The parameters for this system call are:
- * m2_i3: DIO_REQUEST (request input or output)
- * m2_i1: DIO_TYPE (flag indicating byte, word, or long)
- * m2_l1: DIO_PORT (port to read/ write)
- * m2_l2: DIO_VALUE (value to write/ return value read)
- *
- * Author:
- * Jorrit N. Herder <jnherder@cs.vu.nl>
+ * m2_i3: DIO_REQUEST (request input or output)
+ * m2_i1: DIO_TYPE (flag indicating byte, word, or long)
+ * m2_l1: DIO_PORT (port to read/ write)
+ * m2_l2: DIO_VALUE (value to write/ return value read)
*/
#include "../system.h"
rpc = proc_addr(m_ptr->PR_PROC_NR);
if (isemptyp(rpp) || ! isemptyp(rpc)) return(EINVAL);
-#if DEAD_CODE
- /* If the parent is a privileged process, ensure the child process also gets
- * its own privilege structure for accounting. This is the only part that can
- * fail, so do this before allocating the process table slot.
- */
- if (priv(rpp)->s_flags & SYS_PROC) {
- if (OK != (i=get_priv(rpc, SYS_PROC))) return(i); /* get structure */
- for (i=0; i< BITMAP_CHUNKS(NR_SYS_PROCS); i++) /* remove pending: */
- priv(rpc)->s_notify_pending.chunk[i] = 0; /* - notifications */
- priv(rpc)->s_int_pending = 0; /* - interrupts */
- sigemptyset(&priv(rpc)->s_sig_pending); /* - signals */
- }
-#endif
-
/* Copy parent 'proc' struct to child. And reinitialize some fields. */
#if (CHIP == INTEL)
old_ldt_sel = rpc->p_ldt_sel; /* backup local descriptors */
* m1_i1: I_VAL_LEN (maximum length expected, optional)
* m1_p2: I_VAL_PTR2 (second, optional pointer)
* m1_i2: I_VAL_LEN2 (second length or process nr)
- *
- * Author:
- * Jorrit N. Herder <jnherder@cs.vu.nl>
*/
#include "../system.h"
* m5_i1: IRQ_POLICY (irq policy allows reenabling interrupts)
* m5_l3: IRQ_HOOK_ID (provides index to be returned on interrupt)
* ,, ,, (returns index of irq hook assigned at kernel)
- *
- * Author:
- * Jorrit N. Herder <jnherder@cs.vu.nl>
*/
#include "../system.h"
*/
if ((i=get_priv(rp, SYS_PROC)) != OK) return(i);
priv_id = priv(rp)->s_id; /* backup privilege id */
- *priv(rp) = *priv(caller_ptr); /* copy privileges */
+ *priv(rp) = *priv(caller_ptr); /* copy from caller */
priv(rp)->s_id = priv_id; /* restore privilege id */
priv(rp)->s_proc_nr = proc_nr; /* reassociate process nr */
* m4_l1: SEG_SELECT (return segment selector here)
* m4_l2: SEG_OFFSET (return offset within segment here)
* m4_l5: SEG_INDEX (return index into remote memory map here)
- *
- * Author:
- * Jorrit N. Herder <jnherder@cs.vu.nl>
*/
#include "../system.h"
#include "../protect.h"
* include 'boot_image' (this file) and 'idt' and 'gdt' (protect.c).
*
* Changes:
- * Nov 10, 2004 removed controller->driver mappings (Jorrit N. Herder)
+ * Aug 02, 2005 minimal boot image and cleanup (Jorrit N. Herder)
* Oct 17, 2004 updated above and tasktab comments (Jorrit N. Herder)
* May 01, 2004 changed struct for system image (Jorrit N. Herder)
*/
/* Define stack sizes for the kernel tasks included in the system image. */
#define NO_STACK 0
#define SMALL_STACK (128 * sizeof(char *))
-#define IDLE_S SMALL_STACK /* 3 intr, 3 temps, 4 db for Intel */
-#define HRDW_S NO_STACK /* dummy task, uses kernel stack */
-#define TASK_S SMALL_STACK /* system and clock task */
+#define IDL_S SMALL_STACK /* 3 intr, 3 temps, 4 db for Intel */
+#define HRD_S NO_STACK /* dummy task, uses kernel stack */
+#define TSK_S SMALL_STACK /* system and clock task */
/* Stack space for all the task stacks. Declared as (char *) to align it. */
-#define TOT_STACK_SPACE (IDLE_S + HRDW_S + (2 * TASK_S))
+#define TOT_STACK_SPACE (IDL_S + HRD_S + (2 * TSK_S))
PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)];
/* Define flags for the various process types. */
-#define IDLE_F (BILLABLE | SYS_PROC) /* idle task */
-#define TASK_F (SYS_PROC) /* kernel tasks */
-#define SERV_F (PREEMPTIBLE | SYS_PROC) /* system services */
-#define USER_F (PREEMPTIBLE | BILLABLE) /* user processes */
+#define IDL_F (BILLABLE | SYS_PROC) /* idle task */
+#define TSK_F (SYS_PROC) /* kernel tasks */
+#define SRV_F (PREEMPTIBLE | SYS_PROC) /* system services */
+#define USR_F (PREEMPTIBLE | BILLABLE) /* user processes */
/* Define system call traps for the various process types. These call masks
* determine what system call traps a process is allowed to make.
*/
-#define TASK_T (1 << RECEIVE) /* clock and system */
-#define SERV_T (~0) /* system services */
-#define USER_T ((1 << SENDREC) | (1 << ECHO)) /* user processes */
+#define TSK_T (1 << RECEIVE) /* clock and system */
+#define SRV_T (~0) /* system services */
+#define USR_T ((1 << SENDREC) | (1 << ECHO)) /* user processes */
/* Send masks determine to whom processes can send messages or notifications.
* The values here are used for the processes in the boot image. We rely on
* "BITCHUNK_BITS - NR_TASKS", because a bitchunk_t field is used to store
* the send masks in the table that describes that processes in the image.
*/
-#define SERV_M (~0)
-#define SYST_M (~0)
-#define USER_M (s(PM_PROC_NR)|s(FS_PROC_NR)|s(SM_PROC_NR))
-#define DRIV_M (USER_M | \
- s(SYSTEM)|s(CLOCK)|s(LOG_PROC_NR)|s(TTY_PROC_NR))
+#define SRV_M (~0)
+#define SYS_M (~0)
+#define USR_M (s(PM_PROC_NR)|s(FS_PROC_NR)|s(SM_PROC_NR))
+#define DRV_M (USR_M | s(SYSTEM)|s(CLOCK)|s(LOG_PROC_NR)|s(TTY_PROC_NR))
/* Sanity check to make sure the send masks can be set. */
extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1];
* initial program counter and stack size is also provided for kernel tasks.
*/
PUBLIC struct boot_image image[] = {
-/* process nr, pc, flags, qs, queue, stack, traps, ipc mask, name */
- { IDLE, idle_task, IDLE_F, 32, IDLE_Q, IDLE_S, 0, 0, "IDLE" },
- { CLOCK, clock_task, TASK_F, 0, TASK_Q, TASK_S, TASK_T, 0, "CLOCK" },
- { SYSTEM, sys_task, TASK_F, 0, TASK_Q, TASK_S, TASK_T, 0, "SYSTEM" },
- { HARDWARE, 0, TASK_F, 0, TASK_Q, HRDW_S, 0, 0, "KERNEL" },
- { PM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SERV_M, "pm" },
- { FS_PROC_NR, 0, SERV_F, 16, 4, 0, SERV_T, SERV_M, "fs" },
- { SM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SYST_M, "sm" },
- { TTY_PROC_NR, 0, SERV_F, 16, 1, 0, SERV_T, SYST_M, "tty" },
- { MEM_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "memory" },
- { LOG_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, SYST_M, "log" },
- { DRVR_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "driver" },
- { INIT_PROC_NR, 0, USER_F, 8, USER_Q, 0, USER_T, USER_M, "init" },
+/* process nr, pc, flags, qs, queue, stack, traps, ipc, sys, name */
+ { IDLE, idle_task, IDL_F, 32, IDLE_Q, IDL_S, 0, 0, 0, "IDLE" },
+ { CLOCK,clock_task, TSK_F, 0, TASK_Q, TSK_S, TSK_T, 0, 0, "CLOCK" },
+ { SYSTEM, sys_task, TSK_F, 0, TASK_Q, TSK_S, TSK_T, 0, 0, "SYSTEM" },
+ { HARDWARE, 0, TSK_F, 0, TASK_Q, HRD_S, 0, 0, 0, "KERNEL" },
+ { PM_PROC_NR, 0, SRV_F, 16, 3, 0, SRV_T, SRV_M, ~0, "pm" },
+ { FS_PROC_NR, 0, SRV_F, 16, 4, 0, SRV_T, SRV_M, ~0, "fs" },
+ { SM_PROC_NR, 0, SRV_F, 16, 3, 0, SRV_T, SYS_M, ~0, "sm" },
+ { TTY_PROC_NR, 0, SRV_F, 16, 1, 0, SRV_T, SYS_M, ~0, "tty" },
+ { MEM_PROC_NR, 0, SRV_F, 16, 2, 0, SRV_T, DRV_M, ~0, "memory" },
+ { LOG_PROC_NR, 0, SRV_F, 16, 2, 0, SRV_T, SYS_M, ~0, "log" },
+ { DRVR_PROC_NR, 0, SRV_F, 16, 2, 0, SRV_T, DRV_M, ~0, "driver" },
+ { INIT_PROC_NR, 0, USR_F, 8, USER_Q, 0, USR_T, USR_M, 0, "init" },
};
/* Verify the size of the system image table at compile time. If the number
char quantum; /* quantum (tick count) */
int priority; /* scheduling priority */
int stksize; /* stack size for tasks */
- short call_mask; /* allowed system calls */
+ short call_mask; /* allowed system call traps */
bitchunk_t send_mask; /* send mask protection */
+ long sys_mask; /* system call protection */
char proc_name[P_NAME_LEN]; /* name in process table */
};
/* This file contains a collection of miscellaneous procedures:
- * panic: abort MINIX due to a fatal error
- * kprintf: diagnostic output for the kernel
+ * panic: abort MINIX due to a fatal error
+ * kprintf: diagnostic output for the kernel
*
* Changes:
- * simple printing to circular buffer (Jorrit N. Herder)
+ * Dec 10, 2004 kernel printing to circular buffer (Jorrit N. Herder)
*
* This file contains the routines that take care of kernel messages, i.e.,
* diagnostic output within the kernel. Kernel messages are not directly
#define NR_SUPERS 8 /* # slots in super block table */
#define NR_LOCKS 8 /* # slots in the file locking table */
-#define NR_DEVICES 17 /* # slots in the device <-> driver table */
-
/* The type of sizeof may be (unsigned) long. Use the following macro for
* taking the sizes of small objects so that there are no surprises like
* (small) long constants being passed to routines expecting an int.
}
/*===========================================================================*
- * map_controllers *
+ * map_controller *
*===========================================================================*/
-PUBLIC void map_controllers()
+PUBLIC void map_controller()
{
-/* Map the boot drivers to a controller and update the dmap table to that
+/* Map the boot driver to a controller and update the dmap table to that
* selection. The boot driver and the controller it handles are set at the
* boot monitor.
*/
char driver[16];
char *controller = "c##";
- int number;
+ int nr, major = -1;
int i,s;
+
+ /* Get settings of 'controller' and 'driver' at the boot monitor. */
if ((s = get_mon_param("label", driver, sizeof(driver))) != OK)
panic(__FILE__,"couldn't get boot monitor parameter 'driver'", s);
if ((s = get_mon_param("controller", controller, sizeof(controller))) != OK)
panic(__FILE__,"couldn't get boot monitor parameter 'controller'", s);
- if (controller[0] != 'c' || ! isdigit(controller[1]))
- panic(__FILE__,"monitor parameter 'controller' syntax is 'c#'", NO_NUM);
- if ((number = (unsigned) atoi(&controller[1])) > NR_CTRLRS)
- panic(__FILE__,"monitor parameter 'controller' maximum is", NR_CTRLRS);
-
- for (i=0; i< NR_DEVICES; i++) { /* find controller */
- if (dmap[i].dmap_driver == CTRLR(number)) {
- if ((s=map_driver(i, DRVR_PROC_NR, STYLE_DEV)) != OK)
- panic(__FILE__,"map_driver failed",s);
- printf("Boot medium driver: %s driver mapped onto controller c%d.\n",
- driver, number);
- return; /* success! */
+
+ /* Determine major number to map driver onto. */
+ if (controller[0] == 'f' && controller[1] == 'd') {
+ major = FLOPPY_MAJOR;
+ }
+ else if (controller[0] == 'c' && isdigit(controller[1])) {
+ if ((nr = (unsigned) atoi(&controller[1])) > NR_CTRLRS)
+ panic(__FILE__,"monitor 'controller' maximum 'c#' is", NR_CTRLRS);
+ for (i=0; i< NR_DEVICES; i++) { /* find controller */
+ if (dmap[i].dmap_driver == CTRLR(nr)) {
+ major = i;
+ break;
+ }
}
+ if ((unsigned) major >= NR_DEVICES)
+ panic(__FILE__, "cannot find controller in dmap, number", nr);
+ }
+ else {
+ panic(__FILE__,"monitor 'controller' syntax is 'c#' of 'fd'", NO_NUM);
}
- panic(__FILE__, "cannot find controller in dmap, number", number);
+
+ /* Now try to set the actual mapping and report to the user. */
+ if ((s=map_driver(i, DRVR_PROC_NR, STYLE_DEV)) != OK)
+ panic(__FILE__,"map_driver failed",s);
+ printf("Boot medium driver: %s driver mapped onto controller %s.\n",
+ driver, controller);
}
who = FS_PROC_NR;
buf_pool(); /* initialize buffer pool */
- map_controllers(); /* map controller devices to drivers */
+ map_controller(); /* map boot driver onto controller */
load_ram(); /* init RAM disk, load if it is root */
load_super(root_dev); /* load super block for root device */
init_select(); /* init select() structures */
/* dmap.c */
_PROTOTYPE( int do_devctl, (void) );
-_PROTOTYPE( void map_controllers, (void) );
+_PROTOTYPE( void map_controller, (void) );
_PROTOTYPE( int map_driver, (int major, int proc_nr, int dev_style) );
/* filedes.c */
../drivers/log/log \
AT:../drivers/at_wini/at_wini \
BIOS:../drivers/bios_wini/bios_wini \
+ FLOPPY:../drivers/floppy/floppy \
../servers/init/init \
# bootdev.img