2 * MIPS specific syscalls
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 1995, 1996, 1997, 2000 by Ralf Baechle
10 #include <linux/errno.h>
11 #include <linux/linkage.h>
13 #include <linux/smp.h>
14 #include <linux/smp_lock.h>
15 #include <linux/sched.h>
16 #include <linux/string.h>
17 #include <linux/utsname.h>
19 #include <asm/cachectl.h>
20 #include <asm/pgalloc.h>
21 #include <asm/sysmips.h>
22 #include <asm/uaccess.h>
25 * How long a hostname can we get from user space?
26 * -EFAULT if invalid area or too long
28 * >0 EFAULT after xx bytes
31 get_max_hostname(unsigned long address
)
33 struct vm_area_struct
* vma
;
35 vma
= find_vma(current
->mm
, address
);
36 if (!vma
|| vma
->vm_start
> address
|| !(vma
->vm_flags
& VM_READ
))
38 address
= vma
->vm_end
- address
;
39 if (address
> PAGE_SIZE
)
41 if (vma
->vm_next
&& vma
->vm_next
->vm_start
== vma
->vm_end
&&
42 (vma
->vm_next
->vm_flags
& VM_READ
))
48 sys_sysmips(int cmd
, int arg1
, int arg2
, int arg3
)
52 int flags
, tmp
, len
, retval
, errno
;
56 char nodename
[__NEW_UTS_LEN
+ 1];
58 if (!capable(CAP_SYS_ADMIN
))
63 len
= strncpy_from_user(nodename
, name
, sizeof(nodename
));
68 strncpy(system_utsname
.nodename
, name
, len
);
70 system_utsname
.nodename
[len
] = '\0';
74 case MIPS_ATOMIC_SET
: {
75 /* This is broken in case of page faults and SMP ...
76 Risc/OS faults after maximum 20 tries with EAGAIN. */
80 errno
= verify_area(VERIFY_WRITE
, p
, sizeof(*p
));
85 errno
|= __get_user(tmp
, p
);
86 errno
|= __put_user(arg2
, p
);
92 return tmp
; /* This is broken ... */
96 tmp
= current
->thread
.mflags
& ~3;
97 current
->thread
.mflags
= tmp
| (arg1
& 3);
120 * No implemented yet ...
123 sys_cachectl(char *addr
, int nbytes
, int op
)
128 asmlinkage
int sys_pause(void)
130 current
->state
= TASK_INTERRUPTIBLE
;
132 return -ERESTARTNOHAND
;