From: Dan A. <da...@gm...> - 2004-02-14 00:04:47
|
On Fri, Feb 13, 2004 at 04:11:13AM -0500, Pat Erley wrote: > here's a basic patch to add cobd devfs support. It's not 100% perfect, and I plan on getting it up to working with a /dev/cobd/ dir and symlink to it as the devices exist... > > Pat Erley Thanks, the patch I made below completes your effort. This patch also fixes at least one invalid operation (termination 7) problem that was encountered. It turns out that time.c was trying to query the BIOS directly for the system time and therefore was stopped by co_terminate(). In the next release, it would get this information from the host OS using a special interface. For now, the patch below adds devfs support and addresses the invalid operation problem alone. (applies on top of 0.5.3-pre2's patch/linux) diff -u linux/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c --- linux/arch/i386/kernel/time.c 2003-12-13 17:17:01.000000000 +0200 +++ linux/arch/i386/kernel/time.c 2004-02-14 01:50:50.000000000 +0200 @@ -121,6 +121,8 @@ extern spinlock_t i8259A_lock; +#ifndef CONFIG_COOPERATIVE + #ifndef CONFIG_X86_TSC /* This function must be called with interrupts disabled @@ -254,6 +256,18 @@ return count; } +#else + +static unsigned long do_slow_gettimeoffset(void) +{ + /* + * coLinux TODO for 0.5.3: Request the time from the host OS. + */ + return 0; +} + +#endif + static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; diff -u linux/drivers/block/cobd.c linux/drivers/block/cobd.c --- linux/drivers/block/cobd.c 2004-02-06 17:11:19.000000000 +0200 +++ linux/drivers/block/cobd.c 2004-02-14 01:30:47.000000000 +0200 @@ -10,6 +10,8 @@ #include <linux/errno.h> #include <linux/major.h> #include <linux/slab.h> +#include <linux/devfs_fs_kernel.h> + #define MAJOR_NR COLINUX_MAJOR #define DEVICE_NR(device) MINOR(device) /* has no partition bits */ @@ -19,6 +21,7 @@ #define DEVICE_OFF(d) /* do-nothing */ #include <linux/blk.h> +#include <linux/blkpg.h> #include <linux/hdreg.h> #include <linux/cooperative.h> @@ -231,10 +234,14 @@ for (i=0; i < cobd_devs; i++) register_disk(NULL, MKDEV(MAJOR_NR, i), 1, &cobd_fops, cobd_sizes[i]); - printk("cobd driver initialized\n"); + devfs_register_series(NULL, "cobd%u", cobd_devs, DEVFS_FL_DEFAULT, + MAJOR_NR, 0, + S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, + &cobd_fops, NULL); + + printk("cobd: loaded (max %d devices)\n", cobd_devs); - result = 0; - return result; + return 0; fail_malloc_2: kfree(cobd_blksizes); @@ -242,6 +249,9 @@ kfree(cobd_sizes); fail_malloc: + if (devfs_unregister_blkdev(MAJOR_NR, "cobd")) + printk(KERN_WARNING "loop: cannot unregister blkdev\n"); + return result; } @@ -262,0 +273 @@ + diff -u linux/include/asm-i386/io.h linux/include/asm-i386/io.h --- linux/include/asm-i386/io.h 2004-02-08 00:43:12.000000000 +0200 +++ linux/include/asm-i386/io.h 2004-02-14 01:50:28.000000000 +0200 @@ -124,8 +124,7 @@ static inline void * ioremap (unsigned long offset, unsigned long size) { #ifdef CONFIG_COOPERATIVE - co_debug("ioremap %x:%d\n", offset, size); - co_terminate(CO_TERMINATE_INVALID_OPERATION); + panic("ioremap %ld:%ld\n", offset, size); #endif return __ioremap(offset, size, 0); } @@ -153,8 +152,7 @@ static inline void * ioremap_nocache (unsigned long offset, unsigned long size) { #ifdef CONFIG_COOPERATIVE - co_debug("ioremap %x:%d\n", offset, size); - co_terminate(CO_TERMINATE_INVALID_OPERATION); + panic("ioremap_nocache %ld:%ld\n", offset, size); #endif return __ioremap(offset, size, _PAGE_PCD); } @@ -443,7 +441,9 @@ static inline unsigned long badio(const char *file, int line) { - co_terminate(CO_TERMINATE_INVALID_OPERATION); +#ifdef CONFIG_COOPERATIVE + panic("badio %s:%d\n", file, line); +#endif return 0; } -- Dan Aloni da...@gm... |