Index: drivers/char/mem.c =================================================================== RCS file: /var/cvs/uClinux-2.4.x/drivers/char/mem.c,v retrieving revision 1.8 diff -u -r1.8 mem.c --- drivers/char/mem.c 2002/01/04 05:00:46 1.8 +++ drivers/char/mem.c 2002/06/24 08:18:02 @@ -211,11 +211,22 @@ return -EAGAIN; return 0; #else /* !NO_MM */ - /* DAVIDM vma->vm_start = file->f_pos+PAGE_OFFSET+vma->vm_offset; */ - return -EINVAL; + /* Return the physical address unmodified if it's possible to do + so given the arguments. */ + if (vma->vm_start == file->f_pos + vma->vm_offset) + return 0; + else + return -EINVAL; #endif /* !NO_MM */ } +#ifdef NO_MM +unsigned long get_unmapped_area_mem (struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) +{ + return file->f_pos + (pgoff << PAGE_SHIFT); +} +#endif + /* * This function reads the *virtual* memory as seen by the kernel. */ @@ -560,6 +571,9 @@ read: read_mem, write: write_mem, mmap: mmap_mem, +#ifdef NO_MM + get_unmapped_area: get_unmapped_area_mem, +#endif open: open_mem, }; Index: mmnommu/mmap.c =================================================================== RCS file: /var/cvs/uClinux-2.4.x/mmnommu/mmap.c,v retrieving revision 1.15 diff -u -r1.15 mmap.c --- mmnommu/mmap.c 2002/04/24 00:51:16 1.15 +++ mmnommu/mmap.c 2002/06/24 08:18:19 @@ -1206,6 +1206,22 @@ #else /* NO_MM */ +unsigned long get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) +{ + if (flags & MAP_FIXED) { + if (addr > TASK_SIZE - len) + return -EINVAL; + if (addr & ~PAGE_MASK) + return -EINVAL; + return addr; + } + + if (file && file->f_op && file->f_op->get_unmapped_area) + return file->f_op->get_unmapped_area(file, addr, len, pgoff, flags); + + return 0; +} + #ifdef DEBUG static void show_process_blocks(void) { @@ -1278,6 +1294,7 @@ /* Too many mappings? */ if (mm->map_count > MAX_MAP_COUNT) return -ENOMEM; +#endif /* Obtain the address to map to. we verify (or select) it and ensure * that it represents a valid section of the address space. @@ -1285,7 +1302,6 @@ addr = get_unmapped_area(file, addr, len, pgoff, flags); if (addr & ~PAGE_MASK) return addr; -#endif /* Do simple checking here so the lower-level routines won't have * to. we assume access permissions have been handled by the open