OMAP: Add new function to check wether there is irq pending
[linux-ginger.git] / arch / avr32 / kernel / sys_avr32.c
blob5d2daeaf356f73331489d5e21a8be7e440cb6a45
1 /*
2 * Copyright (C) 2004-2006 Atmel Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8 #include <linux/errno.h>
9 #include <linux/fs.h>
10 #include <linux/file.h>
11 #include <linux/mm.h>
12 #include <linux/unistd.h>
14 #include <asm/mman.h>
15 #include <asm/uaccess.h>
16 #include <asm/syscalls.h>
18 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
19 unsigned long prot, unsigned long flags,
20 unsigned long fd, off_t offset)
22 int error = -EBADF;
23 struct file *file = NULL;
25 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
26 if (!(flags & MAP_ANONYMOUS)) {
27 file = fget(fd);
28 if (!file)
29 return error;
32 down_write(&current->mm->mmap_sem);
33 error = do_mmap_pgoff(file, addr, len, prot, flags, offset);
34 up_write(&current->mm->mmap_sem);
36 if (file)
37 fput(file);
38 return error;
41 int kernel_execve(const char *file, char **argv, char **envp)
43 register long scno asm("r8") = __NR_execve;
44 register long sc1 asm("r12") = (long)file;
45 register long sc2 asm("r11") = (long)argv;
46 register long sc3 asm("r10") = (long)envp;
48 asm volatile("scall"
49 : "=r"(sc1)
50 : "r"(scno), "0"(sc1), "r"(sc2), "r"(sc3)
51 : "cc", "memory");
52 return sc1;