BIOS and AT installed in /sbin.
Floppy boot fixed.
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
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
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);
}
# 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 .
/* 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 */
# 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 */
/* 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);
}
}
}
*/
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
}
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) {
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
* 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,
* 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,
*/
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
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 */
};
}
/*===========================================================================*
- * 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)
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);
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 */
/* 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 */
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");
else printf("%8x", dmap[i].dmap_io);
#endif
- printf("%6d\n", dmap[i].dmap_driver);
}
}