Fix to device table at FS.

BIOS and AT installed in /sbin.
Floppy boot fixed.
This commit is contained in:
Jorrit Herder 2005-08-05 18:57:20 +00:00
parent cfd27c36cb
commit 941b5ebd1c
13 changed files with 98 additions and 79 deletions

View file

@ -30,8 +30,8 @@ $(LIBDRIVER):
cd $d/libdriver && $(MAKE)
# install with other drivers
install: /usr/sbin/$(DRIVER)
/usr/sbin/$(DRIVER): $(DRIVER)
install: /sbin/$(DRIVER)
/sbin/$(DRIVER): $(DRIVER)
install -o root -cs $? $@
# clean up local files

View file

@ -30,8 +30,8 @@ $(LIBDRIVER):
cd $d/libdriver && $(MAKE)
# install with other drivers
install: /usr/sbin/$(DRIVER)
/usr/sbin/$(DRIVER): $(DRIVER)
install: /sbin/$(DRIVER)
/sbin/$(DRIVER): $(DRIVER)
install -o root -cs $? $@
# clean up local files

View file

@ -148,8 +148,9 @@ PUBLIC void main(void)
break;
case DEV_WRITE: do_write(&pr_mess); break;
case DEV_STATUS: do_status(&pr_mess); break;
case CANCEL : do_cancel(&pr_mess); break;
case HARD_INT : do_printer_output(); break;
case CANCEL: do_cancel(&pr_mess); break;
case HARD_INT: do_printer_output(); break;
case SYS_SIG: /* do nothing */ break;
default:
reply(TASK_REPLY, pr_mess.m_source, pr_mess.PROC_NR, EINVAL);
}

5
etc/rc
View file

@ -54,7 +54,10 @@ start)
# Start crucial system services. The floppy driver *must* be loaded
# first, as it needs memory below 16MB in order to do ISA DMA.
echo -n "Starting services:"
up floppy "" /dev/fd0
if [ ! "`sysenv label`" = "FLOPPY" ]
then up floppy "" /dev/fd0
else up at_wini "" /dev/c0d0
fi
up is ""
up cmos "" /dev/cmos
echo .

View file

@ -31,9 +31,6 @@
/* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
#define NR_TASKS 4
/* Magic numbers for controllers. Device to driver mapping is dynamic. */
#define CTRLR(n) (NONE + (n))
/* User-space processes, that is, device drivers, servers, and INIT. */
#define PM_PROC_NR 0 /* process manager */
#define FS_PROC_NR 1 /* file system */

View file

@ -42,6 +42,8 @@ extern struct dmap {
# define BOOT_DEV 4 /* minor device for /dev/boot */
# define ZERO_DEV 5 /* minor device for /dev/zero */
#define CTRLR(n) ((n)==0 ? 3 : (8 + 2*((n)-1))) /* magic formula */
/* 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 */

View file

@ -90,24 +90,13 @@ PUBLIC void clock_task()
/* Go get a message. */
receive(ANY, &m);
/* Handle the request. */
/* Handle the request. Only clock ticks are expected. */
switch (m.m_type) {
case HARD_INT:
result = do_clocktick(&m); /* handle clock tick */
break;
default: /* illegal message type */
kprintf("Warning, illegal CLOCK request from %d.\n", m.m_source);
result = EBADREQUEST;
}
/* Send reply, unless inhibited, e.g. by do_clocktick(). Use the kernel
* function lock_send() to prevent a system call trap. The destination
* is known to be blocked waiting for a message.
*/
if (result != EDONTREPLY) {
m.m_type = result;
if (OK != lock_send(m.m_source, &m))
kprintf("Warning, CLOCK couldn't reply to %d.\n", m.m_source);
case HARD_INT:
result = do_clocktick(&m); /* handle clock tick */
break;
default: /* illegal request type */
kprintf("CLOCK: illegal request %d from %d.\n", m.m_type,m.m_source);
}
}
}

View file

