I see. I was confused by the fact that netscape did work with
kernels < 2.4.9. Which only means that netscape never calls
mmap() with zero address...
> I think you're working too hard to make this "efficient", and
> in the process making the code hard to read. A subroutine
> containing a simple search-forward loop is just as effective.
Ok. After converting that from assembly to C I've got your
version of arch_get_unmapped_area :-) with small changes
(to avoid searching the same areas 2 or 3 times).
Ivan.
--- linux/arch/alpha/kernel/osf_sys.c.rth Mon Oct 29 17:43:53 2001
+++ linux/arch/alpha/kernel/osf_sys.c Mon Oct 29 18:14:46 2001
@@ -1342,11 +1342,11 @@ arch_get_unmapped_area_1(unsigned long a
}
unsigned long
-arch_get_unmapped_area(struct file *filp, unsigned long addr,
+arch_get_unmapped_area(struct file *filp, unsigned long start,
unsigned long len, unsigned long pgoff,
unsigned long flags)
{
- unsigned long limit;
+ unsigned long limit, addr;
/* "32 bit" actually means 31 bit, since pointers sign extend. */
if (current->personality & ADDR_LIMIT_32BIT)
@@ -1367,10 +1367,12 @@ arch_get_unmapped_area(struct file *filp
merely specific addresses, but regions of memory -- perhaps
this feature should be incorporated into all ports? */
- if (addr) {
- addr = arch_get_unmapped_area_1 (PAGE_ALIGN(addr), len, limit);
+ if (start) {
+ start = PAGE_ALIGN(start);
+ addr = arch_get_unmapped_area_1 (start, len, limit);
if (addr != -ENOMEM)
return addr;
+ limit = start;
}
/* Next, try allocating at TASK_UNMAPPED_BASE. */
@@ -1378,6 +1380,8 @@ arch_get_unmapped_area(struct file *filp
len, limit);
if (addr != -ENOMEM)
return addr;
+
+ limit = PAGE_ALIGN(TASK_UNMAPPED_BASE);
/* Finally, try allocating in low memory. */
addr = arch_get_unmapped_area_1 (PAGE_SIZE, len, limit);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/