aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/Makefile1
-rw-r--r--arch/mips/kernel/early_printk.c40
-rw-r--r--arch/mips/kernel/linux32.c173
-rw-r--r--arch/mips/kernel/scall64-n32.S4
-rw-r--r--arch/mips/kernel/scall64-o32.S4
-rw-r--r--arch/mips/kernel/setup.c8
6 files changed, 53 insertions, 177 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index a3dad394acb7..49246264cc7c 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -65,5 +65,6 @@ obj-$(CONFIG_64BIT) += cpu-bugs64.o
65obj-$(CONFIG_I8253) += i8253.o 65obj-$(CONFIG_I8253) += i8253.o
66 66
67obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 67obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
68obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
68 69
69CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 70CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c
new file mode 100644
index 000000000000..304efdc5682f
--- /dev/null
+++ b/arch/mips/kernel/early_printk.c
@@ -0,0 +1,40 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2007 MIPS Technologies, Inc.
8 * written by Ralf Baechle (ralf@linux-mips.org)
9 */
10#include <linux/console.h>
11#include <linux/init.h>
12
13extern void prom_putchar(char);
14
15static void early_console_write(struct console *con, const char *s, unsigned n)
16{
17 while (n-- && *s) {
18 if (*s == '\n')
19 prom_putchar('\r');
20 prom_putchar(*s);
21 s++;
22 }
23}
24
25static struct console early_console = {
26 .name = "early",
27 .write = early_console_write,
28 .flags = CON_PRINTBUFFER | CON_BOOT,
29 .index = -1
30};
31
32void __init setup_early_printk(void)
33{
34 register_console(&early_console);
35}
36
37void __init disable_early_printk(void)
38{
39 unregister_console(&early_console);
40}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index fc4dd6c9dd80..30d433f14f93 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -166,34 +166,6 @@ out:
166 return error; 166 return error;
167} 167}
168 168
169asmlinkage long
170sysn32_waitid(int which, compat_pid_t pid,
171 siginfo_t __user *uinfo, int options,
172 struct compat_rusage __user *uru)
173{
174 struct rusage ru;
175 long ret;
176 mm_segment_t old_fs = get_fs();
177 int si_signo;
178
179 if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo)))
180 return -EFAULT;
181
182 set_fs (KERNEL_DS);
183 ret = sys_waitid(which, pid, uinfo, options,
184 uru ? (struct rusage __user *) &ru : NULL);
185 set_fs (old_fs);
186
187 if (__get_user(si_signo, &uinfo->si_signo))
188 return -EFAULT;
189 if (ret < 0 || si_signo == 0)
190 return ret;
191
192 if (uru)
193 ret = put_compat_rusage(&ru, uru);
194 return ret;
195}
196
197#define RLIM_INFINITY32 0x7fffffff 169#define RLIM_INFINITY32 0x7fffffff
198#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x) 170#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
199 171
@@ -572,151 +544,6 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
572 flags); 544 flags);
573} 545}
574 546
575/* Argument list sizes for sys_socketcall */
576#define AL(x) ((x) * sizeof(unsigned int))
577static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
578 AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
579 AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
580#undef AL
581
582/*
583 * System call vectors.
584 *
585 * Argument checking cleaned up. Saved 20% in size.
586 * This function doesn't need to set the kernel lock because
587 * it is set by the callees.
588 */
589
590asmlinkage long sys32_socketcall(int call, unsigned int __user *args32)
591{
592 unsigned int a[6];
593 unsigned int a0,a1;
594 int err;
595
596 extern asmlinkage long sys_socket(int family, int type, int protocol);
597 extern asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
598 extern asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen);
599 extern asmlinkage long sys_listen(int fd, int backlog);
600 extern asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int __user *upeer_addrlen);
601 extern asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
602 extern asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
603 extern asmlinkage long sys_socketpair(int family, int type, int protocol, int __user *usockvec);
604 extern asmlinkage long sys_send(int fd, void __user * buff, size_t len, unsigned flags);
605 extern asmlinkage long sys_sendto(int fd, void __user * buff, size_t len, unsigned flags,
606 struct sockaddr __user *addr, int addr_len);
607 extern asmlinkage long sys_recv(int fd, void __user * ubuf, size_t size, unsigned flags);
608 extern asmlinkage long sys_recvfrom(int fd, void __user * ubuf, size_t size, unsigned flags,
609 struct sockaddr __user *addr, int __user *addr_len);
610 extern asmlinkage long sys_shutdown(int fd, int how);
611 extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen);
612 extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen);
613 extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
614 extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags);
615
616
617 if(call<1||call>SYS_RECVMSG)
618 return -EINVAL;
619
620 /* copy_from_user should be SMP safe. */
621 if (copy_from_user(a, args32, socketcall_nargs[call]))
622 return -EFAULT;
623
624 a0=a[0];
625 a1=a[1];
626
627 switch(call)
628 {
629 case SYS_SOCKET:
630 err = sys_socket(a0,a1,a[2]);
631 break;
632 case SYS_BIND:
633 err = sys_bind(a0,(struct sockaddr __user *)A(a1), a[2]);
634 break;
635 case SYS_CONNECT:
636 err = sys_connect(a0, (struct sockaddr __user *)A(a1), a[2]);
637 break;
638 case SYS_LISTEN:
639 err = sys_listen(a0,a1);
640 break;
641 case SYS_ACCEPT:
642 err = sys_accept(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
643 break;
644 case SYS_GETSOCKNAME:
645 err = sys_getsockname(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
646 break;
647 case SYS_GETPEERNAME:
648 err = sys_getpeername(a0, (struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
649 break;
650 case SYS_SOCKETPAIR:
651 err = sys_socketpair(a0,a1, a[2], (int __user *)A(a[3]));
652 break;
653 case SYS_SEND:
654 err = sys_send(a0, (void __user *)A(a1), a[2], a[3]);
655 break;
656 case SYS_SENDTO:
657 err = sys_sendto(a0,(void __user *)A(a1), a[2], a[3],
658 (struct sockaddr __user *)A(a[4]), a[5]);
659 break;
660 case SYS_RECV:
661 err = sys_recv(a0, (void __user *)A(a1), a[2], a[3]);
662 break;
663 case SYS_RECVFROM:
664 err = sys_recvfrom(a0, (void __user *)A(a1), a[2], a[3],
665 (struct sockaddr __user *)A(a[4]), (int __user *)A(a[5]));
666 break;
667 case SYS_SHUTDOWN:
668 err = sys_shutdown(a0,a1);
669 break;
670 case SYS_SETSOCKOPT:
671 err = sys_setsockopt(a0, a1, a[2], (char __user *)A(a[3]), a[4]);
672 break;
673 case SYS_GETSOCKOPT:
674 err = sys_getsockopt(a0, a1, a[2], (char __user *)A(a[3]), (int __user *)A(a[4]));
675 break;
676 case SYS_SENDMSG:
677 err = sys_sendmsg(a0, (struct msghdr __user *) A(a1), a[2]);
678 break;
679 case SYS_RECVMSG:
680 err = sys_recvmsg(a0, (struct msghdr __user *) A(a1), a[2]);
681 break;
682 default:
683 err = -EINVAL;
684 break;
685 }
686 return err;
687}
688
689struct sigevent32 {
690 u32 sigev_value;
691 u32 sigev_signo;
692 u32 sigev_notify;
693 u32 payload[(64 / 4) - 3];
694};
695
696extern asmlinkage long
697sys_timer_create(clockid_t which_clock,
698 struct sigevent __user *timer_event_spec,
699 timer_t __user * created_timer_id);
700
701long
702sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
703{
704 struct sigevent __user *p = NULL;
705 if (se32) {
706 struct sigevent se;
707 p = compat_alloc_user_space(sizeof(struct sigevent));
708 memset(&se, 0, sizeof(struct sigevent));
709 if (get_user(se.sigev_value.sival_int, &se32->sigev_value) ||
710 __get_user(se.sigev_signo, &se32->sigev_signo) ||
711 __get_user(se.sigev_notify, &se32->sigev_notify) ||
712 __copy_from_user(&se._sigev_un._pad, &se32->payload,
713 sizeof(se32->payload)) ||
714 copy_to_user(p, &se, sizeof(se)))
715 return -EFAULT;
716 }
717 return sys_timer_create(clock, p, timer_id);
718}
719
720save_static_function(sys32_clone); 547save_static_function(sys32_clone);
721__attribute_used__ noinline static int 548__attribute_used__ noinline static int
722_sys32_clone(nabi_no_regargs struct pt_regs regs) 549_sys32_clone(nabi_no_regargs struct pt_regs regs)
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 2ceda4644a4d..f17e31e3bff2 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -340,7 +340,7 @@ EXPORT(sysn32_call_table)
340 PTR compat_sys_statfs64 340 PTR compat_sys_statfs64
341 PTR compat_sys_fstatfs64 341 PTR compat_sys_fstatfs64
342 PTR sys_sendfile64 342 PTR sys_sendfile64
343 PTR sys32_timer_create /* 6220 */ 343 PTR compat_sys_timer_create /* 6220 */
344 PTR compat_sys_timer_settime 344 PTR compat_sys_timer_settime
345 PTR compat_sys_timer_gettime 345 PTR compat_sys_timer_gettime
346 PTR sys_timer_getoverrun 346 PTR sys_timer_getoverrun
@@ -361,7 +361,7 @@ EXPORT(sysn32_call_table)
361 PTR compat_sys_mq_notify 361 PTR compat_sys_mq_notify
362 PTR compat_sys_mq_getsetattr 362 PTR compat_sys_mq_getsetattr
363 PTR sys_ni_syscall /* 6240, sys_vserver */ 363 PTR sys_ni_syscall /* 6240, sys_vserver */
364 PTR sysn32_waitid 364 PTR compat_sys_waitid
365 PTR sys_ni_syscall /* available, was setaltroot */ 365 PTR sys_ni_syscall /* available, was setaltroot */
366 PTR sys_add_key 366 PTR sys_add_key
367 PTR sys_request_key 367 PTR sys_request_key
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index bcc42489dc3c..142c9b70c026 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -307,7 +307,7 @@ sys_call_table:
307 PTR compat_sys_statfs 307 PTR compat_sys_statfs
308 PTR compat_sys_fstatfs /* 4100 */ 308 PTR compat_sys_fstatfs /* 4100 */
309 PTR sys_ni_syscall /* sys_ioperm */ 309 PTR sys_ni_syscall /* sys_ioperm */
310 PTR sys32_socketcall 310 PTR compat_sys_socketcall
311 PTR sys_syslog 311 PTR sys_syslog
312 PTR compat_sys_setitimer 312 PTR compat_sys_setitimer
313 PTR compat_sys_getitimer /* 4105 */ 313 PTR compat_sys_getitimer /* 4105 */
@@ -462,7 +462,7 @@ sys_call_table:
462 PTR sys_fadvise64_64 462 PTR sys_fadvise64_64
463 PTR compat_sys_statfs64 /* 4255 */ 463 PTR compat_sys_statfs64 /* 4255 */
464 PTR compat_sys_fstatfs64 464 PTR compat_sys_fstatfs64
465 PTR sys32_timer_create 465 PTR compat_sys_timer_create
466 PTR compat_sys_timer_settime 466 PTR compat_sys_timer_settime
467 PTR compat_sys_timer_gettime 467 PTR compat_sys_timer_gettime
468 PTR sys_timer_getoverrun /* 4260 */ 468 PTR sys_timer_getoverrun /* 4260 */
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 11ab222a2e97..4975da0bfb63 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -525,6 +525,14 @@ void __init setup_arch(char **cmdline_p)
525{ 525{
526 cpu_probe(); 526 cpu_probe();
527 prom_init(); 527 prom_init();
528
529#ifdef CONFIG_EARLY_PRINTK
530 {
531 extern void setup_early_printk(void);
532
533 setup_early_printk();
534 }
535#endif
528 cpu_report(); 536 cpu_report();
529 537
530#if defined(CONFIG_VT) 538#if defined(CONFIG_VT)