@ -220,7 +220,11 @@ int how;
*/
kprintf("MINIX will now be shut down ...\n");
tmr_arg(&shutdown_timer)->ta_int = how;
#if DEAD_CODE /* timer hangs the boot monitor ... to be fixed! */
set_timer(&shutdown_timer, get_uptime() + HZ, shutdown);
#else
shutdown(&shutdown_timer);
#endif
}
@ -238,7 +242,7 @@ timer_t *tp;
u16_t magic;
/* Now mask all interrupts, including the clock, and stop the clock. */
outb(INT_CTLMASK, ~1);
outb(INT_CTLMASK, ~0);
clock_stop();
if (mon_return && how != RBT_RESET) {

View file

@ -105,7 +105,6 @@ message *m_ptr; /* pointer to message in the caller's space */
unsigned flags = call_nr & SYSCALL_FLAGS; /* get flags */
int mask_entry; /* bit to check in send mask */
int result; /* the system call's result */
vir_bytes vb; /* message buffer pointer as vir_bytes */
vir_clicks vlo, vhi; /* virtual clicks containing message to send */
/* Check if the process has privileges for the requested call. Calls to the
@ -113,13 +112,17 @@ message *m_ptr; /* pointer to message in the caller's space */
* if the caller doesn't do receive().
*/
if (! (priv(caller_ptr)->s_trap_mask & (1 << function)) ||
(iskerneln(src_dst) && function != SENDREC))
return(ECALLDENIED);
(iskerneln(src_dst) && function != SENDREC)) {
kprintf("sys_call: trap not allowed, function %d, caller %d\n",
function, proc_nr(caller_ptr));
return(ECALLDENIED); /* call denied by trap mask */
}
/* Require a valid source and/ or destination process, unless echoing. */
if (! (isokprocn(src_dst) || src_dst == ANY || function == ECHO)) {
kprintf("sys_call: function %d, src_dst %d\n", function, src_dst);
return(EBADSRCDST);
kprintf("sys_call: invalid src_dst, src_dst %d, caller %d\n",
src_dst, proc_nr(caller_ptr));
return(EBADSRCDST); /* invalid process number */
}
/* If the call involves a message buffer, i.e., for SEND, RECEIVE, SENDREC,
@ -128,12 +131,15 @@ message *m_ptr; /* pointer to message in the caller's space */
* for machines which don't have the gap mapped.
*/
if (function & CHECK_PTR) {
vb = (vir_bytes) m_ptr; /* virtual clicks */
vlo = vb >> CLICK_SHIFT; /* bottom of message */
vhi = (vb + MESS_SIZE - 1) >> CLICK_SHIFT; /* top of message */
vlo = (vir_bytes) m_ptr >> CLICK_SHIFT;
vhi = ((vir_bytes) m_ptr + MESS_SIZE - 1) >> CLICK_SHIFT;
if (vlo < caller_ptr->p_memmap[D].mem_vir || vlo > vhi ||
vhi >= caller_ptr->p_memmap[S].mem_vir +
caller_ptr->p_memmap[S].mem_len) return(EFAULT);
caller_ptr->p_memmap[S].mem_len) {
kprintf("sys_call: invalid message pointer, function %d, caller %d\n",
function, proc_nr(caller_ptr));
return(EFAULT); /* invalid message pointer */
}
}
/* If the call is to send to a process, i.e., for SEND, SENDREC or NOTIFY,
@ -142,12 +148,16 @@ message *m_ptr; /* pointer to message in the caller's space */
*/
if (function & CHECK_DST) {
if (! get_sys_bit(priv(caller_ptr)->s_ipc_to, nr_to_id(src_dst))) {
kprintf("Warning, send_mask denied %d sending to %d\n",
kprintf("sys_call: ipc mask denied %d sending to %d\n",
proc_nr(caller_ptr), src_dst);
return(ECALLDENIED);
return(ECALLDENIED); /* call denied by ipc mask */
}
if (isemptyn(src_dst)) return(EDEADDST); /* cannot send to the dead */
if (isemptyn(src_dst)) {
kprintf("sys_call: dead destination, function %d, caller %d\n",
function, proc_nr(caller_ptr));
return(EDEADDST); /* cannot send to the dead */
}
}
/* Now check if the call is known and try to perform the request. The only

View file

@ -30,27 +30,28 @@
Driver enabled Open/Cls I/O Driver # Flags Device File
-------------- -------- ------ ----------- ----- ------ ----
*/
struct dmap dmap[NR_DEVICES] = {
DT(1, no_dev, 0, 0, 0) /* 0 = not used */
DT(1, gen_opcl, gen_io, MEM_PROC_NR, 0) /* 1 = /dev/mem */
DT(0, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /* 2 = /dev/fd0 */
DT(NC(1), gen_opcl, gen_io, CTRLR(0), DMAP_MUTABLE) /* 3 = /dev/c0 */
DT(1, tty_opcl, gen_io, TTY_PROC_NR, 0) /* 4 = /dev/tty00 */
DT(1, ctty_opcl,ctty_io,TTY_PROC_NR, 0) /* 5 = /dev/tty */
DT(0, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /* 6 = /dev/lp */
struct dmap dmap[NR_DEVICES]; /* actual map */
PRIVATE struct dmap init_dmap[] = {
DT(1, no_dev, 0, 0, 0) /* 0 = not used */
DT(1, gen_opcl, gen_io, MEM_PROC_NR, 0) /* 1 = /dev/mem */
DT(0, no_dev, 0, 0, DMAP_MUTABLE) /* 2 = /dev/fd0 */
DT(0, no_dev, 0, 0, DMAP_MUTABLE) /* 3 = /dev/c0 */
DT(1, tty_opcl, gen_io, TTY_PROC_NR, 0) /* 4 = /dev/tty00 */
DT(1, ctty_opcl,ctty_io, TTY_PROC_NR, 0) /* 5 = /dev/tty */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /* 6 = /dev/lp */
#if (MACHINE == IBM_PC)
DT(1, no_dev, 0, 0, DMAP_MUTABLE) /* 7 = /dev/ip */
DT(NC(2), gen_opcl, gen_io, CTRLR(1), DMAP_MUTABLE) /* 8 = /dev/c1 */
DT(0, 0, 0, 0, DMAP_MUTABLE) /* 9 = not used */
DT(NC(3), gen_opcl, gen_io, CTRLR(2), DMAP_MUTABLE) /*10 = /dev/c2 */
DT(0, 0, 0, 0, DMAP_MUTABLE) /*11 = not used */
DT(NC(4), gen_opcl, gen_io, CTRLR(3), DMAP_MUTABLE) /*12 = /dev/c3 */
DT(0, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*13 = /dev/audio */
DT(0, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */
DT(0, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*16 = /dev/random */
DT(0, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*17 = /dev/cmos */
DT(1, no_dev, 0, 0, DMAP_MUTABLE) /* 7 = /dev/ip */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /* 8 = /dev/c1 */
DT(0, 0, 0, 0, DMAP_MUTABLE) /* 9 = not used */
DT(0, no_dev, 0, 0, DMAP_MUTABLE) /*10 = /dev/c2 */
DT(0, 0, 0, 0, DMAP_MUTABLE) /*11 = not used */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*12 = /dev/c3 */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*13 = /dev/audio */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*16 = /dev/random */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*17 = /dev/cmos */
#endif /* IBM_PC */
};
@ -117,18 +118,37 @@ int style; /* style of the device */
}
/*===========================================================================*
* map_controller *
* build_dmap *
*===========================================================================*/
PUBLIC void map_controller()
PUBLIC void build_dmap()
{
/* 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.
/* Initialize the table with all device <-> driver mappings. Then, 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 nr, major = -1;
int i,s;
struct dmap *dp;
/* Build table with device <-> driver mappings. */
for (i=0; i<NR_DEVICES; i++) {
dp = &dmap[i];
if (i < sizeof(init_dmap)/sizeof(struct dmap) &&
init_dmap[i].dmap_opcl != no_dev) { /* a preset driver */
dp->dmap_opcl = init_dmap[i].dmap_opcl;
dp->dmap_io = init_dmap[i].dmap_io;
dp->dmap_driver = init_dmap[i].dmap_driver;
dp->dmap_flags = init_dmap[i].dmap_flags;
} else { /* no default */
dp->dmap_opcl = no_dev;
dp->dmap_io = 0;
dp->dmap_driver = 0;
dp->dmap_flags = DMAP_MUTABLE;
}
}
/* Get settings of 'controller' and 'driver' at the boot monitor. */
if ((s = env_get_param("label", driver, sizeof(driver))) != OK)
@ -143,21 +163,14 @@ PUBLIC void map_controller()
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);
major = CTRLR(nr);
}
else {
panic(__FILE__,"monitor 'controller' syntax is 'c#' of 'fd'", NO_NUM);
}
/* Now try to set the actual mapping and report to the user. */
if ((s=map_driver(i, DRVR_PROC_NR, STYLE_DEV)) != OK)
if ((s=map_driver(major, 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);

View file

@ -225,7 +225,7 @@ PRIVATE void fs_init()
who = FS_PROC_NR;
buf_pool(); /* initialize buffer pool */
map_controller(); /* map boot driver onto controller */
build_dmap(); /* build device table and map boot driver */
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 */

View file

@ -48,7 +48,7 @@ _PROTOTYPE( int do_fkey_pressed, (void) );
/* dmap.c */
_PROTOTYPE( int do_devctl, (void) );
_PROTOTYPE( void map_controller, (void) );
_PROTOTYPE( void build_dmap, (void) );
_PROTOTYPE( int map_driver, (int major, int proc_nr, int dev_style) );
/* filedes.c */

View file

@ -65,10 +65,11 @@ PUBLIC void dtab_dmp()
getsysinfo(FS_PROC_NR, SI_DMAP_TAB, dmap);
printf("File System (FS) device <-> driver mappings\n");
printf("Dev File Open/Cls I/O Proc\n");
printf("--- ---------- -------- ------ ----\n");
printf("Major Proc\n");
printf("----- ----\n");
for (i=0; i<NR_DEVICES; i++) {
printf("%3d %s ", i, file[i] );
printf("%5d ", i);
printf("%4d\n", dmap[i].dmap_driver);
#if DEAD_CODE
if (dmap[i].dmap_opcl == no_dev) printf(" no_dev");
@ -80,7 +81,6 @@ PUBLIC void dtab_dmp()
else printf("%8x", dmap[i].dmap_io);
#endif
printf("%6d\n", dmap[i].dmap_driver);
}
}