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?)
This commit is contained in:
parent
5e3b213f05
commit
e561081545
29 changed files with 163 additions and 178 deletions
|
@ -149,7 +149,7 @@ struct command {
|
||||||
#define MAX_SECS 127 /* but not to a 16 bit process */
|
#define MAX_SECS 127 /* but not to a 16 bit process */
|
||||||
#endif
|
#endif
|
||||||
#define MAX_ERRORS 4 /* how often to try rd/wt before quitting */
|
#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 SUB_PER_DRIVE (NR_PARTITIONS * NR_PARTITIONS)
|
||||||
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
|
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
|
||||||
#define DELAY_USECS 1000 /* controller timeout in microseconds */
|
#define DELAY_USECS 1000 /* controller timeout in microseconds */
|
||||||
|
@ -392,7 +392,7 @@ int device;
|
||||||
/* Prepare for I/O on a device. */
|
/* Prepare for I/O on a device. */
|
||||||
|
|
||||||
w_device = 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_drive = device / DEV_PER_DRIVE; /* save drive number */
|
||||||
w_wn = &wini[w_drive];
|
w_wn = &wini[w_drive];
|
||||||
w_dv = &w_wn->part[device % DEV_PER_DRIVE];
|
w_dv = &w_wn->part[device % DEV_PER_DRIVE];
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
/* Parameters for the disk drive. */
|
/* Parameters for the disk drive. */
|
||||||
#define MAX_DRIVES 4 /* this driver supports 4 drives (d0 - d3)*/
|
#define MAX_DRIVES 4 /* this driver supports 4 drives (d0 - d3)*/
|
||||||
#define MAX_SECS 255 /* bios can transfer this many sectors */
|
#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 SUB_PER_DRIVE (NR_PARTITIONS * NR_PARTITIONS)
|
||||||
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
|
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ int device;
|
||||||
{
|
{
|
||||||
/* Prepare for I/O on a device. */
|
/* 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_drive = device / DEV_PER_DRIVE; /* save drive number */
|
||||||
w_wn = &wini[w_drive];
|
w_wn = &wini[w_drive];
|
||||||
w_dv = &w_wn->part[device % DEV_PER_DRIVE];
|
w_dv = &w_wn->part[device % DEV_PER_DRIVE];
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <ansi.h> /* MUST be second */
|
#include <ansi.h> /* MUST be second */
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
#include <minix/com.h>
|
#include <minix/com.h>
|
||||||
|
#include <minix/dmap.h>
|
||||||
#include <minix/callnr.h>
|
#include <minix/callnr.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <minix/const.h>
|
#include <minix/const.h>
|
||||||
|
|
|
@ -181,8 +181,6 @@ PUBLIC void main(void)
|
||||||
panic("TTY","Couldn't obtain kernel environment.", s);
|
panic("TTY","Couldn't obtain kernel environment.", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("User-level TTY driver alive!\n");
|
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
|
||||||
/* Check for and handle any events on any of the ttys. */
|
/* Check for and handle any events on any of the ttys. */
|
||||||
|
|
17
etc/usr/rc
17
etc/usr/rc
|
@ -62,9 +62,9 @@ start)
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
rm -rf /tmp/. /usr/run/. /usr/spool/lpd/. /usr/spool/locks/.
|
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
|
up random "" /dev/random
|
||||||
echo .
|
|
||||||
|
|
||||||
# load random number generator
|
# load random number generator
|
||||||
if [ -f $RANDOM_FILE ]
|
if [ -f $RANDOM_FILE ]
|
||||||
|
@ -74,11 +74,14 @@ start)
|
||||||
dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1 2> /dev/null
|
dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start servers and drivers set at the boot monitor.
|
# start only network drivers that are in use
|
||||||
echo -n "Starting services:"
|
for driver in rtl8139 fxp dpeth
|
||||||
up rtl8139 ""
|
do
|
||||||
up fxp ""
|
if grep " $driver " /etc/inet.conf > /dev/null
|
||||||
up dpeth ""
|
then
|
||||||
|
up $driver
|
||||||
|
fi
|
||||||
|
done
|
||||||
up inet ""
|
up inet ""
|
||||||
up is ""
|
up is ""
|
||||||
up printer "" /dev/lp
|
up printer "" /dev/lp
|
||||||
|
|
|
@ -48,32 +48,6 @@
|
||||||
#define NR_BOOT_PROCS (NR_TASKS + INIT_PROC_NR + 1)
|
#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 *
|
* Kernel notification types *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
#include <minix/config.h>
|
#include <minix/config.h>
|
||||||
#include <minix/ipc.h>
|
#include <minix/ipc.h>
|
||||||
|
|
||||||
|
/*===========================================================================*
|
||||||
|
* Device <-> Driver Table *
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
/* Device table. This table is indexed by major device number. It provides
|
/* 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 link between major device numbers and the routines that process them.
|
||||||
* The table can be update dynamically. The field 'dmap_flags' describe an
|
* The table can be update dynamically. The field 'dmap_flags' describe an
|
||||||
|
@ -22,4 +26,34 @@ extern struct dmap {
|
||||||
} dmap[];
|
} 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 /* _DMAP_H */
|
||||||
|
|
|
@ -297,8 +297,5 @@ PUBLIC unsigned long read_clock()
|
||||||
|
|
||||||
#endif /* (CHIP == INTEL) */
|
#endif /* (CHIP == INTEL) */
|
||||||
|
|
||||||
#if (CHIP == M68000)
|
|
||||||
/* Initialize the timer C in the MFP 68901: implement init_clock() here. */
|
|
||||||
#endif /* (CHIP == M68000) */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
* kernel buffers and to enable or disable debugging code, timing features,
|
* kernel buffers and to enable or disable debugging code, timing features,
|
||||||
* and individual kernel calls.
|
* 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
|
/* In embedded and sensor applications, not all the kernel calls may be
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef IPC_H
|
#ifndef IPC_H
|
||||||
#define 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>
|
#include <minix/com.h>
|
||||||
|
|
||||||
/* Masks and flags for system calls. */
|
/* Masks and flags for system calls. */
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
* user processes share one structure. This setup provides a clear separation
|
* user processes share one structure. This setup provides a clear separation
|
||||||
* between common and privileged process fields and is very space efficient.
|
* 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 <minix/com.h>
|
||||||
#include "protect.h"
|
#include "protect.h"
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
* lock_sched: a process has run too long; schedule another one
|
* lock_sched: a process has run too long; schedule another one
|
||||||
*
|
*
|
||||||
* Changes:
|
* Changes:
|
||||||
* Jul 25, 2005 better protection in sys_call() (Jorrit N. Herder)
|
* Jul 25, 2005 protection and checks in sys_call() (Jorrit N. Herder)
|
||||||
* May 26, 2005 optimized message passing functions (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)
|
* 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 new, non-blocking SEND and RECEIVE (Jorrit N. Herder)
|
||||||
* Oct 28, 2004 rewrite of sys_call() function (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
|
* 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
|
* overall performance of the system. A large fraction of the code deals with
|
||||||
|
|
|
@ -36,15 +36,15 @@ _PROTOTYPE( void cstart, (U16_t cs, U16_t ds, U16_t mds,
|
||||||
U16_t parmoff, U16_t parmsize) );
|
U16_t parmoff, U16_t parmsize) );
|
||||||
|
|
||||||
/* system.c */
|
/* 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 send_sig, (int proc_nr, int sig_nr) );
|
||||||
_PROTOTYPE( void cause_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 sys_task, (void) );
|
||||||
_PROTOTYPE( void get_randomness, (int source) );
|
_PROTOTYPE( void get_randomness, (int source) );
|
||||||
_PROTOTYPE( int virtual_copy, (struct vir_addr *src, struct vir_addr *dst,
|
_PROTOTYPE( int virtual_copy, (struct vir_addr *src, struct vir_addr *dst,
|
||||||
vir_bytes bytes) );
|
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,
|
_PROTOTYPE( phys_bytes umap_local, (struct proc *rp, int seg,
|
||||||
vir_bytes vir_addr, vir_bytes bytes) );
|
vir_bytes vir_addr, vir_bytes bytes) );
|
||||||
_PROTOTYPE( phys_bytes umap_remote, (struct proc *rp, int seg,
|
_PROTOTYPE( phys_bytes umap_remote, (struct proc *rp, int seg,
|
||||||
|
|
|
@ -17,14 +17,15 @@
|
||||||
* umap_local: map virtual address in LOCAL_SEG to physical
|
* umap_local: map virtual address in LOCAL_SEG to physical
|
||||||
* umap_remote: map virtual address in REMOTE_SEG to physical
|
* umap_remote: map virtual address in REMOTE_SEG to physical
|
||||||
* umap_bios: map virtual address in BIOS_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
|
* virtual_copy: copy bytes from one virtual address to another
|
||||||
* get_randomness: accumulate randomness in a buffer
|
* get_randomness: accumulate randomness in a buffer
|
||||||
*
|
*
|
||||||
* Changes:
|
* 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)
|
* Oct 10, 2004 dispatch system calls from call vector (Jorrit N. Herder)
|
||||||
* Sep 30, 2004 source code documentation updated (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"
|
#include "kernel.h"
|
||||||
|
@ -121,11 +122,12 @@ PRIVATE void initialize(void)
|
||||||
call_vec[i] = do_unused;
|
call_vec[i] = do_unused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Process management. */
|
||||||
map(SYS_FORK, do_fork); /* a process forked a new process */
|
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_EXEC, do_exec); /* update process after execute */
|
||||||
map(SYS_EXIT, do_exit); /* clean up after process exit */
|
map(SYS_EXIT, do_exit); /* clean up after process exit */
|
||||||
map(SYS_NICE, do_nice); /* set scheduling priority */
|
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 */
|
map(SYS_TRACE, do_trace); /* request a trace operation */
|
||||||
|
|
||||||
/* Signal handling. */
|
/* Signal handling. */
|
||||||
|
@ -135,22 +137,17 @@ PRIVATE void initialize(void)
|
||||||
map(SYS_SIGSEND, do_sigsend); /* start POSIX-style signal */
|
map(SYS_SIGSEND, do_sigsend); /* start POSIX-style signal */
|
||||||
map(SYS_SIGRETURN, do_sigreturn); /* return from 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. */
|
/* Device I/O. */
|
||||||
map(SYS_IRQCTL, do_irqctl); /* interrupt control operations */
|
map(SYS_IRQCTL, do_irqctl); /* interrupt control operations */
|
||||||
map(SYS_DEVIO, do_devio); /* inb, inw, inl, outb, outw, outl */
|
map(SYS_DEVIO, do_devio); /* inb, inw, inl, outb, outw, outl */
|
||||||
map(SYS_SDEVIO, do_sdevio); /* phys_insb, _insw, _outsb, _outsw */
|
map(SYS_SDEVIO, do_sdevio); /* phys_insb, _insw, _outsb, _outsw */
|
||||||
map(SYS_VDEVIO, do_vdevio); /* vector with devio requests */
|
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. */
|
/* Memory management. */
|
||||||
map(SYS_ABORT, do_abort); /* abort MINIX */
|
map(SYS_NEWMAP, do_newmap); /* set up a process memory map */
|
||||||
map(SYS_GETINFO, do_getinfo); /* request system information */
|
|
||||||
map(SYS_PRIVCTL, do_privctl); /* system privileges control */
|
|
||||||
map(SYS_SEGCTL, do_segctl); /* add segment and get selector */
|
map(SYS_SEGCTL, do_segctl); /* add segment and get selector */
|
||||||
|
map(SYS_MEMSET, do_memset); /* write char to memory area */
|
||||||
|
|
||||||
/* Copying. */
|
/* Copying. */
|
||||||
map(SYS_UMAP, do_umap); /* map virtual to physical address */
|
map(SYS_UMAP, do_umap); /* map virtual to physical address */
|
||||||
|
@ -158,7 +155,14 @@ PRIVATE void initialize(void)
|
||||||
map(SYS_PHYSCOPY, do_physcopy); /* use physical addressing */
|
map(SYS_PHYSCOPY, do_physcopy); /* use physical addressing */
|
||||||
map(SYS_VIRVCOPY, do_virvcopy); /* vector with copy requests */
|
map(SYS_VIRVCOPY, do_virvcopy); /* vector with copy requests */
|
||||||
map(SYS_PHYSVCOPY, do_physvcopy); /* 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 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +188,7 @@ int proc_type; /* system or user process flag */
|
||||||
} else {
|
} else {
|
||||||
rc->p_priv = &priv[USER_PRIV_ID]; /* use shared slot */
|
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_proc_nr = INIT_PROC_NR; /* set association */
|
||||||
|
rc->p_priv->s_flags = 0; /* no initial flags */
|
||||||
}
|
}
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
@ -195,21 +200,18 @@ int proc_type; /* system or user process flag */
|
||||||
PUBLIC void get_randomness(source)
|
PUBLIC void get_randomness(source)
|
||||||
int source;
|
int source;
|
||||||
{
|
{
|
||||||
/* Gather random information with help of the CPU's cycle counter. Only use
|
/* On machines with the RDTSC (cycle counter read instruction - pentium
|
||||||
* the lowest bytes because the highest bytes won't differ that much.
|
* 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;
|
int r_next;
|
||||||
unsigned long tsc_high, tsc_low;
|
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;
|
source %= RANDOM_SOURCES;
|
||||||
r_next= krandom.bin[source].r_next;
|
r_next= krandom.bin[source].r_next;
|
||||||
if(machine.processor > 486) {
|
if(machine.processor > 486) {
|
||||||
|
@ -300,7 +302,7 @@ vir_bytes bytes; /* # of bytes to be copied */
|
||||||
else if (vir_addr >= BASE_MEM_TOP && vir_addr + bytes <= UPPER_MEM_END)
|
else if (vir_addr >= BASE_MEM_TOP && vir_addr + bytes <= UPPER_MEM_END)
|
||||||
return (phys_bytes) vir_addr;
|
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)
|
if (vir_addr >= BIOS_MEM_BEGIN && vir_addr + bytes <= UPPER_MEM_END)
|
||||||
return (phys_bytes) vir_addr;
|
return (phys_bytes) vir_addr;
|
||||||
#endif
|
#endif
|
||||||
|
@ -368,22 +370,6 @@ vir_bytes bytes; /* # of bytes to be copied */
|
||||||
#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 *
|
* umap_remote *
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
/* Common includes for the system library. */
|
/* Common includes for the system library. */
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
#include "proto.h"
|
||||||
#include "proc.h"
|
#include "proc.h"
|
||||||
|
|
||||||
/* Default handler for unused kernel calls. */
|
/* Default handler for unused kernel calls. */
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
* m_type: SYS_DEVIO
|
* m_type: SYS_DEVIO
|
||||||
*
|
*
|
||||||
* The parameters for this system call are:
|
* The parameters for this system call are:
|
||||||
* m2_i3: DIO_REQUEST (request input or output)
|
* m2_i3: DIO_REQUEST (request input or output)
|
||||||
* m2_i1: DIO_TYPE (flag indicating byte, word, or long)
|
* m2_i1: DIO_TYPE (flag indicating byte, word, or long)
|
||||||
* m2_l1: DIO_PORT (port to read/ write)
|
* m2_l1: DIO_PORT (port to read/ write)
|
||||||
* m2_l2: DIO_VALUE (value to write/ return value read)
|
* m2_l2: DIO_VALUE (value to write/ return value read)
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Jorrit N. Herder <jnherder@cs.vu.nl>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../system.h"
|
#include "../system.h"
|
||||||
|
|
|
@ -32,20 +32,6 @@ register message *m_ptr; /* pointer to request message */
|
||||||
rpc = proc_addr(m_ptr->PR_PROC_NR);
|
rpc = proc_addr(m_ptr->PR_PROC_NR);
|
||||||
if (isemptyp(rpp) || ! isemptyp(rpc)) return(EINVAL);
|
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. */
|
/* Copy parent 'proc' struct to child. And reinitialize some fields. */
|
||||||
#if (CHIP == INTEL)
|
#if (CHIP == INTEL)
|
||||||
old_ldt_sel = rpc->p_ldt_sel; /* backup local descriptors */
|
old_ldt_sel = rpc->p_ldt_sel; /* backup local descriptors */
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
* m1_i1: I_VAL_LEN (maximum length expected, optional)
|
* m1_i1: I_VAL_LEN (maximum length expected, optional)
|
||||||
* m1_p2: I_VAL_PTR2 (second, optional pointer)
|
* m1_p2: I_VAL_PTR2 (second, optional pointer)
|
||||||
* m1_i2: I_VAL_LEN2 (second length or process nr)
|
* m1_i2: I_VAL_LEN2 (second length or process nr)
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Jorrit N. Herder <jnherder@cs.vu.nl>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../system.h"
|
#include "../system.h"
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
* m5_i1: IRQ_POLICY (irq policy allows reenabling interrupts)
|
* m5_i1: IRQ_POLICY (irq policy allows reenabling interrupts)
|
||||||
* m5_l3: IRQ_HOOK_ID (provides index to be returned on interrupt)
|
* m5_l3: IRQ_HOOK_ID (provides index to be returned on interrupt)
|
||||||
* ,, ,, (returns index of irq hook assigned at kernel)
|
* ,, ,, (returns index of irq hook assigned at kernel)
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Jorrit N. Herder <jnherder@cs.vu.nl>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../system.h"
|
#include "../system.h"
|
||||||
|
|
|
@ -48,7 +48,7 @@ message *m_ptr; /* pointer to request message */
|
||||||
*/
|
*/
|
||||||
if ((i=get_priv(rp, SYS_PROC)) != OK) return(i);
|
if ((i=get_priv(rp, SYS_PROC)) != OK) return(i);
|
||||||
priv_id = priv(rp)->s_id; /* backup privilege id */
|
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_id = priv_id; /* restore privilege id */
|
||||||
priv(rp)->s_proc_nr = proc_nr; /* reassociate process nr */
|
priv(rp)->s_proc_nr = proc_nr; /* reassociate process nr */
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
* m4_l1: SEG_SELECT (return segment selector here)
|
* m4_l1: SEG_SELECT (return segment selector here)
|
||||||
* m4_l2: SEG_OFFSET (return offset within segment here)
|
* m4_l2: SEG_OFFSET (return offset within segment here)
|
||||||
* m4_l5: SEG_INDEX (return index into remote memory map here)
|
* m4_l5: SEG_INDEX (return index into remote memory map here)
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Jorrit N. Herder <jnherder@cs.vu.nl>
|
|
||||||
*/
|
*/
|
||||||
#include "../system.h"
|
#include "../system.h"
|
||||||
#include "../protect.h"
|
#include "../protect.h"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* include 'boot_image' (this file) and 'idt' and 'gdt' (protect.c).
|
* include 'boot_image' (this file) and 'idt' and 'gdt' (protect.c).
|
||||||
*
|
*
|
||||||
* Changes:
|
* 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)
|
* Oct 17, 2004 updated above and tasktab comments (Jorrit N. Herder)
|
||||||
* May 01, 2004 changed struct for system image (Jorrit N. Herder)
|
* May 01, 2004 changed struct for system image (Jorrit N. Herder)
|
||||||
*/
|
*/
|
||||||
|
@ -37,26 +37,26 @@
|
||||||
/* Define stack sizes for the kernel tasks included in the system image. */
|
/* Define stack sizes for the kernel tasks included in the system image. */
|
||||||
#define NO_STACK 0
|
#define NO_STACK 0
|
||||||
#define SMALL_STACK (128 * sizeof(char *))
|
#define SMALL_STACK (128 * sizeof(char *))
|
||||||
#define IDLE_S SMALL_STACK /* 3 intr, 3 temps, 4 db for Intel */
|
#define IDL_S SMALL_STACK /* 3 intr, 3 temps, 4 db for Intel */
|
||||||
#define HRDW_S NO_STACK /* dummy task, uses kernel stack */
|
#define HRD_S NO_STACK /* dummy task, uses kernel stack */
|
||||||
#define TASK_S SMALL_STACK /* system and clock task */
|
#define TSK_S SMALL_STACK /* system and clock task */
|
||||||
|
|
||||||
/* Stack space for all the task stacks. Declared as (char *) to align it. */
|
/* 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 *)];
|
PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)];
|
||||||
|
|
||||||
/* Define flags for the various process types. */
|
/* Define flags for the various process types. */
|
||||||
#define IDLE_F (BILLABLE | SYS_PROC) /* idle task */
|
#define IDL_F (BILLABLE | SYS_PROC) /* idle task */
|
||||||
#define TASK_F (SYS_PROC) /* kernel tasks */
|
#define TSK_F (SYS_PROC) /* kernel tasks */
|
||||||
#define SERV_F (PREEMPTIBLE | SYS_PROC) /* system services */
|
#define SRV_F (PREEMPTIBLE | SYS_PROC) /* system services */
|
||||||
#define USER_F (PREEMPTIBLE | BILLABLE) /* user processes */
|
#define USR_F (PREEMPTIBLE | BILLABLE) /* user processes */
|
||||||
|
|
||||||
/* Define system call traps for the various process types. These call masks
|
/* Define system call traps for the various process types. These call masks
|
||||||
* determine what system call traps a process is allowed to make.
|
* determine what system call traps a process is allowed to make.
|
||||||
*/
|
*/
|
||||||
#define TASK_T (1 << RECEIVE) /* clock and system */
|
#define TSK_T (1 << RECEIVE) /* clock and system */
|
||||||
#define SERV_T (~0) /* system services */
|
#define SRV_T (~0) /* system services */
|
||||||
#define USER_T ((1 << SENDREC) | (1 << ECHO)) /* user processes */
|
#define USR_T ((1 << SENDREC) | (1 << ECHO)) /* user processes */
|
||||||
|
|
||||||
/* Send masks determine to whom processes can send messages or notifications.
|
/* 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
|
* The values here are used for the processes in the boot image. We rely on
|
||||||
|
@ -69,11 +69,10 @@ PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)];
|
||||||
* "BITCHUNK_BITS - NR_TASKS", because a bitchunk_t field is used to store
|
* "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.
|
* the send masks in the table that describes that processes in the image.
|
||||||
*/
|
*/
|
||||||
#define SERV_M (~0)
|
#define SRV_M (~0)
|
||||||
#define SYST_M (~0)
|
#define SYS_M (~0)
|
||||||
#define USER_M (s(PM_PROC_NR)|s(FS_PROC_NR)|s(SM_PROC_NR))
|
#define USR_M (s(PM_PROC_NR)|s(FS_PROC_NR)|s(SM_PROC_NR))
|
||||||
#define DRIV_M (USER_M | \
|
#define DRV_M (USR_M | s(SYSTEM)|s(CLOCK)|s(LOG_PROC_NR)|s(TTY_PROC_NR))
|
||||||
s(SYSTEM)|s(CLOCK)|s(LOG_PROC_NR)|s(TTY_PROC_NR))
|
|
||||||
|
|
||||||
/* Sanity check to make sure the send masks can be set. */
|
/* Sanity check to make sure the send masks can be set. */
|
||||||
extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1];
|
extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1];
|
||||||
|
@ -87,19 +86,19 @@ extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1];
|
||||||
* initial program counter and stack size is also provided for kernel tasks.
|
* initial program counter and stack size is also provided for kernel tasks.
|
||||||
*/
|
*/
|
||||||
PUBLIC struct boot_image image[] = {
|
PUBLIC struct boot_image image[] = {
|
||||||
/* process nr, pc, flags, qs, queue, stack, traps, ipc mask, name */
|
/* process nr, pc, flags, qs, queue, stack, traps, ipc, sys, name */
|
||||||
{ IDLE, idle_task, IDLE_F, 32, IDLE_Q, IDLE_S, 0, 0, "IDLE" },
|
{ IDLE, idle_task, IDL_F, 32, IDLE_Q, IDL_S, 0, 0, 0, "IDLE" },
|
||||||
{ CLOCK, clock_task, TASK_F, 0, TASK_Q, TASK_S, TASK_T, 0, "CLOCK" },
|
{ CLOCK,clock_task, TSK_F, 0, TASK_Q, TSK_S, TSK_T, 0, 0, "CLOCK" },
|
||||||
{ SYSTEM, sys_task, TASK_F, 0, TASK_Q, TASK_S, TASK_T, 0, "SYSTEM" },
|
{ SYSTEM, sys_task, TSK_F, 0, TASK_Q, TSK_S, TSK_T, 0, 0, "SYSTEM" },
|
||||||
{ HARDWARE, 0, TASK_F, 0, TASK_Q, HRDW_S, 0, 0, "KERNEL" },
|
{ HARDWARE, 0, TSK_F, 0, TASK_Q, HRD_S, 0, 0, 0, "KERNEL" },
|
||||||
{ PM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SERV_M, "pm" },
|
{ PM_PROC_NR, 0, SRV_F, 16, 3, 0, SRV_T, SRV_M, ~0, "pm" },
|
||||||
{ FS_PROC_NR, 0, SERV_F, 16, 4, 0, SERV_T, SERV_M, "fs" },
|
{ FS_PROC_NR, 0, SRV_F, 16, 4, 0, SRV_T, SRV_M, ~0, "fs" },
|
||||||
{ SM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SYST_M, "sm" },
|
{ SM_PROC_NR, 0, SRV_F, 16, 3, 0, SRV_T, SYS_M, ~0, "sm" },
|
||||||
{ TTY_PROC_NR, 0, SERV_F, 16, 1, 0, SERV_T, SYST_M, "tty" },
|
{ TTY_PROC_NR, 0, SRV_F, 16, 1, 0, SRV_T, SYS_M, ~0, "tty" },
|
||||||
{ MEM_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "memory" },
|
{ MEM_PROC_NR, 0, SRV_F, 16, 2, 0, SRV_T, DRV_M, ~0, "memory" },
|
||||||
{ LOG_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, SYST_M, "log" },
|
{ LOG_PROC_NR, 0, SRV_F, 16, 2, 0, SRV_T, SYS_M, ~0, "log" },
|
||||||
{ DRVR_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "driver" },
|
{ DRVR_PROC_NR, 0, SRV_F, 16, 2, 0, SRV_T, DRV_M, ~0, "driver" },
|
||||||
{ INIT_PROC_NR, 0, USER_F, 8, USER_Q, 0, USER_T, USER_M, "init" },
|
{ 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
|
/* Verify the size of the system image table at compile time. If the number
|
||||||
|
|
|
@ -17,8 +17,9 @@ struct boot_image {
|
||||||
char quantum; /* quantum (tick count) */
|
char quantum; /* quantum (tick count) */
|
||||||
int priority; /* scheduling priority */
|
int priority; /* scheduling priority */
|
||||||
int stksize; /* stack size for tasks */
|
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 */
|
bitchunk_t send_mask; /* send mask protection */
|
||||||
|
long sys_mask; /* system call protection */
|
||||||
char proc_name[P_NAME_LEN]; /* name in process table */
|
char proc_name[P_NAME_LEN]; /* name in process table */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* This file contains a collection of miscellaneous procedures:
|
/* This file contains a collection of miscellaneous procedures:
|
||||||
* panic: abort MINIX due to a fatal error
|
* panic: abort MINIX due to a fatal error
|
||||||
* kprintf: diagnostic output for the kernel
|
* kprintf: diagnostic output for the kernel
|
||||||
*
|
*
|
||||||
* Changes:
|
* 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.,
|
* This file contains the routines that take care of kernel messages, i.e.,
|
||||||
* diagnostic output within the kernel. Kernel messages are not directly
|
* diagnostic output within the kernel. Kernel messages are not directly
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#define NR_SUPERS 8 /* # slots in super block table */
|
#define NR_SUPERS 8 /* # slots in super block table */
|
||||||
#define NR_LOCKS 8 /* # slots in the file locking 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
|
/* 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
|
* taking the sizes of small objects so that there are no surprises like
|
||||||
* (small) long constants being passed to routines expecting an int.
|
* (small) long constants being passed to routines expecting an int.
|
||||||
|
|
|
@ -117,37 +117,50 @@ int style; /* style of the device */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* 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
|
* selection. The boot driver and the controller it handles are set at the
|
||||||
* boot monitor.
|
* boot monitor.
|
||||||
*/
|
*/
|
||||||
char driver[16];
|
char driver[16];
|
||||||
char *controller = "c##";
|
char *controller = "c##";
|
||||||
int number;
|
int nr, major = -1;
|
||||||
int i,s;
|
int i,s;
|
||||||
|
|
||||||
|
/* Get settings of 'controller' and 'driver' at the boot monitor. */
|
||||||
if ((s = get_mon_param("label", driver, sizeof(driver))) != OK)
|
if ((s = get_mon_param("label", driver, sizeof(driver))) != OK)
|
||||||
panic(__FILE__,"couldn't get boot monitor parameter 'driver'", s);
|
panic(__FILE__,"couldn't get boot monitor parameter 'driver'", s);
|
||||||
if ((s = get_mon_param("controller", controller, sizeof(controller))) != OK)
|
if ((s = get_mon_param("controller", controller, sizeof(controller))) != OK)
|
||||||
panic(__FILE__,"couldn't get boot monitor parameter 'controller'", s);
|
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);
|
/* Determine major number to map driver onto. */
|
||||||
if ((number = (unsigned) atoi(&controller[1])) > NR_CTRLRS)
|
if (controller[0] == 'f' && controller[1] == 'd') {
|
||||||
panic(__FILE__,"monitor parameter 'controller' maximum is", NR_CTRLRS);
|
major = FLOPPY_MAJOR;
|
||||||
|
}
|
||||||
for (i=0; i< NR_DEVICES; i++) { /* find controller */
|
else if (controller[0] == 'c' && isdigit(controller[1])) {
|
||||||
if (dmap[i].dmap_driver == CTRLR(number)) {
|
if ((nr = (unsigned) atoi(&controller[1])) > NR_CTRLRS)
|
||||||
if ((s=map_driver(i, DRVR_PROC_NR, STYLE_DEV)) != OK)
|
panic(__FILE__,"monitor 'controller' maximum 'c#' is", NR_CTRLRS);
|
||||||
panic(__FILE__,"map_driver failed",s);
|
for (i=0; i< NR_DEVICES; i++) { /* find controller */
|
||||||
printf("Boot medium driver: %s driver mapped onto controller c%d.\n",
|
if (dmap[i].dmap_driver == CTRLR(nr)) {
|
||||||
driver, number);
|
major = i;
|
||||||
return; /* success! */
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ PRIVATE void fs_init()
|
||||||
who = FS_PROC_NR;
|
who = FS_PROC_NR;
|
||||||
|
|
||||||
buf_pool(); /* initialize buffer pool */
|
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_ram(); /* init RAM disk, load if it is root */
|
||||||
load_super(root_dev); /* load super block for root device */
|
load_super(root_dev); /* load super block for root device */
|
||||||
init_select(); /* init select() structures */
|
init_select(); /* init select() structures */
|
||||||
|
|
|
@ -48,7 +48,7 @@ _PROTOTYPE( int do_fkey_pressed, (void) );
|
||||||
|
|
||||||
/* dmap.c */
|
/* dmap.c */
|
||||||
_PROTOTYPE( int do_devctl, (void) );
|
_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) );
|
_PROTOTYPE( int map_driver, (int major, int proc_nr, int dev_style) );
|
||||||
|
|
||||||
/* filedes.c */
|
/* filedes.c */
|
||||||
|
|
|
@ -19,6 +19,7 @@ PROGRAMS= ../kernel/kernel \
|
||||||
../drivers/log/log \
|
../drivers/log/log \
|
||||||
AT:../drivers/at_wini/at_wini \
|
AT:../drivers/at_wini/at_wini \
|
||||||
BIOS:../drivers/bios_wini/bios_wini \
|
BIOS:../drivers/bios_wini/bios_wini \
|
||||||
|
FLOPPY:../drivers/floppy/floppy \
|
||||||
../servers/init/init \
|
../servers/init/init \
|
||||||
# bootdev.img
|
# bootdev.img
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue