diff -Naur -X exclude-files ac_cur/arch/um/drivers/mmapper_kern.c ac/arch/um/drivers/mmapper_kern.c --- ac_cur/arch/um/drivers/mmapper_kern.c Wed Dec 31 19:00:00 1969 +++ ac/arch/um/drivers/mmapper_kern.c Sat Aug 4 21:24:15 2001 @@ -0,0 +1,134 @@ +/* + * arch/um/drivers/mmapper_kern.c + * + * BRIEF MODULE DESCRIPTION + * + * Copyright (C) 2000 RidgeRun, Inc. + * Author: RidgeRun, Inc. + * Greg Lonnon glonnon@ridgerun.com or info@ridgerun.com + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "user_util.h" + +int mmapper_size = 100 *1024; +char *mmapper_buffer = NULL; + +static ssize_t +mmapper_read(struct file *file, char *buf, size_t count, loff_t *ppos) +{ + return(-EINVAL); +} + +static ssize_t +mmapper_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +{ + return(-EINVAL); +} + +static int +mmapper_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + switch(cmd) { + + case 1: + return mmapper_size; + break; + case 2: + break; + } + return 0; +} + +static int +mmapper_mmap(struct file *file, struct vm_area_struct * vma) +{ + unsigned long mystart = (unsigned long)mmapper_buffer; + int ret = -EINVAL; + int size; + + lock_kernel(); + if (vma->vm_pgoff != 0) + goto out; + + size = vma->vm_end - vma->vm_start; + + if (remap_page_range(vma->vm_start,mmapper_buffer, + size, vma->vm_page_prot)) + goto out; + ret = 0; +out: + unlock_kernel(); + return ret; +} + +static int +mmapper_open(struct inode *inode, struct file *file) +{ + return 0; +} + +static int +mmapper_release(struct inode *inode, struct file *file) +{ + return 0; +} + + +static struct file_operations mmapper_fops = { + owner: THIS_MODULE, + read: mmapper_read, + write: mmapper_write, + ioctl: mmapper_ioctl, + mmap: mmapper_mmap, + open: mmapper_open, + release: mmapper_release, +}; + +static int mmapper_installed = 0; + +static int __init mmapper_init(void) +{ + int link; + printk(KERN_INFO "Mapper v0.1\n"); + + if(mmapper_installed++) + return 0; + + mmapper_buffer = find_iomem("mmapper", &mmapper_size); + + link = devfs_register (NULL, "mmapper", DEVFS_FL_DEFAULT, + 30, 0, S_IFCHR | S_IRUGO | S_IWUGO, + &mmapper_fops, NULL); + devfs_mk_symlink(NULL, "mmapper" , DEVFS_FL_DEFAULT, "mmaper0", + NULL, NULL); +} + +static void mmapper_exit(void) +{ + if(mmapper_installed--) { + } +} +module_init(mmapper_init); +module_exit(mmapper_exit); + +MODULE_AUTHOR("Greg Lonnon "); +MODULE_DESCRIPTION("DSPLinux simulator mmapper driver"); +/* + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff -Naur -X exclude-files ac_cur/arch/um/kernel/mem_user.c ac/arch/um/kernel/mem_user.c --- ac_cur/arch/um/kernel/mem_user.c Sat Aug 4 15:57:57 2001 +++ ac/arch/um/kernel/mem_user.c Sat Aug 4 21:24:15 2001 @@ -191,7 +191,8 @@ struct mem_region *region; for(region = mem_list; region ; region = region->next) { - if(!strcmp(region->driver, driver)) { + if((region->driver != NULL) && + !strcmp(region->driver, driver)){ *len_out = region->usable; return(region->start); } diff -Naur -X exclude-files ac_cur/arch/um/kernel/tlb.c ac/arch/um/kernel/tlb.c --- ac_cur/arch/um/kernel/tlb.c Sat Aug 4 16:11:44 2001 +++ ac/arch/um/kernel/tlb.c Sat Aug 4 21:24:15 2001 @@ -85,8 +85,7 @@ if(force || !pte_present(*npte) || pte_newpage(*npte)){ munmap((void *) addr, PAGE_SIZE); if(pte_present(*npte)) - map(addr, - page_address(pte_page(*npte)), + map(addr, pte_address(*npte), PAGE_SIZE, r, w, x); } else if(pte_newprot(*npte)) @@ -143,7 +142,7 @@ w = 0; x = 1; } - map(addr, page_address(pte_page(*npte)), + map(addr, pte_address(*npte), PAGE_SIZE, r, w, x); } addr += PAGE_SIZE; diff -Naur -X exclude-files ac_cur/include/asm-um/pgtable.h ac/include/asm-um/pgtable.h --- ac_cur/include/asm-um/pgtable.h Sat Aug 4 21:14:28 2001 +++ ac/include/asm-um/pgtable.h Sat Aug 4 21:27:16 2001 @@ -195,6 +195,7 @@ #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pte_page(x) \ (mem_map+((unsigned long)((__pa(pte_val(x)) >> PAGE_SHIFT)))) +#define pte_address(x) ((void *) ((unsigned long) pte_val(x) & PAGE_MASK)) extern inline pte_t pte_mknewprot(pte_t pte) {