~ubuntu-branches/ubuntu/karmic/linux-mvl-dove/karmic-proposed

« back to all changes in this revision

Viewing changes to arch/sparc/kernel/sys_sparc_64.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader
  • Date: 2010-03-10 22:24:12 UTC
  • mto: (15.1.2 karmic-security)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20100310222412-k86m3r53jw0je7x1
Tags: upstream-2.6.31
ImportĀ upstreamĀ versionĀ 2.6.31

Show diffs side-by-side

added added

removed removed

Lines of Context:
317
317
unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags)
318
318
{
319
319
        unsigned long align_goal, addr = -ENOMEM;
320
 
        unsigned long (*get_area)(struct file *, unsigned long,
321
 
                                  unsigned long, unsigned long, unsigned long);
322
 
 
323
 
        get_area = current->mm->get_unmapped_area;
324
320
 
325
321
        if (flags & MAP_FIXED) {
326
322
                /* Ok, don't mess with it. */
327
 
                return get_area(NULL, orig_addr, len, pgoff, flags);
 
323
                return get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
328
324
        }
329
325
        flags &= ~MAP_SHARED;
330
326
 
337
333
                align_goal = (64UL * 1024);
338
334
 
339
335
        do {
340
 
                addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
 
336
                addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
341
337
                if (!(addr & ~PAGE_MASK)) {
342
338
                        addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL);
343
339
                        break;
355
351
         * be obtained.
356
352
         */
357
353
        if (addr & ~PAGE_MASK)
358
 
                addr = get_area(NULL, orig_addr, len, pgoff, flags);
 
354
                addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
359
355
 
360
356
        return addr;
361
357
}
403
399
        }
404
400
}
405
401
 
 
402
SYSCALL_DEFINE1(sparc_brk, unsigned long, brk)
 
403
{
 
404
        /* People could try to be nasty and use ta 0x6d in 32bit programs */
 
405
        if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32)
 
406
                return current->mm->brk;
 
407
 
 
408
        if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk)))
 
409
                return current->mm->brk;
 
410
 
 
411
        return sys_brk(brk);
 
412
}
 
413
                                                                
406
414
/*
407
415
 * sys_pipe() is the normal C calling standard for creating
408
416
 * a pipe. It's not the way unix traditionally does this, though.
560
568
                unsigned long, prot, unsigned long, flags, unsigned long, fd,
561
569
                unsigned long, off)
562
570
{
563
 
        unsigned long retval = -EINVAL;
564
 
 
565
 
        if ((off + PAGE_ALIGN(len)) < off)
566
 
                goto out;
567
 
        if (off & ~PAGE_MASK)
568
 
                goto out;
569
 
        retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
 
571
        struct file * file = NULL;
 
572
        unsigned long retval = -EBADF;
 
573
 
 
574
        if (!(flags & MAP_ANONYMOUS)) {
 
575
                file = fget(fd);
 
576
                if (!file)
 
577
                        goto out;
 
578
        }
 
579
        flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
 
580
        len = PAGE_ALIGN(len);
 
581
 
 
582
        down_write(&current->mm->mmap_sem);
 
583
        retval = do_mmap(file, addr, len, prot, flags, off);
 
584
        up_write(&current->mm->mmap_sem);
 
585
 
 
586
        if (file)
 
587
                fput(file);
570
588
out:
571
589
        return retval;
572
590
}
596
614
 
597
615
        if (test_thread_flag(TIF_32BIT))
598
616
                goto out;
 
617
        if (unlikely(new_len >= VA_EXCLUDE_START))
 
618
                goto out;
 
619
        if (unlikely(sparc_mmap_check(addr, old_len)))
 
620
                goto out;
 
621
        if (unlikely(sparc_mmap_check(new_addr, new_len)))
 
622
                goto out;
599
623
 
600
624
        down_write(&current->mm->mmap_sem);
601
625
        ret = do_mremap(addr, old_len, new_len, flags, new_addr);