diff options
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/Makefile | 6 | ||||
-rw-r--r-- | arch/mips/kernel/early_printk.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/gpio_txx9.c | 10 | ||||
-rw-r--r-- | arch/mips/kernel/i8253.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/irix5sys.S | 1041 | ||||
-rw-r--r-- | arch/mips/kernel/irixelf.c | 1361 | ||||
-rw-r--r-- | arch/mips/kernel/irixinv.c | 78 | ||||
-rw-r--r-- | arch/mips/kernel/irixioctl.c | 213 | ||||
-rw-r--r-- | arch/mips/kernel/irixsig.c | 888 | ||||
-rw-r--r-- | arch/mips/kernel/irq.c | 4 | ||||
-rw-r--r-- | arch/mips/kernel/mips-mt.c | 11 | ||||
-rw-r--r-- | arch/mips/kernel/process.c | 7 | ||||
-rw-r--r-- | arch/mips/kernel/scall32-o32.S | 19 | ||||
-rw-r--r-- | arch/mips/kernel/setup.c | 13 | ||||
-rw-r--r-- | arch/mips/kernel/sysirix.c | 2140 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 14 |
16 files changed, 20 insertions, 5789 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index 65e46a6d4178..0fd31974ba28 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -20,9 +20,6 @@ obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o | |||
20 | obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o | 20 | obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o |
21 | obj-$(CONFIG_SYNC_R4K) += sync-r4k.o | 21 | obj-$(CONFIG_SYNC_R4K) += sync-r4k.o |
22 | 22 | ||
23 | binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ | ||
24 | irix5sys.o sysirix.o | ||
25 | |||
26 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 23 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
27 | obj-$(CONFIG_MODULES) += mips_ksyms.o module.o | 24 | obj-$(CONFIG_MODULES) += mips_ksyms.o module.o |
28 | 25 | ||
@@ -63,14 +60,13 @@ obj-$(CONFIG_I8259) += i8259.o | |||
63 | obj-$(CONFIG_IRQ_CPU) += irq_cpu.o | 60 | obj-$(CONFIG_IRQ_CPU) += irq_cpu.o |
64 | obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o | 61 | obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o |
65 | obj-$(CONFIG_IRQ_CPU_RM9K) += irq-rm9000.o | 62 | obj-$(CONFIG_IRQ_CPU_RM9K) += irq-rm9000.o |
66 | obj-$(CONFIG_MIPS_BOARDS_GEN) += irq-msc01.o | 63 | obj-$(CONFIG_MIPS_MSC) += irq-msc01.o |
67 | obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o | 64 | obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o |
68 | obj-$(CONFIG_IRQ_GT641XX) += irq-gt641xx.o | 65 | obj-$(CONFIG_IRQ_GT641XX) += irq-gt641xx.o |
69 | obj-$(CONFIG_IRQ_GIC) += irq-gic.o | 66 | obj-$(CONFIG_IRQ_GIC) += irq-gic.o |
70 | 67 | ||
71 | obj-$(CONFIG_32BIT) += scall32-o32.o | 68 | obj-$(CONFIG_32BIT) += scall32-o32.o |
72 | obj-$(CONFIG_64BIT) += scall64-64.o | 69 | obj-$(CONFIG_64BIT) += scall64-64.o |
73 | obj-$(CONFIG_BINFMT_IRIX) += binfmt_irix.o | ||
74 | obj-$(CONFIG_MIPS32_COMPAT) += linux32.o ptrace32.o signal32.o | 70 | obj-$(CONFIG_MIPS32_COMPAT) += linux32.o ptrace32.o signal32.o |
75 | obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o | 71 | obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o |
76 | obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o | 72 | obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o |
diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c index 9dccfa4752b2..9ae813eb782e 100644 --- a/arch/mips/kernel/early_printk.c +++ b/arch/mips/kernel/early_printk.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/console.h> | 10 | #include <linux/console.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | 12 | ||
13 | #include <asm/setup.h> | ||
14 | |||
13 | extern void prom_putchar(char); | 15 | extern void prom_putchar(char); |
14 | 16 | ||
15 | static void __init | 17 | static void __init |
diff --git a/arch/mips/kernel/gpio_txx9.c b/arch/mips/kernel/gpio_txx9.c index b1436a857998..c6854d9df926 100644 --- a/arch/mips/kernel/gpio_txx9.c +++ b/arch/mips/kernel/gpio_txx9.c | |||
@@ -47,23 +47,25 @@ static void txx9_gpio_set(struct gpio_chip *chip, unsigned int offset, | |||
47 | 47 | ||
48 | static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset) | 48 | static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset) |
49 | { | 49 | { |
50 | spin_lock_irq(&txx9_gpio_lock); | 50 | unsigned long flags; |
51 | spin_lock_irqsave(&txx9_gpio_lock, flags); | ||
51 | __raw_writel(__raw_readl(&txx9_pioptr->dir) & ~(1 << offset), | 52 | __raw_writel(__raw_readl(&txx9_pioptr->dir) & ~(1 << offset), |
52 | &txx9_pioptr->dir); | 53 | &txx9_pioptr->dir); |
53 | mmiowb(); | 54 | mmiowb(); |
54 | spin_unlock_irq(&txx9_gpio_lock); | 55 | spin_unlock_irqrestore(&txx9_gpio_lock, flags); |
55 | return 0; | 56 | return 0; |
56 | } | 57 | } |
57 | 58 | ||
58 | static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset, | 59 | static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset, |
59 | int value) | 60 | int value) |
60 | { | 61 | { |
61 | spin_lock_irq(&txx9_gpio_lock); | 62 | unsigned long flags; |
63 | spin_lock_irqsave(&txx9_gpio_lock, flags); | ||
62 | txx9_gpio_set_raw(offset, value); | 64 | txx9_gpio_set_raw(offset, value); |
63 | __raw_writel(__raw_readl(&txx9_pioptr->dir) | (1 << offset), | 65 | __raw_writel(__raw_readl(&txx9_pioptr->dir) | (1 << offset), |
64 | &txx9_pioptr->dir); | 66 | &txx9_pioptr->dir); |
65 | mmiowb(); | 67 | mmiowb(); |
66 | spin_unlock_irq(&txx9_gpio_lock); | 68 | spin_unlock_irqrestore(&txx9_gpio_lock, flags); |
67 | return 0; | 69 | return 0; |
68 | } | 70 | } |
69 | 71 | ||
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c index 38fa1a194bf4..b6ac55162b9a 100644 --- a/arch/mips/kernel/i8253.c +++ b/arch/mips/kernel/i8253.c | |||
@@ -80,7 +80,7 @@ static int pit_next_event(unsigned long delta, struct clock_event_device *evt) | |||
80 | * registered. This mechanism replaces the previous #ifdef LOCAL_APIC - | 80 | * registered. This mechanism replaces the previous #ifdef LOCAL_APIC - |
81 | * !using_apic_timer decisions in do_timer_interrupt_hook() | 81 | * !using_apic_timer decisions in do_timer_interrupt_hook() |
82 | */ | 82 | */ |
83 | struct clock_event_device pit_clockevent = { | 83 | static struct clock_event_device pit_clockevent = { |
84 | .name = "pit", | 84 | .name = "pit", |
85 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 85 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
86 | .set_mode = init_pit_timer, | 86 | .set_mode = init_pit_timer, |
diff --git a/arch/mips/kernel/irix5sys.S b/arch/mips/kernel/irix5sys.S deleted file mode 100644 index eeef891093ed..000000000000 --- a/arch/mips/kernel/irix5sys.S +++ /dev/null | |||
@@ -1,1041 +0,0 @@ | |||
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 | * 32-bit IRIX5 ABI system call table derived from original file 'irix5sys.h' | ||
7 | * created by David S. Miller. | ||
8 | * | ||
9 | * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com> | ||
10 | * Copyright (C) 2004 Steven J. Hill <sjhill@realitydiluted.com> | ||
11 | */ | ||
12 | #include <asm/asm.h> | ||
13 | |||
14 | /* | ||
15 | * Key: | ||
16 | * V == Valid and should work as expected for most cases. | ||
17 | * HV == Half Valid, some things will work, some likely will not | ||
18 | * IV == InValid, certainly will not work at all yet | ||
19 | * ?V == ?'ably Valid, I have not done enough looking into it | ||
20 | * DC == Don't Care, a rats ass we couldn't give | ||
21 | */ | ||
22 | |||
23 | .macro irix5syscalltable | ||
24 | |||
25 | sys sys_syscall 0 /* 1000 sysindir() V*/ | ||
26 | sys sys_exit 1 /* 1001 exit() V*/ | ||
27 | sys sys_fork 0 /* 1002 fork() V*/ | ||
28 | sys sys_read 3 /* 1003 read() V*/ | ||
29 | sys sys_write 3 /* 1004 write() V*/ | ||
30 | sys sys_open 3 /* 1005 open() V*/ | ||
31 | sys sys_close 1 /* 1006 close() V*/ | ||
32 | sys irix_unimp 0 /* 1007 (XXX IRIX 4 wait) V*/ | ||
33 | sys sys_creat 2 /* 1008 creat() V*/ | ||
34 | sys sys_link 2 /* 1009 link() V*/ | ||
35 | sys sys_unlink 1 /* 1010 unlink() V*/ | ||
36 | sys irix_exec 0 /* 1011 exec() V*/ | ||
37 | sys sys_chdir 1 /* 1012 chdir() V*/ | ||
38 | sys irix_gtime 0 /* 1013 time() V*/ | ||
39 | sys irix_unimp 0 /* 1014 (XXX IRIX 4 mknod) V*/ | ||
40 | sys sys_chmod 2 /* 1015 chmod() V*/ | ||
41 | sys sys_chown 3 /* 1016 chown() V*/ | ||
42 | sys irix_brk 1 /* 1017 break() V*/ | ||
43 | sys irix_unimp 0 /* 1018 (XXX IRIX 4 stat) V*/ | ||
44 | sys sys_lseek 3 /* 1019 lseek() XXX64bit HV*/ | ||
45 | sys irix_getpid 0 /* 1020 getpid() V*/ | ||
46 | sys irix_mount 6 /* 1021 mount() IV*/ | ||
47 | sys sys_umount 1 /* 1022 umount() V*/ | ||
48 | sys sys_setuid 1 /* 1023 setuid() V*/ | ||
49 | sys irix_getuid 0 /* 1024 getuid() V*/ | ||
50 | sys irix_stime 1 /* 1025 stime() V*/ | ||
51 | sys irix_unimp 4 /* 1026 XXX ptrace() IV*/ | ||
52 | sys irix_alarm 1 /* 1027 alarm() V*/ | ||
53 | sys irix_unimp 0 /* 1028 (XXX IRIX 4 fstat) V*/ | ||
54 | sys irix_pause 0 /* 1029 pause() V*/ | ||
55 | sys sys_utime 2 /* 1030 utime() V*/ | ||
56 | sys irix_unimp 0 /* 1031 nuthin' V*/ | ||
57 | sys irix_unimp 0 /* 1032 nobody home man... V*/ | ||
58 | sys sys_access 2 /* 1033 access() V*/ | ||
59 | sys sys_nice 1 /* 1034 nice() V*/ | ||
60 | sys irix_statfs 2 /* 1035 statfs() V*/ | ||
61 | sys sys_sync 0 /* 1036 sync() V*/ | ||
62 | sys sys_kill 2 /* 1037 kill() V*/ | ||
63 | sys irix_fstatfs 2 /* 1038 fstatfs() V*/ | ||
64 | sys irix_setpgrp 1 /* 1039 setpgrp() V*/ | ||
65 | sys irix_syssgi 0 /* 1040 syssgi() HV*/ | ||
66 | sys sys_dup 1 /* 1041 dup() V*/ | ||
67 | sys sys_pipe 0 /* 1042 pipe() V*/ | ||
68 | sys irix_times 1 /* 1043 times() V*/ | ||
69 | sys irix_unimp 0 /* 1044 XXX profil() IV*/ | ||
70 | sys irix_unimp 0 /* 1045 XXX lock() IV*/ | ||
71 | sys sys_setgid 1 /* 1046 setgid() V*/ | ||
72 | sys irix_getgid 0 /* 1047 getgid() V*/ | ||
73 | sys irix_unimp 0 /* 1048 (XXX IRIX 4 ssig) V*/ | ||
74 | sys irix_msgsys 6 /* 1049 sys_msgsys V*/ | ||
75 | sys sys_sysmips 4 /* 1050 sysmips() HV*/ | ||
76 | sys irix_unimp 0 /* 1051 XXX sysacct() IV*/ | ||
77 | sys irix_shmsys 5 /* 1052 sys_shmsys V*/ | ||
78 | sys irix_semsys 0 /* 1053 sys_semsys V*/ | ||
79 | sys irix_ioctl 3 /* 1054 ioctl() HV*/ | ||
80 | sys irix_uadmin 0 /* 1055 XXX sys_uadmin() HC*/ | ||
81 | sys irix_sysmp 0 /* 1056 sysmp() HV*/ | ||
82 | sys irix_utssys 4 /* 1057 sys_utssys() HV*/ | ||
83 | sys irix_unimp 0 /* 1058 nada enchilada V*/ | ||
84 | sys irix_exece 0 /* 1059 exece() V*/ | ||
85 | sys sys_umask 1 /* 1060 umask() V*/ | ||
86 | sys sys_chroot 1 /* 1061 chroot() V*/ | ||
87 | sys irix_fcntl 3 /* 1062 fcntl() ?V*/ | ||
88 | sys irix_ulimit 2 /* 1063 ulimit() HV*/ | ||
89 | sys irix_unimp 0 /* 1064 XXX AFS shit DC*/ | ||
90 | sys irix_unimp 0 /* 1065 XXX AFS shit DC*/ | ||
91 | sys irix_unimp 0 /* 1066 XXX AFS shit DC*/ | ||
92 | sys irix_unimp 0 /* 1067 XXX AFS shit DC*/ | ||
93 | sys irix_unimp 0 /* 1068 XXX AFS shit DC*/ | ||
94 | sys irix_unimp 0 /* 1069 XXX AFS shit DC*/ | ||
95 | sys irix_unimp 0 /* 1070 XXX AFS shit DC*/ | ||
96 | sys irix_unimp 0 /* 1071 XXX AFS shit DC*/ | ||
97 | sys irix_unimp 0 /* 1072 XXX AFS shit DC*/ | ||
98 | sys irix_unimp 0 /* 1073 XXX AFS shit DC*/ | ||
99 | sys irix_unimp 0 /* 1074 nuttin' V*/ | ||
100 | sys irix_unimp 0 /* 1075 XXX sys_getrlimit64()IV*/ | ||
101 | sys irix_unimp 0 /* 1076 XXX sys_setrlimit64()IV*/ | ||
102 | sys sys_nanosleep 2 /* 1077 nanosleep() V*/ | ||
103 | sys irix_lseek64 5 /* 1078 lseek64() ?V*/ | ||
104 | sys sys_rmdir 1 /* 1079 rmdir() V*/ | ||
105 | sys sys_mkdir 2 /* 1080 mkdir() V*/ | ||
106 | sys sys_getdents 3 /* 1081 getdents() V*/ | ||
107 | sys irix_sginap 1 /* 1082 sys_sginap() V*/ | ||
108 | sys irix_sgikopt 3 /* 1083 sys_sgikopt() DC*/ | ||
109 | sys sys_sysfs 3 /* 1084 sysfs() ?V*/ | ||
110 | sys irix_unimp 0 /* 1085 XXX sys_getmsg() DC*/ | ||
111 | sys irix_unimp 0 /* 1086 XXX sys_putmsg() DC*/ | ||
112 | sys sys_poll 3 /* 1087 poll() V*/ | ||
113 | sys irix_sigreturn 0 /* 1088 sigreturn() ?V*/ | ||
114 | sys sys_accept 3 /* 1089 accept() V*/ | ||
115 | sys sys_bind 3 /* 1090 bind() V*/ | ||
116 | sys sys_connect 3 /* 1091 connect() V*/ | ||
117 | sys irix_gethostid 0 /* 1092 sys_gethostid() ?V*/ | ||
118 | sys sys_getpeername 3 /* 1093 getpeername() V*/ | ||
119 | sys sys_getsockname 3 /* 1094 getsockname() V*/ | ||
120 | sys sys_getsockopt 5 /* 1095 getsockopt() V*/ | ||
121 | sys sys_listen 2 /* 1096 listen() V*/ | ||
122 | sys sys_recv 4 /* 1097 recv() V*/ | ||
123 | sys sys_recvfrom 6 /* 1098 recvfrom() V*/ | ||
124 | sys sys_recvmsg 3 /* 1099 recvmsg() V*/ | ||
125 | sys sys_select 5 /* 1100 select() V*/ | ||
126 | sys sys_send 4 /* 1101 send() V*/ | ||
127 | sys sys_sendmsg 3 /* 1102 sendmsg() V*/ | ||
128 | sys sys_sendto 6 /* 1103 sendto() V*/ | ||
129 | sys irix_sethostid 1 /* 1104 sys_sethostid() ?V*/ | ||
130 | sys sys_setsockopt 5 /* 1105 setsockopt() V*/ | ||
131 | sys sys_shutdown 2 /* 1106 shutdown() ?V*/ | ||
132 | sys irix_socket 3 /* 1107 socket() V*/ | ||
133 | sys sys_gethostname 2 /* 1108 sys_gethostname() ?V*/ | ||
134 | sys sys_sethostname 2 /* 1109 sethostname() ?V*/ | ||
135 | sys irix_getdomainname 2 /* 1110 sys_getdomainname() ?V*/ | ||
136 | sys sys_setdomainname 2 /* 1111 setdomainname() ?V*/ | ||
137 | sys sys_truncate 2 /* 1112 truncate() V*/ | ||
138 | sys sys_ftruncate 2 /* 1113 ftruncate() V*/ | ||
139 | sys sys_rename 2 /* 1114 rename() V*/ | ||
140 | sys sys_symlink 2 /* 1115 symlink() V*/ | ||
141 | sys sys_readlink 3 /* 1116 readlink() V*/ | ||
142 | sys irix_unimp 0 /* 1117 XXX IRIX 4 lstat() DC*/ | ||
143 | sys irix_unimp 0 /* 1118 nothin' V*/ | ||
144 | sys irix_unimp 0 /* 1119 XXX nfs_svc() DC*/ | ||
145 | sys irix_unimp 0 /* 1120 XXX nfs_getfh() DC*/ | ||
146 | sys irix_unimp 0 /* 1121 XXX async_daemon() DC*/ | ||
147 | sys irix_unimp 0 /* 1122 XXX exportfs() DC*/ | ||
148 | sys sys_setregid 2 /* 1123 setregid() V*/ | ||
149 | sys sys_setreuid 2 /* 1124 setreuid() V*/ | ||
150 | sys sys_getitimer 2 /* 1125 getitimer() V*/ | ||
151 | sys sys_setitimer 3 /* 1126 setitimer() V*/ | ||
152 | sys irix_unimp 1 /* 1127 XXX adjtime() IV*/ | ||
153 | sys irix_gettimeofday 1 /* 1128 gettimeofday() V*/ | ||
154 | sys irix_unimp 0 /* 1129 XXX sproc() IV*/ | ||
155 | sys irix_prctl 0 /* 1130 prctl() HV*/ | ||
156 | sys irix_unimp 0 /* 1131 XXX procblk() IV*/ | ||
157 | sys irix_unimp 0 /* 1132 XXX sprocsp() IV*/ | ||
158 | sys irix_unimp 0 /* 1133 XXX sgigsc() IV*/ | ||
159 | sys irix_mmap32 6 /* 1134 mmap() XXXflags? ?V*/ | ||
160 | sys sys_munmap 2 /* 1135 munmap() V*/ | ||
161 | sys sys_mprotect 3 /* 1136 mprotect() V*/ | ||
162 | sys sys_msync 4 /* 1137 msync() V*/ | ||
163 | sys irix_madvise 3 /* 1138 madvise() DC*/ | ||
164 | sys irix_pagelock 3 /* 1139 pagelock() IV*/ | ||
165 | sys irix_getpagesize 0 /* 1140 getpagesize() V*/ | ||
166 | sys irix_quotactl 0 /* 1141 quotactl() V*/ | ||
167 | sys irix_unimp 0 /* 1142 nobody home man V*/ | ||
168 | sys sys_getpgid 1 /* 1143 BSD getpgrp() V*/ | ||
169 | sys irix_BSDsetpgrp 2 /* 1143 BSD setpgrp() V*/ | ||
170 | sys sys_vhangup 0 /* 1144 vhangup() V*/ | ||
171 | sys sys_fsync 1 /* 1145 fsync() V*/ | ||
172 | sys sys_fchdir 1 /* 1146 fchdir() V*/ | ||
173 | sys sys_getrlimit 2 /* 1147 getrlimit() ?V*/ | ||
174 | sys sys_setrlimit 2 /* 1148 setrlimit() ?V*/ | ||
175 | sys sys_cacheflush 3 /* 1150 cacheflush() HV*/ | ||
176 | sys sys_cachectl 3 /* 1151 cachectl() HV*/ | ||
177 | sys sys_fchown 3 /* 1152 fchown() ?V*/ | ||
178 | sys sys_fchmod 2 /* 1153 fchmod() ?V*/ | ||
179 | sys irix_unimp 0 /* 1154 XXX IRIX 4 wait3() V*/ | ||
180 | sys sys_socketpair 4 /* 1155 socketpair() V*/ | ||
181 | sys irix_systeminfo 3 /* 1156 systeminfo() IV*/ | ||
182 | sys irix_uname 1 /* 1157 uname() IV*/ | ||
183 | sys irix_xstat 3 /* 1158 xstat() V*/ | ||
184 | sys irix_lxstat 3 /* 1159 lxstat() V*/ | ||
185 | sys irix_fxstat 3 /* 1160 fxstat() V*/ | ||
186 | sys irix_xmknod 0 /* 1161 xmknod() ?V*/ | ||
187 | sys irix_sigaction 4 /* 1162 sigaction() ?V*/ | ||
188 | sys irix_sigpending 1 /* 1163 sigpending() ?V*/ | ||
189 | sys irix_sigprocmask 3 /* 1164 sigprocmask() ?V*/ | ||
190 | sys irix_sigsuspend 0 /* 1165 sigsuspend() ?V*/ | ||
191 | sys irix_sigpoll_sys 3 /* 1166 sigpoll_sys() IV*/ | ||
192 | sys irix_swapctl 2 /* 1167 swapctl() IV*/ | ||
193 | sys irix_getcontext 0 /* 1168 getcontext() HV*/ | ||
194 | sys irix_setcontext 0 /* 1169 setcontext() HV*/ | ||
195 | sys irix_waitsys 5 /* 1170 waitsys() IV*/ | ||
196 | sys irix_sigstack 2 /* 1171 sigstack() HV*/ | ||
197 | sys irix_sigaltstack 2 /* 1172 sigaltstack() HV*/ | ||
198 | sys irix_sigsendset 2 /* 1173 sigsendset() IV*/ | ||
199 | sys irix_statvfs 2 /* 1174 statvfs() V*/ | ||
200 | sys irix_fstatvfs 2 /* 1175 fstatvfs() V*/ | ||
201 | sys irix_unimp 0 /* 1176 XXX getpmsg() DC*/ | ||
202 | sys irix_unimp 0 /* 1177 XXX putpmsg() DC*/ | ||
203 | sys sys_lchown 3 /* 1178 lchown() V*/ | ||
204 | sys irix_priocntl 0 /* 1179 priocntl() DC*/ | ||
205 | sys irix_sigqueue 4 /* 1180 sigqueue() IV*/ | ||
206 | sys sys_readv 3 /* 1181 readv() V*/ | ||
207 | sys sys_writev 3 /* 1182 writev() V*/ | ||
208 | sys irix_truncate64 4 /* 1183 truncate64() XX32bit HV*/ | ||
209 | sys irix_ftruncate64 4 /* 1184 ftruncate64()XX32bit HV*/ | ||
210 | sys irix_mmap64 0 /* 1185 mmap64() XX32bit HV*/ | ||
211 | sys irix_dmi 0 /* 1186 dmi() DC*/ | ||
212 | sys irix_pread 6 /* 1187 pread() IV*/ | ||
213 | sys irix_pwrite 6 /* 1188 pwrite() IV*/ | ||
214 | sys sys_fsync 1 /* 1189 fdatasync() XXPOSIX HV*/ | ||
215 | sys irix_sgifastpath 7 /* 1190 sgifastpath() WHEEE IV*/ | ||
216 | sys irix_unimp 0 /* 1191 XXX attr_get() DC*/ | ||
217 | sys irix_unimp 0 /* 1192 XXX attr_getf() DC*/ | ||
218 | sys irix_unimp 0 /* 1193 XXX attr_set() DC*/ | ||
219 | sys irix_unimp 0 /* 1194 XXX attr_setf() DC*/ | ||
220 | sys irix_unimp 0 /* 1195 XXX attr_remove() DC*/ | ||
221 | sys irix_unimp 0 /* 1196 XXX attr_removef() DC*/ | ||
222 | sys irix_unimp 0 /* 1197 XXX attr_list() DC*/ | ||
223 | sys irix_unimp 0 /* 1198 XXX attr_listf() DC*/ | ||
224 | sys irix_unimp 0 /* 1199 XXX attr_multi() DC*/ | ||
225 | sys irix_unimp 0 /* 1200 XXX attr_multif() DC*/ | ||
226 | sys irix_statvfs64 2 /* 1201 statvfs64() V*/ | ||
227 | sys irix_fstatvfs64 2 /* 1202 fstatvfs64() V*/ | ||
228 | sys irix_getmountid 2 /* 1203 getmountid()XXXfsids HV*/ | ||
229 | sys irix_nsproc 5 /* 1204 nsproc() IV*/ | ||
230 | sys irix_getdents64 3 /* 1205 getdents64() HV*/ | ||
231 | sys irix_unimp 0 /* 1206 XXX DFS garbage DC*/ | ||
232 | sys irix_ngetdents 4 /* 1207 ngetdents() XXXeop HV*/ | ||
233 | sys irix_ngetdents64 4 /* 1208 ngetdents64() XXXeop HV*/ | ||
234 | sys irix_unimp 0 /* 1209 nothin' V*/ | ||
235 | sys irix_unimp 0 /* 1210 XXX pidsprocsp() */ | ||
236 | sys irix_unimp 0 /* 1211 XXX rexec() */ | ||
237 | sys irix_unimp 0 /* 1212 XXX timer_create() */ | ||
238 | sys irix_unimp 0 /* 1213 XXX timer_delete() */ | ||
239 | sys irix_unimp 0 /* 1214 XXX timer_settime() */ | ||
240 | sys irix_unimp 0 /* 1215 XXX timer_gettime() */ | ||
241 | sys irix_unimp 0 /* 1216 XXX timer_setoverrun() */ | ||
242 | sys sys_sched_rr_get_interval 2 /* 1217 sched_rr_get_interval()V*/ | ||
243 | sys sys_sched_yield 0 /* 1218 sched_yield() V*/ | ||
244 | sys sys_sched_getscheduler 1 /* 1219 sched_getscheduler() V*/ | ||
245 | sys sys_sched_setscheduler 3 /* 1220 sched_setscheduler() V*/ | ||
246 | sys sys_sched_getparam 2 /* 1221 sched_getparam() V*/ | ||
247 | sys sys_sched_setparam 2 /* 1222 sched_setparam() V*/ | ||
248 | sys irix_unimp 0 /* 1223 XXX usync_cntl() */ | ||
249 | sys irix_unimp 0 /* 1224 XXX psema_cntl() */ | ||
250 | sys irix_unimp 0 /* 1225 XXX restartreturn() */ | ||
251 | |||
252 | /* Just to pad things out nicely. */ | ||
253 | sys irix_unimp 0 | ||
254 | sys irix_unimp 0 | ||
255 | sys irix_unimp 0 | ||
256 | sys irix_unimp 0 | ||
257 | sys irix_unimp 0 | ||
258 | sys irix_unimp 0 | ||
259 | sys irix_unimp 0 | ||
260 | sys irix_unimp 0 | ||
261 | sys irix_unimp 0 | ||
262 | sys irix_unimp 0 | ||
263 | sys irix_unimp 0 | ||
264 | sys irix_unimp 0 | ||
265 | sys irix_unimp 0 | ||
266 | sys irix_unimp 0 | ||
267 | sys irix_unimp 0 | ||
268 | sys irix_unimp 0 | ||
269 | sys irix_unimp 0 | ||
270 | sys irix_unimp 0 | ||
271 | sys irix_unimp 0 | ||
272 | sys irix_unimp 0 | ||
273 | sys irix_unimp 0 | ||
274 | sys irix_unimp 0 | ||
275 | sys irix_unimp 0 | ||
276 | sys irix_unimp 0 | ||
277 | sys irix_unimp 0 | ||
278 | sys irix_unimp 0 | ||
279 | sys irix_unimp 0 | ||
280 | sys irix_unimp 0 | ||
281 | sys irix_unimp 0 | ||
282 | sys irix_unimp 0 | ||
283 | sys irix_unimp 0 | ||
284 | sys irix_unimp 0 | ||
285 | sys irix_unimp 0 | ||
286 | sys irix_unimp 0 | ||
287 | sys irix_unimp 0 | ||
288 | sys irix_unimp 0 | ||
289 | sys irix_unimp 0 | ||
290 | sys irix_unimp 0 | ||
291 | sys irix_unimp 0 | ||
292 | sys irix_unimp 0 | ||
293 | sys irix_unimp 0 | ||
294 | sys irix_unimp 0 | ||
295 | sys irix_unimp 0 | ||
296 | sys irix_unimp 0 | ||
297 | sys irix_unimp 0 | ||
298 | sys irix_unimp 0 | ||
299 | sys irix_unimp 0 | ||
300 | sys irix_unimp 0 | ||
301 | sys irix_unimp 0 | ||
302 | sys irix_unimp 0 | ||
303 | sys irix_unimp 0 | ||
304 | sys irix_unimp 0 | ||
305 | sys irix_unimp 0 | ||
306 | sys irix_unimp 0 | ||
307 | sys irix_unimp 0 | ||
308 | sys irix_unimp 0 | ||
309 | sys irix_unimp 0 | ||
310 | sys irix_unimp 0 | ||
311 | sys irix_unimp 0 | ||
312 | sys irix_unimp 0 | ||
313 | sys irix_unimp 0 | ||
314 | sys irix_unimp 0 | ||
315 | sys irix_unimp 0 | ||
316 | sys irix_unimp 0 | ||
317 | sys irix_unimp 0 | ||
318 | sys irix_unimp 0 | ||
319 | sys irix_unimp 0 | ||
320 | sys irix_unimp 0 | ||
321 | sys irix_unimp 0 | ||
322 | sys irix_unimp 0 | ||
323 | sys irix_unimp 0 | ||
324 | sys irix_unimp 0 | ||
325 | sys irix_unimp 0 | ||
326 | sys irix_unimp 0 | ||
327 | sys irix_unimp 0 | ||
328 | sys irix_unimp 0 | ||
329 | sys irix_unimp 0 | ||
330 | sys irix_unimp 0 | ||
331 | sys irix_unimp 0 | ||
332 | sys irix_unimp 0 | ||
333 | sys irix_unimp 0 | ||
334 | sys irix_unimp 0 | ||
335 | sys irix_unimp 0 | ||
336 | sys irix_unimp 0 | ||
337 | sys irix_unimp 0 | ||
338 | sys irix_unimp 0 | ||
339 | sys irix_unimp 0 | ||
340 | sys irix_unimp 0 | ||
341 | sys irix_unimp 0 | ||
342 | sys irix_unimp 0 | ||
343 | sys irix_unimp 0 | ||
344 | sys irix_unimp 0 | ||
345 | sys irix_unimp 0 | ||
346 | sys irix_unimp 0 | ||
347 | sys irix_unimp 0 | ||
348 | sys irix_unimp 0 | ||
349 | sys irix_unimp 0 | ||
350 | sys irix_unimp 0 | ||
351 | sys irix_unimp 0 | ||
352 | sys irix_unimp 0 | ||
353 | sys irix_unimp 0 | ||
354 | sys irix_unimp 0 | ||
355 | sys irix_unimp 0 | ||
356 | sys irix_unimp 0 | ||
357 | sys irix_unimp 0 | ||
358 | sys irix_unimp 0 | ||
359 | sys irix_unimp 0 | ||
360 | sys irix_unimp 0 | ||
361 | sys irix_unimp 0 | ||
362 | sys irix_unimp 0 | ||
363 | sys irix_unimp 0 | ||
364 | sys irix_unimp 0 | ||
365 | sys irix_unimp 0 | ||
366 | sys irix_unimp 0 | ||
367 | sys irix_unimp 0 | ||
368 | sys irix_unimp 0 | ||
369 | sys irix_unimp 0 | ||
370 | sys irix_unimp 0 | ||
371 | sys irix_unimp 0 | ||
372 | sys irix_unimp 0 | ||
373 | sys irix_unimp 0 | ||
374 | sys irix_unimp 0 | ||
375 | sys irix_unimp 0 | ||
376 | sys irix_unimp 0 | ||
377 | sys irix_unimp 0 | ||
378 | sys irix_unimp 0 | ||
379 | sys irix_unimp 0 | ||
380 | sys irix_unimp 0 | ||
381 | sys irix_unimp 0 | ||
382 | sys irix_unimp 0 | ||
383 | sys irix_unimp 0 | ||
384 | sys irix_unimp 0 | ||
385 | sys irix_unimp 0 | ||
386 | sys irix_unimp 0 | ||
387 | sys irix_unimp 0 | ||
388 | sys irix_unimp 0 | ||
389 | sys irix_unimp 0 | ||
390 | sys irix_unimp 0 | ||
391 | sys irix_unimp 0 | ||
392 | sys irix_unimp 0 | ||
393 | sys irix_unimp 0 | ||
394 | sys irix_unimp 0 | ||
395 | sys irix_unimp 0 | ||
396 | sys irix_unimp 0 | ||
397 | sys irix_unimp 0 | ||
398 | sys irix_unimp 0 | ||
399 | sys irix_unimp 0 | ||
400 | sys irix_unimp 0 | ||
401 | sys irix_unimp 0 | ||
402 | sys irix_unimp 0 | ||
403 | sys irix_unimp 0 | ||
404 | sys irix_unimp 0 | ||
405 | sys irix_unimp 0 | ||
406 | sys irix_unimp 0 | ||
407 | sys irix_unimp 0 | ||
408 | sys irix_unimp 0 | ||
409 | sys irix_unimp 0 | ||
410 | sys irix_unimp 0 | ||
411 | sys irix_unimp 0 | ||
412 | sys irix_unimp 0 | ||
413 | sys irix_unimp 0 | ||
414 | sys irix_unimp 0 | ||
415 | sys irix_unimp 0 | ||
416 | sys irix_unimp 0 | ||
417 | sys irix_unimp 0 | ||
418 | sys irix_unimp 0 | ||
419 | sys irix_unimp 0 | ||
420 | sys irix_unimp 0 | ||
421 | sys irix_unimp 0 | ||
422 | sys irix_unimp 0 | ||
423 | sys irix_unimp 0 | ||
424 | sys irix_unimp 0 | ||
425 | sys irix_unimp 0 | ||
426 | sys irix_unimp 0 | ||
427 | sys irix_unimp 0 | ||
428 | sys irix_unimp 0 | ||
429 | sys irix_unimp 0 | ||
430 | sys irix_unimp 0 | ||
431 | sys irix_unimp 0 | ||
432 | sys irix_unimp 0 | ||
433 | sys irix_unimp 0 | ||
434 | sys irix_unimp 0 | ||
435 | sys irix_unimp 0 | ||
436 | sys irix_unimp 0 | ||
437 | sys irix_unimp 0 | ||
438 | sys irix_unimp 0 | ||
439 | sys irix_unimp 0 | ||
440 | sys irix_unimp 0 | ||
441 | sys irix_unimp 0 | ||
442 | sys irix_unimp 0 | ||
443 | sys irix_unimp 0 | ||
444 | sys irix_unimp 0 | ||
445 | sys irix_unimp 0 | ||
446 | sys irix_unimp 0 | ||
447 | sys irix_unimp 0 | ||
448 | sys irix_unimp 0 | ||
449 | sys irix_unimp 0 | ||
450 | sys irix_unimp 0 | ||
451 | sys irix_unimp 0 | ||
452 | sys irix_unimp 0 | ||
453 | sys irix_unimp 0 | ||
454 | sys irix_unimp 0 | ||
455 | sys irix_unimp 0 | ||
456 | sys irix_unimp 0 | ||
457 | sys irix_unimp 0 | ||
458 | sys irix_unimp 0 | ||
459 | sys irix_unimp 0 | ||
460 | sys irix_unimp 0 | ||
461 | sys irix_unimp 0 | ||
462 | sys irix_unimp 0 | ||
463 | sys irix_unimp 0 | ||
464 | sys irix_unimp 0 | ||
465 | sys irix_unimp 0 | ||
466 | sys irix_unimp 0 | ||
467 | sys irix_unimp 0 | ||
468 | sys irix_unimp 0 | ||
469 | sys irix_unimp 0 | ||
470 | sys irix_unimp 0 | ||
471 | sys irix_unimp 0 | ||
472 | sys irix_unimp 0 | ||
473 | sys irix_unimp 0 | ||
474 | sys irix_unimp 0 | ||
475 | sys irix_unimp 0 | ||
476 | sys irix_unimp 0 | ||
477 | sys irix_unimp 0 | ||
478 | sys irix_unimp 0 | ||
479 | sys irix_unimp 0 | ||
480 | sys irix_unimp 0 | ||
481 | sys irix_unimp 0 | ||
482 | sys irix_unimp 0 | ||
483 | sys irix_unimp 0 | ||
484 | sys irix_unimp 0 | ||
485 | sys irix_unimp 0 | ||
486 | sys irix_unimp 0 | ||
487 | sys irix_unimp 0 | ||
488 | sys irix_unimp 0 | ||
489 | sys irix_unimp 0 | ||
490 | sys irix_unimp 0 | ||
491 | sys irix_unimp 0 | ||
492 | sys irix_unimp 0 | ||
493 | sys irix_unimp 0 | ||
494 | sys irix_unimp 0 | ||
495 | sys irix_unimp 0 | ||
496 | sys irix_unimp 0 | ||
497 | sys irix_unimp 0 | ||
498 | sys irix_unimp 0 | ||
499 | sys irix_unimp 0 | ||
500 | sys irix_unimp 0 | ||
501 | sys irix_unimp 0 | ||
502 | sys irix_unimp 0 | ||
503 | sys irix_unimp 0 | ||
504 | sys irix_unimp 0 | ||
505 | sys irix_unimp 0 | ||
506 | sys irix_unimp 0 | ||
507 | sys irix_unimp 0 | ||
508 | sys irix_unimp 0 | ||
509 | sys irix_unimp 0 | ||
510 | sys irix_unimp 0 | ||
511 | sys irix_unimp 0 | ||
512 | sys irix_unimp 0 | ||
513 | sys irix_unimp 0 | ||
514 | sys irix_unimp 0 | ||
515 | sys irix_unimp 0 | ||
516 | sys irix_unimp 0 | ||
517 | sys irix_unimp 0 | ||
518 | sys irix_unimp 0 | ||
519 | sys irix_unimp 0 | ||
520 | sys irix_unimp 0 | ||
521 | sys irix_unimp 0 | ||
522 | sys irix_unimp 0 | ||
523 | sys irix_unimp 0 | ||
524 | sys irix_unimp 0 | ||
525 | sys irix_unimp 0 | ||
526 | sys irix_unimp 0 | ||
527 | sys irix_unimp 0 | ||
528 | sys irix_unimp 0 | ||
529 | sys irix_unimp 0 | ||
530 | sys irix_unimp 0 | ||
531 | sys irix_unimp 0 | ||
532 | sys irix_unimp 0 | ||
533 | sys irix_unimp 0 | ||
534 | sys irix_unimp 0 | ||
535 | sys irix_unimp 0 | ||
536 | sys irix_unimp 0 | ||
537 | sys irix_unimp 0 | ||
538 | sys irix_unimp 0 | ||
539 | sys irix_unimp 0 | ||
540 | sys irix_unimp 0 | ||
541 | sys irix_unimp 0 | ||
542 | sys irix_unimp 0 | ||
543 | sys irix_unimp 0 | ||
544 | sys irix_unimp 0 | ||
545 | sys irix_unimp 0 | ||
546 | sys irix_unimp 0 | ||
547 | sys irix_unimp 0 | ||
548 | sys irix_unimp 0 | ||
549 | sys irix_unimp 0 | ||
550 | sys irix_unimp 0 | ||
551 | sys irix_unimp 0 | ||
552 | sys irix_unimp 0 | ||
553 | sys irix_unimp 0 | ||
554 | sys irix_unimp 0 | ||
555 | sys irix_unimp 0 | ||
556 | sys irix_unimp 0 | ||
557 | sys irix_unimp 0 | ||
558 | sys irix_unimp 0 | ||
559 | sys irix_unimp 0 | ||
560 | sys irix_unimp 0 | ||
561 | sys irix_unimp 0 | ||
562 | sys irix_unimp 0 | ||
563 | sys irix_unimp 0 | ||
564 | sys irix_unimp 0 | ||
565 | sys irix_unimp 0 | ||
566 | sys irix_unimp 0 | ||
567 | sys irix_unimp 0 | ||
568 | sys irix_unimp 0 | ||
569 | sys irix_unimp 0 | ||
570 | sys irix_unimp 0 | ||
571 | sys irix_unimp 0 | ||
572 | sys irix_unimp 0 | ||
573 | sys irix_unimp 0 | ||
574 | sys irix_unimp 0 | ||
575 | sys irix_unimp 0 | ||
576 | sys irix_unimp 0 | ||
577 | sys irix_unimp 0 | ||
578 | sys irix_unimp 0 | ||
579 | sys irix_unimp 0 | ||
580 | sys irix_unimp 0 | ||
581 | sys irix_unimp 0 | ||
582 | sys irix_unimp 0 | ||
583 | sys irix_unimp 0 | ||
584 | sys irix_unimp 0 | ||
585 | sys irix_unimp 0 | ||
586 | sys irix_unimp 0 | ||
587 | sys irix_unimp 0 | ||
588 | sys irix_unimp 0 | ||
589 | sys irix_unimp 0 | ||
590 | sys irix_unimp 0 | ||
591 | sys irix_unimp 0 | ||
592 | sys irix_unimp 0 | ||
593 | sys irix_unimp 0 | ||
594 | sys irix_unimp 0 | ||
595 | sys irix_unimp 0 | ||
596 | sys irix_unimp 0 | ||
597 | sys irix_unimp 0 | ||
598 | sys irix_unimp 0 | ||
599 | sys irix_unimp 0 | ||
600 | sys irix_unimp 0 | ||
601 | sys irix_unimp 0 | ||
602 | sys irix_unimp 0 | ||
603 | sys irix_unimp 0 | ||
604 | sys irix_unimp 0 | ||
605 | sys irix_unimp 0 | ||
606 | sys irix_unimp 0 | ||
607 | sys irix_unimp 0 | ||
608 | sys irix_unimp 0 | ||
609 | sys irix_unimp 0 | ||
610 | sys irix_unimp 0 | ||
611 | sys irix_unimp 0 | ||
612 | sys irix_unimp 0 | ||
613 | sys irix_unimp 0 | ||
614 | sys irix_unimp 0 | ||
615 | sys irix_unimp 0 | ||
616 | sys irix_unimp 0 | ||
617 | sys irix_unimp 0 | ||
618 | sys irix_unimp 0 | ||
619 | sys irix_unimp 0 | ||
620 | sys irix_unimp 0 | ||
621 | sys irix_unimp 0 | ||
622 | sys irix_unimp 0 | ||
623 | sys irix_unimp 0 | ||
624 | sys irix_unimp 0 | ||
625 | sys irix_unimp 0 | ||
626 | sys irix_unimp 0 | ||
627 | sys irix_unimp 0 | ||
628 | sys irix_unimp 0 | ||
629 | sys irix_unimp 0 | ||
630 | sys irix_unimp 0 | ||
631 | sys irix_unimp 0 | ||
632 | sys irix_unimp 0 | ||
633 | sys irix_unimp 0 | ||
634 | sys irix_unimp 0 | ||
635 | sys irix_unimp 0 | ||
636 | sys irix_unimp 0 | ||
637 | sys irix_unimp 0 | ||
638 | sys irix_unimp 0 | ||
639 | sys irix_unimp 0 | ||
640 | sys irix_unimp 0 | ||
641 | sys irix_unimp 0 | ||
642 | sys irix_unimp 0 | ||
643 | sys irix_unimp 0 | ||
644 | sys irix_unimp 0 | ||
645 | sys irix_unimp 0 | ||
646 | sys irix_unimp 0 | ||
647 | sys irix_unimp 0 | ||
648 | sys irix_unimp 0 | ||
649 | sys irix_unimp 0 | ||
650 | sys irix_unimp 0 | ||
651 | sys irix_unimp 0 | ||
652 | sys irix_unimp 0 | ||
653 | sys irix_unimp 0 | ||
654 | sys irix_unimp 0 | ||
655 | sys irix_unimp 0 | ||
656 | sys irix_unimp 0 | ||
657 | sys irix_unimp 0 | ||
658 | sys irix_unimp 0 | ||
659 | sys irix_unimp 0 | ||
660 | sys irix_unimp 0 | ||
661 | sys irix_unimp 0 | ||
662 | sys irix_unimp 0 | ||
663 | sys irix_unimp 0 | ||
664 | sys irix_unimp 0 | ||
665 | sys irix_unimp 0 | ||
666 | sys irix_unimp 0 | ||
667 | sys irix_unimp 0 | ||
668 | sys irix_unimp 0 | ||
669 | sys irix_unimp 0 | ||
670 | sys irix_unimp 0 | ||
671 | sys irix_unimp 0 | ||
672 | sys irix_unimp 0 | ||
673 | sys irix_unimp 0 | ||
674 | sys irix_unimp 0 | ||
675 | sys irix_unimp 0 | ||
676 | sys irix_unimp 0 | ||
677 | sys irix_unimp 0 | ||
678 | sys irix_unimp 0 | ||
679 | sys irix_unimp 0 | ||
680 | sys irix_unimp 0 | ||
681 | sys irix_unimp 0 | ||
682 | sys irix_unimp 0 | ||
683 | sys irix_unimp 0 | ||
684 | sys irix_unimp 0 | ||
685 | sys irix_unimp 0 | ||
686 | sys irix_unimp 0 | ||
687 | sys irix_unimp 0 | ||
688 | sys irix_unimp 0 | ||
689 | sys irix_unimp 0 | ||
690 | sys irix_unimp 0 | ||
691 | sys irix_unimp 0 | ||
692 | sys irix_unimp 0 | ||
693 | sys irix_unimp 0 | ||
694 | sys irix_unimp 0 | ||
695 | sys irix_unimp 0 | ||
696 | sys irix_unimp 0 | ||
697 | sys irix_unimp 0 | ||
698 | sys irix_unimp 0 | ||
699 | sys irix_unimp 0 | ||
700 | sys irix_unimp 0 | ||
701 | sys irix_unimp 0 | ||
702 | sys irix_unimp 0 | ||
703 | sys irix_unimp 0 | ||
704 | sys irix_unimp 0 | ||
705 | sys irix_unimp 0 | ||
706 | sys irix_unimp 0 | ||
707 | sys irix_unimp 0 | ||
708 | sys irix_unimp 0 | ||
709 | sys irix_unimp 0 | ||
710 | sys irix_unimp 0 | ||
711 | sys irix_unimp 0 | ||
712 | sys irix_unimp 0 | ||
713 | sys irix_unimp 0 | ||
714 | sys irix_unimp 0 | ||
715 | sys irix_unimp 0 | ||
716 | sys irix_unimp 0 | ||
717 | sys irix_unimp 0 | ||
718 | sys irix_unimp 0 | ||
719 | sys irix_unimp 0 | ||
720 | sys irix_unimp 0 | ||
721 | sys irix_unimp 0 | ||
722 | sys irix_unimp 0 | ||
723 | sys irix_unimp 0 | ||
724 | sys irix_unimp 0 | ||
725 | sys irix_unimp 0 | ||
726 | sys irix_unimp 0 | ||
727 | sys irix_unimp 0 | ||
728 | sys irix_unimp 0 | ||
729 | sys irix_unimp 0 | ||
730 | sys irix_unimp 0 | ||
731 | sys irix_unimp 0 | ||
732 | sys irix_unimp 0 | ||
733 | sys irix_unimp 0 | ||
734 | sys irix_unimp 0 | ||
735 | sys irix_unimp 0 | ||
736 | sys irix_unimp 0 | ||
737 | sys irix_unimp 0 | ||
738 | sys irix_unimp 0 | ||
739 | sys irix_unimp 0 | ||
740 | sys irix_unimp 0 | ||
741 | sys irix_unimp 0 | ||
742 | sys irix_unimp 0 | ||
743 | sys irix_unimp 0 | ||
744 | sys irix_unimp 0 | ||
745 | sys irix_unimp 0 | ||
746 | sys irix_unimp 0 | ||
747 | sys irix_unimp 0 | ||
748 | sys irix_unimp 0 | ||
749 | sys irix_unimp 0 | ||
750 | sys irix_unimp 0 | ||
751 | sys irix_unimp 0 | ||
752 | sys irix_unimp 0 | ||
753 | sys irix_unimp 0 | ||
754 | sys irix_unimp 0 | ||
755 | sys irix_unimp 0 | ||
756 | sys irix_unimp 0 | ||
757 | sys irix_unimp 0 | ||
758 | sys irix_unimp 0 | ||
759 | sys irix_unimp 0 | ||
760 | sys irix_unimp 0 | ||
761 | sys irix_unimp 0 | ||
762 | sys irix_unimp 0 | ||
763 | sys irix_unimp 0 | ||
764 | sys irix_unimp 0 | ||
765 | sys irix_unimp 0 | ||
766 | sys irix_unimp 0 | ||
767 | sys irix_unimp 0 | ||
768 | sys irix_unimp 0 | ||
769 | sys irix_unimp 0 | ||
770 | sys irix_unimp 0 | ||
771 | sys irix_unimp 0 | ||
772 | sys irix_unimp 0 | ||
773 | sys irix_unimp 0 | ||
774 | sys irix_unimp 0 | ||
775 | sys irix_unimp 0 | ||
776 | sys irix_unimp 0 | ||
777 | sys irix_unimp 0 | ||
778 | sys irix_unimp 0 | ||
779 | sys irix_unimp 0 | ||
780 | sys irix_unimp 0 | ||
781 | sys irix_unimp 0 | ||
782 | sys irix_unimp 0 | ||
783 | sys irix_unimp 0 | ||
784 | sys irix_unimp 0 | ||
785 | sys irix_unimp 0 | ||
786 | sys irix_unimp 0 | ||
787 | sys irix_unimp 0 | ||
788 | sys irix_unimp 0 | ||
789 | sys irix_unimp 0 | ||
790 | sys irix_unimp 0 | ||
791 | sys irix_unimp 0 | ||
792 | sys irix_unimp 0 | ||
793 | sys irix_unimp 0 | ||
794 | sys irix_unimp 0 | ||
795 | sys irix_unimp 0 | ||
796 | sys irix_unimp 0 | ||
797 | sys irix_unimp 0 | ||
798 | sys irix_unimp 0 | ||
799 | sys irix_unimp 0 | ||
800 | sys irix_unimp 0 | ||
801 | sys irix_unimp 0 | ||
802 | sys irix_unimp 0 | ||
803 | sys irix_unimp 0 | ||
804 | sys irix_unimp 0 | ||
805 | sys irix_unimp 0 | ||
806 | sys irix_unimp 0 | ||
807 | sys irix_unimp 0 | ||
808 | sys irix_unimp 0 | ||
809 | sys irix_unimp 0 | ||
810 | sys irix_unimp 0 | ||
811 | sys irix_unimp 0 | ||
812 | sys irix_unimp 0 | ||
813 | sys irix_unimp 0 | ||
814 | sys irix_unimp 0 | ||
815 | sys irix_unimp 0 | ||
816 | sys irix_unimp 0 | ||
817 | sys irix_unimp 0 | ||
818 | sys irix_unimp 0 | ||
819 | sys irix_unimp 0 | ||
820 | sys irix_unimp 0 | ||
821 | sys irix_unimp 0 | ||
822 | sys irix_unimp 0 | ||
823 | sys irix_unimp 0 | ||
824 | sys irix_unimp 0 | ||
825 | sys irix_unimp 0 | ||
826 | sys irix_unimp 0 | ||
827 | sys irix_unimp 0 | ||
828 | sys irix_unimp 0 | ||
829 | sys irix_unimp 0 | ||
830 | sys irix_unimp 0 | ||
831 | sys irix_unimp 0 | ||
832 | sys irix_unimp 0 | ||
833 | sys irix_unimp 0 | ||
834 | sys irix_unimp 0 | ||
835 | sys irix_unimp 0 | ||
836 | sys irix_unimp 0 | ||
837 | sys irix_unimp 0 | ||
838 | sys irix_unimp 0 | ||
839 | sys irix_unimp 0 | ||
840 | sys irix_unimp 0 | ||
841 | sys irix_unimp 0 | ||
842 | sys irix_unimp 0 | ||
843 | sys irix_unimp 0 | ||
844 | sys irix_unimp 0 | ||
845 | sys irix_unimp 0 | ||
846 | sys irix_unimp 0 | ||
847 | sys irix_unimp 0 | ||
848 | sys irix_unimp 0 | ||
849 | sys irix_unimp 0 | ||
850 | sys irix_unimp 0 | ||
851 | sys irix_unimp 0 | ||
852 | sys irix_unimp 0 | ||
853 | sys irix_unimp 0 | ||
854 | sys irix_unimp 0 | ||
855 | sys irix_unimp 0 | ||
856 | sys irix_unimp 0 | ||
857 | sys irix_unimp 0 | ||
858 | sys irix_unimp 0 | ||
859 | sys irix_unimp 0 | ||
860 | sys irix_unimp 0 | ||
861 | sys irix_unimp 0 | ||
862 | sys irix_unimp 0 | ||
863 | sys irix_unimp 0 | ||
864 | sys irix_unimp 0 | ||
865 | sys irix_unimp 0 | ||
866 | sys irix_unimp 0 | ||
867 | sys irix_unimp 0 | ||
868 | sys irix_unimp 0 | ||
869 | sys irix_unimp 0 | ||
870 | sys irix_unimp 0 | ||
871 | sys irix_unimp 0 | ||
872 | sys irix_unimp 0 | ||
873 | sys irix_unimp 0 | ||
874 | sys irix_unimp 0 | ||
875 | sys irix_unimp 0 | ||
876 | sys irix_unimp 0 | ||
877 | sys irix_unimp 0 | ||
878 | sys irix_unimp 0 | ||
879 | sys irix_unimp 0 | ||
880 | sys irix_unimp 0 | ||
881 | sys irix_unimp 0 | ||
882 | sys irix_unimp 0 | ||
883 | sys irix_unimp 0 | ||
884 | sys irix_unimp 0 | ||
885 | sys irix_unimp 0 | ||
886 | sys irix_unimp 0 | ||
887 | sys irix_unimp 0 | ||
888 | sys irix_unimp 0 | ||
889 | sys irix_unimp 0 | ||
890 | sys irix_unimp 0 | ||
891 | sys irix_unimp 0 | ||
892 | sys irix_unimp 0 | ||
893 | sys irix_unimp 0 | ||
894 | sys irix_unimp 0 | ||
895 | sys irix_unimp 0 | ||
896 | sys irix_unimp 0 | ||
897 | sys irix_unimp 0 | ||
898 | sys irix_unimp 0 | ||
899 | sys irix_unimp 0 | ||
900 | sys irix_unimp 0 | ||
901 | sys irix_unimp 0 | ||
902 | sys irix_unimp 0 | ||
903 | sys irix_unimp 0 | ||
904 | sys irix_unimp 0 | ||
905 | sys irix_unimp 0 | ||
906 | sys irix_unimp 0 | ||
907 | sys irix_unimp 0 | ||
908 | sys irix_unimp 0 | ||
909 | sys irix_unimp 0 | ||
910 | sys irix_unimp 0 | ||
911 | sys irix_unimp 0 | ||
912 | sys irix_unimp 0 | ||
913 | sys irix_unimp 0 | ||
914 | sys irix_unimp 0 | ||
915 | sys irix_unimp 0 | ||
916 | sys irix_unimp 0 | ||
917 | sys irix_unimp 0 | ||
918 | sys irix_unimp 0 | ||
919 | sys irix_unimp 0 | ||
920 | sys irix_unimp 0 | ||
921 | sys irix_unimp 0 | ||
922 | sys irix_unimp 0 | ||
923 | sys irix_unimp 0 | ||
924 | sys irix_unimp 0 | ||
925 | sys irix_unimp 0 | ||
926 | sys irix_unimp 0 | ||
927 | sys irix_unimp 0 | ||
928 | sys irix_unimp 0 | ||
929 | sys irix_unimp 0 | ||
930 | sys irix_unimp 0 | ||
931 | sys irix_unimp 0 | ||
932 | sys irix_unimp 0 | ||
933 | sys irix_unimp 0 | ||
934 | sys irix_unimp 0 | ||
935 | sys irix_unimp 0 | ||
936 | sys irix_unimp 0 | ||
937 | sys irix_unimp 0 | ||
938 | sys irix_unimp 0 | ||
939 | sys irix_unimp 0 | ||
940 | sys irix_unimp 0 | ||
941 | sys irix_unimp 0 | ||
942 | sys irix_unimp 0 | ||
943 | sys irix_unimp 0 | ||
944 | sys irix_unimp 0 | ||
945 | sys irix_unimp 0 | ||
946 | sys irix_unimp 0 | ||
947 | sys irix_unimp 0 | ||
948 | sys irix_unimp 0 | ||
949 | sys irix_unimp 0 | ||
950 | sys irix_unimp 0 | ||
951 | sys irix_unimp 0 | ||
952 | sys irix_unimp 0 | ||
953 | sys irix_unimp 0 | ||
954 | sys irix_unimp 0 | ||
955 | sys irix_unimp 0 | ||
956 | sys irix_unimp 0 | ||
957 | sys irix_unimp 0 | ||
958 | sys irix_unimp 0 | ||
959 | sys irix_unimp 0 | ||
960 | sys irix_unimp 0 | ||
961 | sys irix_unimp 0 | ||
962 | sys irix_unimp 0 | ||
963 | sys irix_unimp 0 | ||
964 | sys irix_unimp 0 | ||
965 | sys irix_unimp 0 | ||
966 | sys irix_unimp 0 | ||
967 | sys irix_unimp 0 | ||
968 | sys irix_unimp 0 | ||
969 | sys irix_unimp 0 | ||
970 | sys irix_unimp 0 | ||
971 | sys irix_unimp 0 | ||
972 | sys irix_unimp 0 | ||
973 | sys irix_unimp 0 | ||
974 | sys irix_unimp 0 | ||
975 | sys irix_unimp 0 | ||
976 | sys irix_unimp 0 | ||
977 | sys irix_unimp 0 | ||
978 | sys irix_unimp 0 | ||
979 | sys irix_unimp 0 | ||
980 | sys irix_unimp 0 | ||
981 | sys irix_unimp 0 | ||
982 | sys irix_unimp 0 | ||
983 | sys irix_unimp 0 | ||
984 | sys irix_unimp 0 | ||
985 | sys irix_unimp 0 | ||
986 | sys irix_unimp 0 | ||
987 | sys irix_unimp 0 | ||
988 | sys irix_unimp 0 | ||
989 | sys irix_unimp 0 | ||
990 | sys irix_unimp 0 | ||
991 | sys irix_unimp 0 | ||
992 | sys irix_unimp 0 | ||
993 | sys irix_unimp 0 | ||
994 | sys irix_unimp 0 | ||
995 | sys irix_unimp 0 | ||
996 | sys irix_unimp 0 | ||
997 | sys irix_unimp 0 | ||
998 | sys irix_unimp 0 | ||
999 | sys irix_unimp 0 | ||
1000 | sys irix_unimp 0 | ||
1001 | sys irix_unimp 0 | ||
1002 | sys irix_unimp 0 | ||
1003 | sys irix_unimp 0 | ||
1004 | sys irix_unimp 0 | ||
1005 | sys irix_unimp 0 | ||
1006 | sys irix_unimp 0 | ||
1007 | sys irix_unimp 0 | ||
1008 | sys irix_unimp 0 | ||
1009 | sys irix_unimp 0 | ||
1010 | sys irix_unimp 0 | ||
1011 | sys irix_unimp 0 | ||
1012 | sys irix_unimp 0 | ||
1013 | sys irix_unimp 0 | ||
1014 | sys irix_unimp 0 | ||
1015 | sys irix_unimp 0 | ||
1016 | sys irix_unimp 0 | ||
1017 | sys irix_unimp 0 | ||
1018 | sys irix_unimp 0 | ||
1019 | sys irix_unimp 0 | ||
1020 | sys irix_unimp 0 | ||
1021 | sys irix_unimp 0 | ||
1022 | sys irix_unimp 0 | ||
1023 | sys irix_unimp 0 | ||
1024 | sys irix_unimp 0 | ||
1025 | sys irix_unimp 0 | ||
1026 | sys irix_unimp 0 | ||
1027 | |||
1028 | .endm | ||
1029 | |||
1030 | /* | ||
1031 | * Pre-compute the number of _instruction_ bytes needed to load | ||
1032 | * or store the arguments 6-8. Negative values are ignored. | ||
1033 | */ | ||
1034 | .macro sys function, nargs | ||
1035 | PTR \function | ||
1036 | LONG (\nargs << 2) - (5 << 2) | ||
1037 | .endm | ||
1038 | |||
1039 | .align 4 | ||
1040 | EXPORT(sys_call_table_irix5) | ||
1041 | irix5syscalltable | ||
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c deleted file mode 100644 index 469c7237e5ba..000000000000 --- a/arch/mips/kernel/irixelf.c +++ /dev/null | |||
@@ -1,1361 +0,0 @@ | |||
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 | * irixelf.c: Code to load IRIX ELF executables conforming to the MIPS ABI. | ||
7 | * Based off of work by Eric Youngdale. | ||
8 | * | ||
9 | * Copyright (C) 1993 - 1994 Eric Youngdale <ericy@cais.com> | ||
10 | * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com> | ||
11 | * Copyright (C) 2004 - 2005 Steven J. Hill <sjhill@realitydiluted.com> | ||
12 | */ | ||
13 | #undef DEBUG | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/stat.h> | ||
18 | #include <linux/sched.h> | ||
19 | #include <linux/mm.h> | ||
20 | #include <linux/mman.h> | ||
21 | #include <linux/a.out.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/signal.h> | ||
25 | #include <linux/binfmts.h> | ||
26 | #include <linux/string.h> | ||
27 | #include <linux/file.h> | ||
28 | #include <linux/fcntl.h> | ||
29 | #include <linux/ptrace.h> | ||
30 | #include <linux/slab.h> | ||
31 | #include <linux/shm.h> | ||
32 | #include <linux/personality.h> | ||
33 | #include <linux/elfcore.h> | ||
34 | |||
35 | #include <asm/mipsregs.h> | ||
36 | #include <asm/namei.h> | ||
37 | #include <asm/prctl.h> | ||
38 | #include <asm/uaccess.h> | ||
39 | |||
40 | #define DLINFO_ITEMS 12 | ||
41 | |||
42 | #include <linux/elf.h> | ||
43 | |||
44 | static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs); | ||
45 | static int load_irix_library(struct file *); | ||
46 | static int irix_core_dump(long signr, struct pt_regs * regs, | ||
47 | struct file *file, unsigned long limit); | ||
48 | |||
49 | static struct linux_binfmt irix_format = { | ||
50 | .module = THIS_MODULE, | ||
51 | .load_binary = load_irix_binary, | ||
52 | .load_shlib = load_irix_library, | ||
53 | .core_dump = irix_core_dump, | ||
54 | .min_coredump = PAGE_SIZE, | ||
55 | }; | ||
56 | |||
57 | /* Debugging routines. */ | ||
58 | static char *get_elf_p_type(Elf32_Word p_type) | ||
59 | { | ||
60 | #ifdef DEBUG | ||
61 | switch (p_type) { | ||
62 | case PT_NULL: | ||
63 | return "PT_NULL"; | ||
64 | break; | ||
65 | |||
66 | case PT_LOAD: | ||
67 | return "PT_LOAD"; | ||
68 | break; | ||
69 | |||
70 | case PT_DYNAMIC: | ||
71 | return "PT_DYNAMIC"; | ||
72 | break; | ||
73 | |||
74 | case PT_INTERP: | ||
75 | return "PT_INTERP"; | ||
76 | break; | ||
77 | |||
78 | case PT_NOTE: | ||
79 | return "PT_NOTE"; | ||
80 | break; | ||
81 | |||
82 | case PT_SHLIB: | ||
83 | return "PT_SHLIB"; | ||
84 | break; | ||
85 | |||
86 | case PT_PHDR: | ||
87 | return "PT_PHDR"; | ||
88 | break; | ||
89 | |||
90 | case PT_LOPROC: | ||
91 | return "PT_LOPROC/REGINFO"; | ||
92 | break; | ||
93 | |||
94 | case PT_HIPROC: | ||
95 | return "PT_HIPROC"; | ||
96 | break; | ||
97 | |||
98 | default: | ||
99 | return "PT_BOGUS"; | ||
100 | break; | ||
101 | } | ||
102 | #endif | ||
103 | } | ||
104 | |||
105 | static void print_elfhdr(struct elfhdr *ehp) | ||
106 | { | ||
107 | int i; | ||
108 | |||
109 | pr_debug("ELFHDR: e_ident<"); | ||
110 | for (i = 0; i < (EI_NIDENT - 1); i++) | ||
111 | pr_debug("%x ", ehp->e_ident[i]); | ||
112 | pr_debug("%x>\n", ehp->e_ident[i]); | ||
113 | pr_debug(" e_type[%04x] e_machine[%04x] e_version[%08lx]\n", | ||
114 | (unsigned short) ehp->e_type, (unsigned short) ehp->e_machine, | ||
115 | (unsigned long) ehp->e_version); | ||
116 | pr_debug(" e_entry[%08lx] e_phoff[%08lx] e_shoff[%08lx] " | ||
117 | "e_flags[%08lx]\n", | ||
118 | (unsigned long) ehp->e_entry, (unsigned long) ehp->e_phoff, | ||
119 | (unsigned long) ehp->e_shoff, (unsigned long) ehp->e_flags); | ||
120 | pr_debug(" e_ehsize[%04x] e_phentsize[%04x] e_phnum[%04x]\n", | ||
121 | (unsigned short) ehp->e_ehsize, | ||
122 | (unsigned short) ehp->e_phentsize, | ||
123 | (unsigned short) ehp->e_phnum); | ||
124 | pr_debug(" e_shentsize[%04x] e_shnum[%04x] e_shstrndx[%04x]\n", | ||
125 | (unsigned short) ehp->e_shentsize, | ||
126 | (unsigned short) ehp->e_shnum, | ||
127 | (unsigned short) ehp->e_shstrndx); | ||
128 | } | ||
129 | |||
130 | static void print_phdr(int i, struct elf_phdr *ep) | ||
131 | { | ||
132 | pr_debug("PHDR[%d]: p_type[%s] p_offset[%08lx] p_vaddr[%08lx] " | ||
133 | "p_paddr[%08lx]\n", i, get_elf_p_type(ep->p_type), | ||
134 | (unsigned long) ep->p_offset, (unsigned long) ep->p_vaddr, | ||
135 | (unsigned long) ep->p_paddr); | ||
136 | pr_debug(" p_filesz[%08lx] p_memsz[%08lx] p_flags[%08lx] " | ||
137 | "p_align[%08lx]\n", (unsigned long) ep->p_filesz, | ||
138 | (unsigned long) ep->p_memsz, (unsigned long) ep->p_flags, | ||
139 | (unsigned long) ep->p_align); | ||
140 | } | ||
141 | |||
142 | static void dump_phdrs(struct elf_phdr *ep, int pnum) | ||
143 | { | ||
144 | int i; | ||
145 | |||
146 | for (i = 0; i < pnum; i++, ep++) { | ||
147 | if ((ep->p_type == PT_LOAD) || | ||
148 | (ep->p_type == PT_INTERP) || | ||
149 | (ep->p_type == PT_PHDR)) | ||
150 | print_phdr(i, ep); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | static void set_brk(unsigned long start, unsigned long end) | ||
155 | { | ||
156 | start = PAGE_ALIGN(start); | ||
157 | end = PAGE_ALIGN(end); | ||
158 | if (end <= start) | ||
159 | return; | ||
160 | down_write(¤t->mm->mmap_sem); | ||
161 | do_brk(start, end - start); | ||
162 | up_write(¤t->mm->mmap_sem); | ||
163 | } | ||
164 | |||
165 | |||
166 | /* We need to explicitly zero any fractional pages | ||
167 | * after the data section (i.e. bss). This would | ||
168 | * contain the junk from the file that should not | ||
169 | * be in memory. | ||
170 | */ | ||
171 | static void padzero(unsigned long elf_bss) | ||
172 | { | ||
173 | unsigned long nbyte; | ||
174 | |||
175 | nbyte = elf_bss & (PAGE_SIZE-1); | ||
176 | if (nbyte) { | ||
177 | nbyte = PAGE_SIZE - nbyte; | ||
178 | clear_user((void __user *) elf_bss, nbyte); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | static unsigned long * create_irix_tables(char * p, int argc, int envc, | ||
183 | struct elfhdr * exec, unsigned int load_addr, | ||
184 | unsigned int interp_load_addr, struct pt_regs *regs, | ||
185 | struct elf_phdr *ephdr) | ||
186 | { | ||
187 | elf_addr_t *argv; | ||
188 | elf_addr_t *envp; | ||
189 | elf_addr_t *sp, *csp; | ||
190 | |||
191 | pr_debug("create_irix_tables: p[%p] argc[%d] envc[%d] " | ||
192 | "load_addr[%08x] interp_load_addr[%08x]\n", | ||
193 | p, argc, envc, load_addr, interp_load_addr); | ||
194 | |||
195 | sp = (elf_addr_t *) (~15UL & (unsigned long) p); | ||
196 | csp = sp; | ||
197 | csp -= exec ? DLINFO_ITEMS*2 : 2; | ||
198 | csp -= envc+1; | ||
199 | csp -= argc+1; | ||
200 | csp -= 1; /* argc itself */ | ||
201 | if ((unsigned long)csp & 15UL) { | ||
202 | sp -= (16UL - ((unsigned long)csp & 15UL)) / sizeof(*sp); | ||
203 | } | ||
204 | |||
205 | /* | ||
206 | * Put the ELF interpreter info on the stack | ||
207 | */ | ||
208 | #define NEW_AUX_ENT(nr, id, val) \ | ||
209 | __put_user((id), sp+(nr*2)); \ | ||
210 | __put_user((val), sp+(nr*2+1)); \ | ||
211 | |||
212 | sp -= 2; | ||
213 | NEW_AUX_ENT(0, AT_NULL, 0); | ||
214 | |||
215 | if (exec) { | ||
216 | sp -= 11*2; | ||
217 | |||
218 | NEW_AUX_ENT(0, AT_PHDR, load_addr + exec->e_phoff); | ||
219 | NEW_AUX_ENT(1, AT_PHENT, sizeof(struct elf_phdr)); | ||
220 | NEW_AUX_ENT(2, AT_PHNUM, exec->e_phnum); | ||
221 | NEW_AUX_ENT(3, AT_PAGESZ, ELF_EXEC_PAGESIZE); | ||
222 | NEW_AUX_ENT(4, AT_BASE, interp_load_addr); | ||
223 | NEW_AUX_ENT(5, AT_FLAGS, 0); | ||
224 | NEW_AUX_ENT(6, AT_ENTRY, (elf_addr_t) exec->e_entry); | ||
225 | NEW_AUX_ENT(7, AT_UID, (elf_addr_t) current->uid); | ||
226 | NEW_AUX_ENT(8, AT_EUID, (elf_addr_t) current->euid); | ||
227 | NEW_AUX_ENT(9, AT_GID, (elf_addr_t) current->gid); | ||
228 | NEW_AUX_ENT(10, AT_EGID, (elf_addr_t) current->egid); | ||
229 | } | ||
230 | #undef NEW_AUX_ENT | ||
231 | |||
232 | sp -= envc+1; | ||
233 | envp = sp; | ||
234 | sp -= argc+1; | ||
235 | argv = sp; | ||
236 | |||
237 | __put_user((elf_addr_t)argc, --sp); | ||
238 | current->mm->arg_start = (unsigned long) p; | ||
239 | while (argc-->0) { | ||
240 | __put_user((unsigned long)p, argv++); | ||
241 | p += strlen_user(p); | ||
242 | } | ||
243 | __put_user((unsigned long) NULL, argv); | ||
244 | current->mm->arg_end = current->mm->env_start = (unsigned long) p; | ||
245 | while (envc-->0) { | ||
246 | __put_user((unsigned long)p, envp++); | ||
247 | p += strlen_user(p); | ||
248 | } | ||
249 | __put_user((unsigned long) NULL, envp); | ||
250 | current->mm->env_end = (unsigned long) p; | ||
251 | return sp; | ||
252 | } | ||
253 | |||
254 | |||
255 | /* This is much more generalized than the library routine read function, | ||
256 | * so we keep this separate. Technically the library read function | ||
257 | * is only provided so that we can read a.out libraries that have | ||
258 | * an ELF header. | ||
259 | */ | ||
260 | static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex, | ||
261 | struct file * interpreter, | ||
262 | unsigned int *interp_load_addr) | ||
263 | { | ||
264 | struct elf_phdr *elf_phdata = NULL; | ||
265 | struct elf_phdr *eppnt; | ||
266 | unsigned int len; | ||
267 | unsigned int load_addr; | ||
268 | int elf_bss; | ||
269 | int retval; | ||
270 | unsigned int last_bss; | ||
271 | int error; | ||
272 | int i; | ||
273 | unsigned int k; | ||
274 | |||
275 | elf_bss = 0; | ||
276 | last_bss = 0; | ||
277 | error = load_addr = 0; | ||
278 | |||
279 | print_elfhdr(interp_elf_ex); | ||
280 | |||
281 | /* First of all, some simple consistency checks */ | ||
282 | if ((interp_elf_ex->e_type != ET_EXEC && | ||
283 | interp_elf_ex->e_type != ET_DYN) || | ||
284 | !interpreter->f_op->mmap) { | ||
285 | printk("IRIX interp has bad e_type %d\n", interp_elf_ex->e_type); | ||
286 | return 0xffffffff; | ||
287 | } | ||
288 | |||
289 | /* Now read in all of the header information */ | ||
290 | if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > PAGE_SIZE) { | ||
291 | printk("IRIX interp header bigger than a page (%d)\n", | ||
292 | (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum)); | ||
293 | return 0xffffffff; | ||
294 | } | ||
295 | |||
296 | elf_phdata = kmalloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum, | ||
297 | GFP_KERNEL); | ||
298 | |||
299 | if (!elf_phdata) { | ||
300 | printk("Cannot kmalloc phdata for IRIX interp.\n"); | ||
301 | return 0xffffffff; | ||
302 | } | ||
303 | |||
304 | /* If the size of this structure has changed, then punt, since | ||
305 | * we will be doing the wrong thing. | ||
306 | */ | ||
307 | if (interp_elf_ex->e_phentsize != 32) { | ||
308 | printk("IRIX interp e_phentsize == %d != 32 ", | ||
309 | interp_elf_ex->e_phentsize); | ||
310 | kfree(elf_phdata); | ||
311 | return 0xffffffff; | ||
312 | } | ||
313 | |||
314 | retval = kernel_read(interpreter, interp_elf_ex->e_phoff, | ||
315 | (char *) elf_phdata, | ||
316 | sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); | ||
317 | |||
318 | dump_phdrs(elf_phdata, interp_elf_ex->e_phnum); | ||
319 | |||
320 | eppnt = elf_phdata; | ||
321 | for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) { | ||
322 | if (eppnt->p_type == PT_LOAD) { | ||
323 | int elf_type = MAP_PRIVATE | MAP_DENYWRITE; | ||
324 | int elf_prot = 0; | ||
325 | unsigned long vaddr = 0; | ||
326 | if (eppnt->p_flags & PF_R) | ||
327 | elf_prot = PROT_READ; | ||
328 | if (eppnt->p_flags & PF_W) | ||
329 | elf_prot |= PROT_WRITE; | ||
330 | if (eppnt->p_flags & PF_X) | ||
331 | elf_prot |= PROT_EXEC; | ||
332 | elf_type |= MAP_FIXED; | ||
333 | vaddr = eppnt->p_vaddr; | ||
334 | |||
335 | pr_debug("INTERP do_mmap" | ||
336 | "(%p, %08lx, %08lx, %08lx, %08lx, %08lx) ", | ||
337 | interpreter, vaddr, | ||
338 | (unsigned long) | ||
339 | (eppnt->p_filesz + (eppnt->p_vaddr & 0xfff)), | ||
340 | (unsigned long) | ||
341 | elf_prot, (unsigned long) elf_type, | ||
342 | (unsigned long) | ||
343 | (eppnt->p_offset & 0xfffff000)); | ||
344 | |||
345 | down_write(¤t->mm->mmap_sem); | ||
346 | error = do_mmap(interpreter, vaddr, | ||
347 | eppnt->p_filesz + (eppnt->p_vaddr & 0xfff), | ||
348 | elf_prot, elf_type, | ||
349 | eppnt->p_offset & 0xfffff000); | ||
350 | up_write(¤t->mm->mmap_sem); | ||
351 | |||
352 | if (error < 0 && error > -1024) { | ||
353 | printk("Aieee IRIX interp mmap error=%d\n", | ||
354 | error); | ||
355 | break; /* Real error */ | ||
356 | } | ||
357 | pr_debug("error=%08lx ", (unsigned long) error); | ||
358 | if (!load_addr && interp_elf_ex->e_type == ET_DYN) { | ||
359 | load_addr = error; | ||
360 | pr_debug("load_addr = error "); | ||
361 | } | ||
362 | |||
363 | /* | ||
364 | * Find the end of the file mapping for this phdr, and | ||
365 | * keep track of the largest address we see for this. | ||
366 | */ | ||
367 | k = eppnt->p_vaddr + eppnt->p_filesz; | ||
368 | if (k > elf_bss) | ||
369 | elf_bss = k; | ||
370 | |||
371 | /* Do the same thing for the memory mapping - between | ||
372 | * elf_bss and last_bss is the bss section. | ||
373 | */ | ||
374 | k = eppnt->p_memsz + eppnt->p_vaddr; | ||
375 | if (k > last_bss) | ||
376 | last_bss = k; | ||
377 | pr_debug("\n"); | ||
378 | } | ||
379 | } | ||
380 | |||
381 | /* Now use mmap to map the library into memory. */ | ||
382 | if (error < 0 && error > -1024) { | ||
383 | pr_debug("got error %d\n", error); | ||
384 | kfree(elf_phdata); | ||
385 | return 0xffffffff; | ||
386 | } | ||
387 | |||
388 | /* Now fill out the bss section. First pad the last page up | ||
389 | * to the page boundary, and then perform a mmap to make sure | ||
390 | * that there are zero-mapped pages up to and including the | ||
391 | * last bss page. | ||
392 | */ | ||
393 | pr_debug("padzero(%08lx) ", (unsigned long) (elf_bss)); | ||
394 | padzero(elf_bss); | ||
395 | len = (elf_bss + 0xfff) & 0xfffff000; /* What we have mapped so far */ | ||
396 | |||
397 | pr_debug("last_bss[%08lx] len[%08lx]\n", (unsigned long) last_bss, | ||
398 | (unsigned long) len); | ||
399 | |||
400 | /* Map the last of the bss segment */ | ||
401 | if (last_bss > len) { | ||
402 | down_write(¤t->mm->mmap_sem); | ||
403 | do_brk(len, (last_bss - len)); | ||
404 | up_write(¤t->mm->mmap_sem); | ||
405 | } | ||
406 | kfree(elf_phdata); | ||
407 | |||
408 | *interp_load_addr = load_addr; | ||
409 | return ((unsigned int) interp_elf_ex->e_entry); | ||
410 | } | ||
411 | |||
412 | /* Check sanity of IRIX elf executable header. */ | ||
413 | static int verify_binary(struct elfhdr *ehp, struct linux_binprm *bprm) | ||
414 | { | ||
415 | if (memcmp(ehp->e_ident, ELFMAG, SELFMAG) != 0) | ||
416 | return -ENOEXEC; | ||
417 | |||
418 | /* First of all, some simple consistency checks */ | ||
419 | if ((ehp->e_type != ET_EXEC && ehp->e_type != ET_DYN) || | ||
420 | !bprm->file->f_op->mmap) { | ||
421 | return -ENOEXEC; | ||
422 | } | ||
423 | |||
424 | /* XXX Don't support N32 or 64bit binaries yet because they can | ||
425 | * XXX and do execute 64 bit instructions and expect all registers | ||
426 | * XXX to be 64 bit as well. We need to make the kernel save | ||
427 | * XXX all registers as 64bits on cpu's capable of this at | ||
428 | * XXX exception time plus frob the XTLB exception vector. | ||
429 | */ | ||
430 | if ((ehp->e_flags & EF_MIPS_ABI2)) | ||
431 | return -ENOEXEC; | ||
432 | |||
433 | return 0; | ||
434 | } | ||
435 | |||
436 | /* | ||
437 | * This is where the detailed check is performed. Irix binaries | ||
438 | * use interpreters with 'libc.so' in the name, so this function | ||
439 | * can differentiate between Linux and Irix binaries. | ||
440 | */ | ||
441 | static inline int look_for_irix_interpreter(char **name, | ||
442 | struct file **interpreter, | ||
443 | struct elfhdr *interp_elf_ex, | ||
444 | struct elf_phdr *epp, | ||
445 | struct linux_binprm *bprm, int pnum) | ||
446 | { | ||
447 | int i; | ||
448 | int retval = -EINVAL; | ||
449 | struct file *file = NULL; | ||
450 | |||
451 | *name = NULL; | ||
452 | for (i = 0; i < pnum; i++, epp++) { | ||
453 | if (epp->p_type != PT_INTERP) | ||
454 | continue; | ||
455 | |||
456 | /* It is illegal to have two interpreters for one executable. */ | ||
457 | if (*name != NULL) | ||
458 | goto out; | ||
459 | |||
460 | *name = kmalloc(epp->p_filesz + strlen(IRIX_EMUL), GFP_KERNEL); | ||
461 | if (!*name) | ||
462 | return -ENOMEM; | ||
463 | |||
464 | strcpy(*name, IRIX_EMUL); | ||
465 | retval = kernel_read(bprm->file, epp->p_offset, (*name + 16), | ||
466 | epp->p_filesz); | ||
467 | if (retval < 0) | ||
468 | goto out; | ||
469 | |||
470 | file = open_exec(*name); | ||
471 | if (IS_ERR(file)) { | ||
472 | retval = PTR_ERR(file); | ||
473 | goto out; | ||
474 | } | ||
475 | retval = kernel_read(file, 0, bprm->buf, 128); | ||
476 | if (retval < 0) | ||
477 | goto dput_and_out; | ||
478 | |||
479 | *interp_elf_ex = *(struct elfhdr *) bprm->buf; | ||
480 | } | ||
481 | *interpreter = file; | ||
482 | return 0; | ||
483 | |||
484 | dput_and_out: | ||
485 | fput(file); | ||
486 | out: | ||
487 | kfree(*name); | ||
488 | return retval; | ||
489 | } | ||
490 | |||
491 | static inline int verify_irix_interpreter(struct elfhdr *ihp) | ||
492 | { | ||
493 | if (memcmp(ihp->e_ident, ELFMAG, SELFMAG) != 0) | ||
494 | return -ELIBBAD; | ||
495 | return 0; | ||
496 | } | ||
497 | |||
498 | #define EXEC_MAP_FLAGS (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE) | ||
499 | |||
500 | static inline void map_executable(struct file *fp, struct elf_phdr *epp, int pnum, | ||
501 | unsigned int *estack, unsigned int *laddr, | ||
502 | unsigned int *scode, unsigned int *ebss, | ||
503 | unsigned int *ecode, unsigned int *edata, | ||
504 | unsigned int *ebrk) | ||
505 | { | ||
506 | unsigned int tmp; | ||
507 | int i, prot; | ||
508 | |||
509 | for (i = 0; i < pnum; i++, epp++) { | ||
510 | if (epp->p_type != PT_LOAD) | ||
511 | continue; | ||
512 | |||
513 | /* Map it. */ | ||
514 | prot = (epp->p_flags & PF_R) ? PROT_READ : 0; | ||
515 | prot |= (epp->p_flags & PF_W) ? PROT_WRITE : 0; | ||
516 | prot |= (epp->p_flags & PF_X) ? PROT_EXEC : 0; | ||
517 | down_write(¤t->mm->mmap_sem); | ||
518 | (void) do_mmap(fp, (epp->p_vaddr & 0xfffff000), | ||
519 | (epp->p_filesz + (epp->p_vaddr & 0xfff)), | ||
520 | prot, EXEC_MAP_FLAGS, | ||
521 | (epp->p_offset & 0xfffff000)); | ||
522 | up_write(¤t->mm->mmap_sem); | ||
523 | |||
524 | /* Fixup location tracking vars. */ | ||
525 | if ((epp->p_vaddr & 0xfffff000) < *estack) | ||
526 | *estack = (epp->p_vaddr & 0xfffff000); | ||
527 | if (!*laddr) | ||
528 | *laddr = epp->p_vaddr - epp->p_offset; | ||
529 | if (epp->p_vaddr < *scode) | ||
530 | *scode = epp->p_vaddr; | ||
531 | |||
532 | tmp = epp->p_vaddr + epp->p_filesz; | ||
533 | if (tmp > *ebss) | ||
534 | *ebss = tmp; | ||
535 | if ((epp->p_flags & PF_X) && *ecode < tmp) | ||
536 | *ecode = tmp; | ||
537 | if (*edata < tmp) | ||
538 | *edata = tmp; | ||
539 | |||
540 | tmp = epp->p_vaddr + epp->p_memsz; | ||
541 | if (tmp > *ebrk) | ||
542 | *ebrk = tmp; | ||
543 | } | ||
544 | |||
545 | } | ||
546 | |||
547 | static inline int map_interpreter(struct elf_phdr *epp, struct elfhdr *ihp, | ||
548 | struct file *interp, unsigned int *iladdr, | ||
549 | int pnum, mm_segment_t old_fs, | ||
550 | unsigned int *eentry) | ||
551 | { | ||
552 | int i; | ||
553 | |||
554 | *eentry = 0xffffffff; | ||
555 | for (i = 0; i < pnum; i++, epp++) { | ||
556 | if (epp->p_type != PT_INTERP) | ||
557 | continue; | ||
558 | |||
559 | /* We should have fielded this error elsewhere... */ | ||
560 | if (*eentry != 0xffffffff) | ||
561 | return -1; | ||
562 | |||
563 | set_fs(old_fs); | ||
564 | *eentry = load_irix_interp(ihp, interp, iladdr); | ||
565 | old_fs = get_fs(); | ||
566 | set_fs(get_ds()); | ||
567 | |||
568 | fput(interp); | ||
569 | |||
570 | if (*eentry == 0xffffffff) | ||
571 | return -1; | ||
572 | } | ||
573 | return 0; | ||
574 | } | ||
575 | |||
576 | /* | ||
577 | * IRIX maps a page at 0x200000 that holds information about the | ||
578 | * process and the system, here we map the page and fill the | ||
579 | * structure | ||
580 | */ | ||
581 | static int irix_map_prda_page(void) | ||
582 | { | ||
583 | unsigned long v; | ||
584 | struct prda *pp; | ||
585 | |||
586 | down_write(¤t->mm->mmap_sem); | ||
587 | v = do_brk(PRDA_ADDRESS, PAGE_SIZE); | ||
588 | up_write(¤t->mm->mmap_sem); | ||
589 | |||
590 | if (v != PRDA_ADDRESS) | ||
591 | return v; /* v must be an error code */ | ||
592 | |||
593 | pp = (struct prda *) v; | ||
594 | pp->prda_sys.t_pid = task_pid_vnr(current); | ||
595 | pp->prda_sys.t_prid = read_c0_prid(); | ||
596 | pp->prda_sys.t_rpid = task_pid_vnr(current); | ||
597 | |||
598 | /* We leave the rest set to zero */ | ||
599 | |||
600 | return 0; | ||
601 | } | ||
602 | |||
603 | |||
604 | |||
605 | /* These are the functions used to load ELF style executables and shared | ||
606 | * libraries. There is no binary dependent code anywhere else. | ||
607 | */ | ||
608 | static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs) | ||
609 | { | ||
610 | struct elfhdr elf_ex, interp_elf_ex; | ||
611 | struct file *interpreter; | ||
612 | struct elf_phdr *elf_phdata, *elf_ihdr, *elf_ephdr; | ||
613 | unsigned int load_addr, elf_bss, elf_brk; | ||
614 | unsigned int elf_entry, interp_load_addr = 0; | ||
615 | unsigned int start_code, end_code, end_data, elf_stack; | ||
616 | int retval, has_interp, has_ephdr, size, i; | ||
617 | char *elf_interpreter; | ||
618 | mm_segment_t old_fs; | ||
619 | |||
620 | load_addr = 0; | ||
621 | has_interp = has_ephdr = 0; | ||
622 | elf_ihdr = elf_ephdr = NULL; | ||
623 | elf_ex = *((struct elfhdr *) bprm->buf); | ||
624 | retval = -ENOEXEC; | ||
625 | |||
626 | if (verify_binary(&elf_ex, bprm)) | ||
627 | goto out; | ||
628 | |||
629 | /* | ||
630 | * Telling -o32 static binaries from Linux and Irix apart from each | ||
631 | * other is difficult. There are 2 differences to be noted for static | ||
632 | * binaries from the 2 operating systems: | ||
633 | * | ||
634 | * 1) Irix binaries have their .text section before their .init | ||
635 | * section. Linux binaries are just the opposite. | ||
636 | * | ||
637 | * 2) Irix binaries usually have <= 12 sections and Linux | ||
638 | * binaries have > 20. | ||
639 | * | ||
640 | * We will use Method #2 since Method #1 would require us to read in | ||
641 | * the section headers which is way too much overhead. This appears | ||
642 | * to work for everything we have ran into so far. If anyone has a | ||
643 | * better method to tell the binaries apart, I'm listening. | ||
644 | */ | ||
645 | if (elf_ex.e_shnum > 20) | ||
646 | goto out; | ||
647 | |||
648 | print_elfhdr(&elf_ex); | ||
649 | |||
650 | /* Now read in all of the header information */ | ||
651 | size = elf_ex.e_phentsize * elf_ex.e_phnum; | ||
652 | if (size > 65536) | ||
653 | goto out; | ||
654 | elf_phdata = kmalloc(size, GFP_KERNEL); | ||
655 | if (elf_phdata == NULL) { | ||
656 | retval = -ENOMEM; | ||
657 | goto out; | ||
658 | } | ||
659 | |||
660 | retval = kernel_read(bprm->file, elf_ex.e_phoff, (char *)elf_phdata, size); | ||
661 | if (retval < 0) | ||
662 | goto out_free_ph; | ||
663 | |||
664 | dump_phdrs(elf_phdata, elf_ex.e_phnum); | ||
665 | |||
666 | /* Set some things for later. */ | ||
667 | for (i = 0; i < elf_ex.e_phnum; i++) { | ||
668 | switch (elf_phdata[i].p_type) { | ||
669 | case PT_INTERP: | ||
670 | has_interp = 1; | ||
671 | elf_ihdr = &elf_phdata[i]; | ||
672 | break; | ||
673 | case PT_PHDR: | ||
674 | has_ephdr = 1; | ||
675 | elf_ephdr = &elf_phdata[i]; | ||
676 | break; | ||
677 | }; | ||
678 | } | ||
679 | |||
680 | pr_debug("\n"); | ||
681 | |||
682 | elf_bss = 0; | ||
683 | elf_brk = 0; | ||
684 | |||
685 | elf_stack = 0xffffffff; | ||
686 | elf_interpreter = NULL; | ||
687 | start_code = 0xffffffff; | ||
688 | end_code = 0; | ||
689 | end_data = 0; | ||
690 | |||
691 | /* | ||
692 | * If we get a return value, we change the value to be ENOEXEC | ||
693 | * so that we can exit gracefully and the main binary format | ||
694 | * search loop in 'fs/exec.c' will move onto the next handler | ||
695 | * which should be the normal ELF binary handler. | ||
696 | */ | ||
697 | retval = look_for_irix_interpreter(&elf_interpreter, &interpreter, | ||
698 | &interp_elf_ex, elf_phdata, bprm, | ||
699 | elf_ex.e_phnum); | ||
700 | if (retval) { | ||
701 | retval = -ENOEXEC; | ||
702 | goto out_free_file; | ||
703 | } | ||
704 | |||
705 | if (elf_interpreter) { | ||
706 | retval = verify_irix_interpreter(&interp_elf_ex); | ||
707 | if (retval) | ||
708 | goto out_free_interp; | ||
709 | } | ||
710 | |||
711 | /* OK, we are done with that, now set up the arg stuff, | ||
712 | * and then start this sucker up. | ||
713 | */ | ||
714 | retval = -E2BIG; | ||
715 | if (!bprm->sh_bang && !bprm->p) | ||
716 | goto out_free_interp; | ||
717 | |||
718 | /* Flush all traces of the currently running executable */ | ||
719 | retval = flush_old_exec(bprm); | ||
720 | if (retval) | ||
721 | goto out_free_dentry; | ||
722 | |||
723 | /* OK, This is the point of no return */ | ||
724 | current->mm->end_data = 0; | ||
725 | current->mm->end_code = 0; | ||
726 | current->mm->mmap = NULL; | ||
727 | current->flags &= ~PF_FORKNOEXEC; | ||
728 | elf_entry = (unsigned int) elf_ex.e_entry; | ||
729 | |||
730 | /* Do this so that we can load the interpreter, if need be. We will | ||
731 | * change some of these later. | ||
732 | */ | ||
733 | setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT); | ||
734 | current->mm->start_stack = bprm->p; | ||
735 | |||
736 | /* At this point, we assume that the image should be loaded at | ||
737 | * fixed address, not at a variable address. | ||
738 | */ | ||
739 | old_fs = get_fs(); | ||
740 | set_fs(get_ds()); | ||
741 | |||
742 | map_executable(bprm->file, elf_phdata, elf_ex.e_phnum, &elf_stack, | ||
743 | &load_addr, &start_code, &elf_bss, &end_code, | ||
744 | &end_data, &elf_brk); | ||
745 | |||
746 | if (elf_interpreter) { | ||
747 | retval = map_interpreter(elf_phdata, &interp_elf_ex, | ||
748 | interpreter, &interp_load_addr, | ||
749 | elf_ex.e_phnum, old_fs, &elf_entry); | ||
750 | kfree(elf_interpreter); | ||
751 | if (retval) { | ||
752 | set_fs(old_fs); | ||
753 | printk("Unable to load IRIX ELF interpreter\n"); | ||
754 | send_sig(SIGSEGV, current, 0); | ||
755 | retval = 0; | ||
756 | goto out_free_file; | ||
757 | } | ||
758 | } | ||
759 | |||
760 | set_fs(old_fs); | ||
761 | |||
762 | kfree(elf_phdata); | ||
763 | set_personality(PER_IRIX32); | ||
764 | set_binfmt(&irix_format); | ||
765 | compute_creds(bprm); | ||
766 | current->flags &= ~PF_FORKNOEXEC; | ||
767 | bprm->p = (unsigned long) | ||
768 | create_irix_tables((char *)bprm->p, bprm->argc, bprm->envc, | ||
769 | (elf_interpreter ? &elf_ex : NULL), | ||
770 | load_addr, interp_load_addr, regs, elf_ephdr); | ||
771 | current->mm->start_brk = current->mm->brk = elf_brk; | ||
772 | current->mm->end_code = end_code; | ||
773 | current->mm->start_code = start_code; | ||
774 | current->mm->end_data = end_data; | ||
775 | current->mm->start_stack = bprm->p; | ||
776 | |||
777 | /* Calling set_brk effectively mmaps the pages that we need for the | ||
778 | * bss and break sections. | ||
779 | */ | ||
780 | set_brk(elf_bss, elf_brk); | ||
781 | |||
782 | /* | ||
783 | * IRIX maps a page at 0x200000 which holds some system | ||
784 | * information. Programs depend on this. | ||
785 | */ | ||
786 | if (irix_map_prda_page()) | ||
787 | goto out_free_dentry; | ||
788 | |||
789 | padzero(elf_bss); | ||
790 | |||
791 | pr_debug("(start_brk) %lx\n" , (long) current->mm->start_brk); | ||
792 | pr_debug("(end_code) %lx\n" , (long) current->mm->end_code); | ||
793 | pr_debug("(start_code) %lx\n" , (long) current->mm->start_code); | ||
794 | pr_debug("(end_data) %lx\n" , (long) current->mm->end_data); | ||
795 | pr_debug("(start_stack) %lx\n" , (long) current->mm->start_stack); | ||
796 | pr_debug("(brk) %lx\n" , (long) current->mm->brk); | ||
797 | |||
798 | #if 0 /* XXX No fucking way dude... */ | ||
799 | /* Why this, you ask??? Well SVr4 maps page 0 as read-only, | ||
800 | * and some applications "depend" upon this behavior. | ||
801 | * Since we do not have the power to recompile these, we | ||
802 | * emulate the SVr4 behavior. Sigh. | ||
803 | */ | ||
804 | down_write(¤t->mm->mmap_sem); | ||
805 | (void) do_mmap(NULL, 0, 4096, PROT_READ | PROT_EXEC, | ||
806 | MAP_FIXED | MAP_PRIVATE, 0); | ||
807 | up_write(¤t->mm->mmap_sem); | ||
808 | #endif | ||
809 | |||
810 | start_thread(regs, elf_entry, bprm->p); | ||
811 | if (current->ptrace & PT_PTRACED) | ||
812 | send_sig(SIGTRAP, current, 0); | ||
813 | return 0; | ||
814 | out: | ||
815 | return retval; | ||
816 | |||
817 | out_free_dentry: | ||
818 | allow_write_access(interpreter); | ||
819 | fput(interpreter); | ||
820 | out_free_interp: | ||
821 | kfree(elf_interpreter); | ||
822 | out_free_file: | ||
823 | out_free_ph: | ||
824 | kfree(elf_phdata); | ||
825 | goto out; | ||
826 | } | ||
827 | |||
828 | /* This is really simpleminded and specialized - we are loading an | ||
829 | * a.out library that is given an ELF header. | ||
830 | */ | ||
831 | static int load_irix_library(struct file *file) | ||
832 | { | ||
833 | struct elfhdr elf_ex; | ||
834 | struct elf_phdr *elf_phdata = NULL; | ||
835 | unsigned int len = 0; | ||
836 | int elf_bss = 0; | ||
837 | int retval; | ||
838 | unsigned int bss; | ||
839 | int error; | ||
840 | int i, j, k; | ||
841 | |||
842 | error = kernel_read(file, 0, (char *) &elf_ex, sizeof(elf_ex)); | ||
843 | if (error != sizeof(elf_ex)) | ||
844 | return -ENOEXEC; | ||
845 | |||
846 | if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0) | ||
847 | return -ENOEXEC; | ||
848 | |||
849 | /* First of all, some simple consistency checks. */ | ||
850 | if (elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 || | ||
851 | !file->f_op->mmap) | ||
852 | return -ENOEXEC; | ||
853 | |||
854 | /* Now read in all of the header information. */ | ||
855 | if (sizeof(struct elf_phdr) * elf_ex.e_phnum > PAGE_SIZE) | ||
856 | return -ENOEXEC; | ||
857 | |||
858 | elf_phdata = kmalloc(sizeof(struct elf_phdr) * elf_ex.e_phnum, GFP_KERNEL); | ||
859 | if (elf_phdata == NULL) | ||
860 | return -ENOMEM; | ||
861 | |||
862 | retval = kernel_read(file, elf_ex.e_phoff, (char *) elf_phdata, | ||
863 | sizeof(struct elf_phdr) * elf_ex.e_phnum); | ||
864 | |||
865 | j = 0; | ||
866 | for (i=0; i<elf_ex.e_phnum; i++) | ||
867 | if ((elf_phdata + i)->p_type == PT_LOAD) j++; | ||
868 | |||
869 | if (j != 1) { | ||
870 | kfree(elf_phdata); | ||
871 | return -ENOEXEC; | ||
872 | } | ||
873 | |||
874 | while (elf_phdata->p_type != PT_LOAD) elf_phdata++; | ||
875 | |||
876 | /* Now use mmap to map the library into memory. */ | ||
877 | down_write(¤t->mm->mmap_sem); | ||
878 | error = do_mmap(file, | ||
879 | elf_phdata->p_vaddr & 0xfffff000, | ||
880 | elf_phdata->p_filesz + (elf_phdata->p_vaddr & 0xfff), | ||
881 | PROT_READ | PROT_WRITE | PROT_EXEC, | ||
882 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, | ||
883 | elf_phdata->p_offset & 0xfffff000); | ||
884 | up_write(¤t->mm->mmap_sem); | ||
885 | |||
886 | k = elf_phdata->p_vaddr + elf_phdata->p_filesz; | ||
887 | if (k > elf_bss) elf_bss = k; | ||
888 | |||
889 | if (error != (elf_phdata->p_vaddr & 0xfffff000)) { | ||
890 | kfree(elf_phdata); | ||
891 | return error; | ||
892 | } | ||
893 | |||
894 | padzero(elf_bss); | ||
895 | |||
896 | len = (elf_phdata->p_filesz + elf_phdata->p_vaddr+ 0xfff) & 0xfffff000; | ||
897 | bss = elf_phdata->p_memsz + elf_phdata->p_vaddr; | ||
898 | if (bss > len) { | ||
899 | down_write(¤t->mm->mmap_sem); | ||
900 | do_brk(len, bss-len); | ||
901 | up_write(¤t->mm->mmap_sem); | ||
902 | } | ||
903 | kfree(elf_phdata); | ||
904 | return 0; | ||
905 | } | ||
906 | |||
907 | /* Called through irix_syssgi() to map an elf image given an FD, | ||
908 | * a phdr ptr USER_PHDRP in userspace, and a count CNT telling how many | ||
909 | * phdrs there are in the USER_PHDRP array. We return the vaddr the | ||
910 | * first phdr was successfully mapped to. | ||
911 | */ | ||
912 | unsigned long irix_mapelf(int fd, struct elf_phdr __user *user_phdrp, int cnt) | ||
913 | { | ||
914 | unsigned long type, vaddr, filesz, offset, flags; | ||
915 | struct elf_phdr __user *hp; | ||
916 | struct file *filp; | ||
917 | int i, retval; | ||
918 | |||
919 | pr_debug("irix_mapelf: fd[%d] user_phdrp[%p] cnt[%d]\n", | ||
920 | fd, user_phdrp, cnt); | ||
921 | |||
922 | /* First get the verification out of the way. */ | ||
923 | hp = user_phdrp; | ||
924 | if (!access_ok(VERIFY_READ, hp, (sizeof(struct elf_phdr) * cnt))) { | ||
925 | pr_debug("irix_mapelf: bad pointer to ELF PHDR!\n"); | ||
926 | |||
927 | return -EFAULT; | ||
928 | } | ||
929 | |||
930 | dump_phdrs(user_phdrp, cnt); | ||
931 | |||
932 | for (i = 0; i < cnt; i++, hp++) { | ||
933 | if (__get_user(type, &hp->p_type)) | ||
934 | return -EFAULT; | ||
935 | if (type != PT_LOAD) { | ||
936 | printk("irix_mapelf: One section is not PT_LOAD!\n"); | ||
937 | return -ENOEXEC; | ||
938 | } | ||
939 | } | ||
940 | |||
941 | filp = fget(fd); | ||
942 | if (!filp) | ||
943 | return -EACCES; | ||
944 | if (!filp->f_op) { | ||
945 | printk("irix_mapelf: Bogon filp!\n"); | ||
946 | fput(filp); | ||
947 | return -EACCES; | ||
948 | } | ||
949 | |||
950 | hp = user_phdrp; | ||
951 | for (i = 0; i < cnt; i++, hp++) { | ||
952 | int prot; | ||
953 | |||
954 | retval = __get_user(vaddr, &hp->p_vaddr); | ||
955 | retval |= __get_user(filesz, &hp->p_filesz); | ||
956 | retval |= __get_user(offset, &hp->p_offset); | ||
957 | retval |= __get_user(flags, &hp->p_flags); | ||
958 | if (retval) | ||
959 | return retval; | ||
960 | |||
961 | prot = (flags & PF_R) ? PROT_READ : 0; | ||
962 | prot |= (flags & PF_W) ? PROT_WRITE : 0; | ||
963 | prot |= (flags & PF_X) ? PROT_EXEC : 0; | ||
964 | |||
965 | down_write(¤t->mm->mmap_sem); | ||
966 | retval = do_mmap(filp, (vaddr & 0xfffff000), | ||
967 | (filesz + (vaddr & 0xfff)), | ||
968 | prot, (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE), | ||
969 | (offset & 0xfffff000)); | ||
970 | up_write(¤t->mm->mmap_sem); | ||
971 | |||
972 | if (retval != (vaddr & 0xfffff000)) { | ||
973 | printk("irix_mapelf: do_mmap fails with %d!\n", retval); | ||
974 | fput(filp); | ||
975 | return retval; | ||
976 | } | ||
977 | } | ||
978 | |||
979 | pr_debug("irix_mapelf: Success, returning %08lx\n", | ||
980 | (unsigned long) user_phdrp->p_vaddr); | ||
981 | |||
982 | fput(filp); | ||
983 | |||
984 | if (__get_user(vaddr, &user_phdrp->p_vaddr)) | ||
985 | return -EFAULT; | ||
986 | |||
987 | return vaddr; | ||
988 | } | ||
989 | |||
990 | /* | ||
991 | * ELF core dumper | ||
992 | * | ||
993 | * Modelled on fs/exec.c:aout_core_dump() | ||
994 | * Jeremy Fitzhardinge <jeremy@sw.oz.au> | ||
995 | */ | ||
996 | |||
997 | /* These are the only things you should do on a core-file: use only these | ||
998 | * functions to write out all the necessary info. | ||
999 | */ | ||
1000 | static int dump_write(struct file *file, const void __user *addr, int nr) | ||
1001 | { | ||
1002 | return file->f_op->write(file, (const char __user *) addr, nr, &file->f_pos) == nr; | ||
1003 | } | ||
1004 | |||
1005 | static int dump_seek(struct file *file, off_t off) | ||
1006 | { | ||
1007 | if (file->f_op->llseek) { | ||
1008 | if (file->f_op->llseek(file, off, 0) != off) | ||
1009 | return 0; | ||
1010 | } else | ||
1011 | file->f_pos = off; | ||
1012 | return 1; | ||
1013 | } | ||
1014 | |||
1015 | /* Decide whether a segment is worth dumping; default is yes to be | ||
1016 | * sure (missing info is worse than too much; etc). | ||
1017 | * Personally I'd include everything, and use the coredump limit... | ||
1018 | * | ||
1019 | * I think we should skip something. But I am not sure how. H.J. | ||
1020 | */ | ||
1021 | static inline int maydump(struct vm_area_struct *vma) | ||
1022 | { | ||
1023 | if (!(vma->vm_flags & (VM_READ|VM_WRITE|VM_EXEC))) | ||
1024 | return 0; | ||
1025 | #if 1 | ||
1026 | if (vma->vm_flags & (VM_WRITE|VM_GROWSUP|VM_GROWSDOWN)) | ||
1027 | return 1; | ||
1028 | if (vma->vm_flags & (VM_READ|VM_EXEC|VM_EXECUTABLE|VM_SHARED)) | ||
1029 | return 0; | ||
1030 | #endif | ||
1031 | return 1; | ||
1032 | } | ||
1033 | |||
1034 | /* An ELF note in memory. */ | ||
1035 | struct memelfnote | ||
1036 | { | ||
1037 | const char *name; | ||
1038 | int type; | ||
1039 | unsigned int datasz; | ||
1040 | void *data; | ||
1041 | }; | ||
1042 | |||
1043 | static int notesize(struct memelfnote *en) | ||
1044 | { | ||
1045 | int sz; | ||
1046 | |||
1047 | sz = sizeof(struct elf_note); | ||
1048 | sz += roundup(strlen(en->name) + 1, 4); | ||
1049 | sz += roundup(en->datasz, 4); | ||
1050 | |||
1051 | return sz; | ||
1052 | } | ||
1053 | |||
1054 | #define DUMP_WRITE(addr, nr) \ | ||
1055 | if (!dump_write(file, (addr), (nr))) \ | ||
1056 | goto end_coredump; | ||
1057 | #define DUMP_SEEK(off) \ | ||
1058 | if (!dump_seek(file, (off))) \ | ||
1059 | goto end_coredump; | ||
1060 | |||
1061 | static int writenote(struct memelfnote *men, struct file *file) | ||
1062 | { | ||
1063 | struct elf_note en; | ||
1064 | |||
1065 | en.n_namesz = strlen(men->name) + 1; | ||
1066 | en.n_descsz = men->datasz; | ||
1067 | en.n_type = men->type; | ||
1068 | |||
1069 | DUMP_WRITE(&en, sizeof(en)); | ||
1070 | DUMP_WRITE(men->name, en.n_namesz); | ||
1071 | /* XXX - cast from long long to long to avoid need for libgcc.a */ | ||
1072 | DUMP_SEEK(roundup((unsigned long)file->f_pos, 4)); /* XXX */ | ||
1073 | DUMP_WRITE(men->data, men->datasz); | ||
1074 | DUMP_SEEK(roundup((unsigned long)file->f_pos, 4)); /* XXX */ | ||
1075 | |||
1076 | return 1; | ||
1077 | |||
1078 | end_coredump: | ||
1079 | return 0; | ||
1080 | } | ||
1081 | #undef DUMP_WRITE | ||
1082 | #undef DUMP_SEEK | ||
1083 | |||
1084 | #define DUMP_WRITE(addr, nr) \ | ||
1085 | if (!dump_write(file, (addr), (nr))) \ | ||
1086 | goto end_coredump; | ||
1087 | #define DUMP_SEEK(off) \ | ||
1088 | if (!dump_seek(file, (off))) \ | ||
1089 | goto end_coredump; | ||
1090 | |||
1091 | /* Actual dumper. | ||
1092 | * | ||
1093 | * This is a two-pass process; first we find the offsets of the bits, | ||
1094 | * and then they are actually written out. If we run out of core limit | ||
1095 | * we just truncate. | ||
1096 | */ | ||
1097 | static int irix_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit) | ||
1098 | { | ||
1099 | int has_dumped = 0; | ||
1100 | mm_segment_t fs; | ||
1101 | int segs; | ||
1102 | int i; | ||
1103 | size_t size; | ||
1104 | struct vm_area_struct *vma; | ||
1105 | struct elfhdr elf; | ||
1106 | off_t offset = 0, dataoff; | ||
1107 | int numnote = 3; | ||
1108 | struct memelfnote notes[3]; | ||
1109 | struct elf_prstatus prstatus; /* NT_PRSTATUS */ | ||
1110 | elf_fpregset_t fpu; /* NT_PRFPREG */ | ||
1111 | struct elf_prpsinfo psinfo; /* NT_PRPSINFO */ | ||
1112 | |||
1113 | /* Count what's needed to dump, up to the limit of coredump size. */ | ||
1114 | segs = 0; | ||
1115 | size = 0; | ||
1116 | for (vma = current->mm->mmap; vma != NULL; vma = vma->vm_next) { | ||
1117 | if (maydump(vma)) | ||
1118 | { | ||
1119 | int sz = vma->vm_end-vma->vm_start; | ||
1120 | |||
1121 | if (size+sz >= limit) | ||
1122 | break; | ||
1123 | else | ||
1124 | size += sz; | ||
1125 | } | ||
1126 | |||
1127 | segs++; | ||
1128 | } | ||
1129 | pr_debug("irix_core_dump: %d segs taking %d bytes\n", segs, size); | ||
1130 | |||
1131 | /* Set up header. */ | ||
1132 | memcpy(elf.e_ident, ELFMAG, SELFMAG); | ||
1133 | elf.e_ident[EI_CLASS] = ELFCLASS32; | ||
1134 | elf.e_ident[EI_DATA] = ELFDATA2LSB; | ||
1135 | elf.e_ident[EI_VERSION] = EV_CURRENT; | ||
1136 | elf.e_ident[EI_OSABI] = ELF_OSABI; | ||
1137 | memset(elf.e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); | ||
1138 | |||
1139 | elf.e_type = ET_CORE; | ||
1140 | elf.e_machine = ELF_ARCH; | ||
1141 | elf.e_version = EV_CURRENT; | ||
1142 | elf.e_entry = 0; | ||
1143 | elf.e_phoff = sizeof(elf); | ||
1144 | elf.e_shoff = 0; | ||
1145 | elf.e_flags = 0; | ||
1146 | elf.e_ehsize = sizeof(elf); | ||
1147 | elf.e_phentsize = sizeof(struct elf_phdr); | ||
1148 | elf.e_phnum = segs+1; /* Include notes. */ | ||
1149 | elf.e_shentsize = 0; | ||
1150 | elf.e_shnum = 0; | ||
1151 | elf.e_shstrndx = 0; | ||
1152 | |||
1153 | fs = get_fs(); | ||
1154 | set_fs(KERNEL_DS); | ||
1155 | |||
1156 | has_dumped = 1; | ||
1157 | current->flags |= PF_DUMPCORE; | ||
1158 | |||
1159 | DUMP_WRITE(&elf, sizeof(elf)); | ||
1160 | offset += sizeof(elf); /* Elf header. */ | ||
1161 | offset += (segs+1) * sizeof(struct elf_phdr); /* Program headers. */ | ||
1162 | |||
1163 | /* Set up the notes in similar form to SVR4 core dumps made | ||
1164 | * with info from their /proc. | ||
1165 | */ | ||
1166 | memset(&psinfo, 0, sizeof(psinfo)); | ||
1167 | memset(&prstatus, 0, sizeof(prstatus)); | ||
1168 | |||
1169 | notes[0].name = "CORE"; | ||
1170 | notes[0].type = NT_PRSTATUS; | ||
1171 | notes[0].datasz = sizeof(prstatus); | ||
1172 | notes[0].data = &prstatus; | ||
1173 | prstatus.pr_info.si_signo = prstatus.pr_cursig = signr; | ||
1174 | prstatus.pr_sigpend = current->pending.signal.sig[0]; | ||
1175 | prstatus.pr_sighold = current->blocked.sig[0]; | ||
1176 | psinfo.pr_pid = prstatus.pr_pid = task_pid_vnr(current); | ||
1177 | psinfo.pr_ppid = prstatus.pr_ppid = task_pid_vnr(current->parent); | ||
1178 | psinfo.pr_pgrp = prstatus.pr_pgrp = task_pgrp_vnr(current); | ||
1179 | psinfo.pr_sid = prstatus.pr_sid = task_session_vnr(current); | ||
1180 | if (thread_group_leader(current)) { | ||
1181 | /* | ||
1182 | * This is the record for the group leader. Add in the | ||
1183 | * cumulative times of previous dead threads. This total | ||
1184 | * won't include the time of each live thread whose state | ||
1185 | * is included in the core dump. The final total reported | ||
1186 | * to our parent process when it calls wait4 will include | ||
1187 | * those sums as well as the little bit more time it takes | ||
1188 | * this and each other thread to finish dying after the | ||
1189 | * core dump synchronization phase. | ||
1190 | */ | ||
1191 | jiffies_to_timeval(current->utime + current->signal->utime, | ||
1192 | &prstatus.pr_utime); | ||
1193 | jiffies_to_timeval(current->stime + current->signal->stime, | ||
1194 | &prstatus.pr_stime); | ||
1195 | } else { | ||
1196 | jiffies_to_timeval(current->utime, &prstatus.pr_utime); | ||
1197 | jiffies_to_timeval(current->stime, &prstatus.pr_stime); | ||
1198 | } | ||
1199 | jiffies_to_timeval(current->signal->cutime, &prstatus.pr_cutime); | ||
1200 | jiffies_to_timeval(current->signal->cstime, &prstatus.pr_cstime); | ||
1201 | |||
1202 | if (sizeof(elf_gregset_t) != sizeof(struct pt_regs)) { | ||
1203 | printk("sizeof(elf_gregset_t) (%d) != sizeof(struct pt_regs) " | ||
1204 | "(%d)\n", sizeof(elf_gregset_t), sizeof(struct pt_regs)); | ||
1205 | } else { | ||
1206 | *(struct pt_regs *)&prstatus.pr_reg = *regs; | ||
1207 | } | ||
1208 | |||
1209 | notes[1].name = "CORE"; | ||
1210 | notes[1].type = NT_PRPSINFO; | ||
1211 | notes[1].datasz = sizeof(psinfo); | ||
1212 | notes[1].data = &psinfo; | ||
1213 | i = current->state ? ffz(~current->state) + 1 : 0; | ||
1214 | psinfo.pr_state = i; | ||
1215 | psinfo.pr_sname = (i < 0 || i > 5) ? '.' : "RSDZTD"[i]; | ||
1216 | psinfo.pr_zomb = psinfo.pr_sname == 'Z'; | ||
1217 | psinfo.pr_nice = task_nice(current); | ||
1218 | psinfo.pr_flag = current->flags; | ||
1219 | psinfo.pr_uid = current->uid; | ||
1220 | psinfo.pr_gid = current->gid; | ||
1221 | { | ||
1222 | int i, len; | ||
1223 | |||
1224 | set_fs(fs); | ||
1225 | |||
1226 | len = current->mm->arg_end - current->mm->arg_start; | ||
1227 | len = len >= ELF_PRARGSZ ? ELF_PRARGSZ : len; | ||
1228 | (void *) copy_from_user(&psinfo.pr_psargs, | ||
1229 | (const char __user *)current->mm->arg_start, len); | ||
1230 | for (i = 0; i < len; i++) | ||
1231 | if (psinfo.pr_psargs[i] == 0) | ||
1232 | psinfo.pr_psargs[i] = ' '; | ||
1233 | psinfo.pr_psargs[len] = 0; | ||
1234 | |||
1235 | set_fs(KERNEL_DS); | ||
1236 | } | ||
1237 | strlcpy(psinfo.pr_fname, current->comm, sizeof(psinfo.pr_fname)); | ||
1238 | |||
1239 | /* Try to dump the FPU. */ | ||
1240 | prstatus.pr_fpvalid = dump_fpu(regs, &fpu); | ||
1241 | if (!prstatus.pr_fpvalid) { | ||
1242 | numnote--; | ||
1243 | } else { | ||
1244 | notes[2].name = "CORE"; | ||
1245 | notes[2].type = NT_PRFPREG; | ||
1246 | notes[2].datasz = sizeof(fpu); | ||
1247 | notes[2].data = &fpu; | ||
1248 | } | ||
1249 | |||
1250 | /* Write notes phdr entry. */ | ||
1251 | { | ||
1252 | struct elf_phdr phdr; | ||
1253 | int sz = 0; | ||
1254 | |||
1255 | for (i = 0; i < numnote; i++) | ||
1256 | sz += notesize(¬es[i]); | ||
1257 | |||
1258 | phdr.p_type = PT_NOTE; | ||
1259 | phdr.p_offset = offset; | ||
1260 | phdr.p_vaddr = 0; | ||
1261 | phdr.p_paddr = 0; | ||
1262 | phdr.p_filesz = sz; | ||
1263 | phdr.p_memsz = 0; | ||
1264 | phdr.p_flags = 0; | ||
1265 | phdr.p_align = 0; | ||
1266 | |||
1267 | offset += phdr.p_filesz; | ||
1268 | DUMP_WRITE(&phdr, sizeof(phdr)); | ||
1269 | } | ||
1270 | |||
1271 | /* Page-align dumped data. */ | ||
1272 | dataoff = offset = roundup(offset, PAGE_SIZE); | ||
1273 | |||
1274 | /* Write program headers for segments dump. */ | ||
1275 | for (vma = current->mm->mmap, i = 0; | ||
1276 | i < segs && vma != NULL; vma = vma->vm_next) { | ||
1277 | struct elf_phdr phdr; | ||
1278 | size_t sz; | ||
1279 | |||
1280 | i++; | ||
1281 | |||
1282 | sz = vma->vm_end - vma->vm_start; | ||
1283 | |||
1284 | phdr.p_type = PT_LOAD; | ||
1285 | phdr.p_offset = offset; | ||
1286 | phdr.p_vaddr = vma->vm_start; | ||
1287 | phdr.p_paddr = 0; | ||
1288 | phdr.p_filesz = maydump(vma) ? sz : 0; | ||
1289 | phdr.p_memsz = sz; | ||
1290 | offset += phdr.p_filesz; | ||
1291 | phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0; | ||
1292 | if (vma->vm_flags & VM_WRITE) | ||
1293 | phdr.p_flags |= PF_W; | ||
1294 | if (vma->vm_flags & VM_EXEC) | ||
1295 | phdr.p_flags |= PF_X; | ||
1296 | phdr.p_align = PAGE_SIZE; | ||
1297 | |||
1298 | DUMP_WRITE(&phdr, sizeof(phdr)); | ||
1299 | } | ||
1300 | |||
1301 | for (i = 0; i < numnote; i++) | ||
1302 | if (!writenote(¬es[i], file)) | ||
1303 | goto end_coredump; | ||
1304 | |||
1305 | set_fs(fs); | ||
1306 | |||
1307 | DUMP_SEEK(dataoff); | ||
1308 | |||
1309 | for (i = 0, vma = current->mm->mmap; | ||
1310 | i < segs && vma != NULL; | ||
1311 | vma = vma->vm_next) { | ||
1312 | unsigned long addr = vma->vm_start; | ||
1313 | unsigned long len = vma->vm_end - vma->vm_start; | ||
1314 | |||
1315 | if (!maydump(vma)) | ||
1316 | continue; | ||
1317 | i++; | ||
1318 | pr_debug("elf_core_dump: writing %08lx %lx\n", addr, len); | ||
1319 | DUMP_WRITE((void __user *)addr, len); | ||
1320 | } | ||
1321 | |||
1322 | if ((off_t) file->f_pos != offset) { | ||
1323 | /* Sanity check. */ | ||
1324 | printk("elf_core_dump: file->f_pos (%ld) != offset (%ld)\n", | ||
1325 | (off_t) file->f_pos, offset); | ||
1326 | } | ||
1327 | |||
1328 | end_coredump: | ||
1329 | set_fs(fs); | ||
1330 | return has_dumped; | ||
1331 | } | ||
1332 | |||
1333 | static int __init init_irix_binfmt(void) | ||
1334 | { | ||
1335 | extern int init_inventory(void); | ||
1336 | extern asmlinkage unsigned long sys_call_table; | ||
1337 | extern asmlinkage unsigned long sys_call_table_irix5; | ||
1338 | |||
1339 | init_inventory(); | ||
1340 | |||
1341 | /* | ||
1342 | * Copy the IRIX5 syscall table (8000 bytes) into the main syscall | ||
1343 | * table. The IRIX5 calls are located by an offset of 8000 bytes | ||
1344 | * from the beginning of the main table. | ||
1345 | */ | ||
1346 | memcpy((void *) ((unsigned long) &sys_call_table + 8000), | ||
1347 | &sys_call_table_irix5, 8000); | ||
1348 | |||
1349 | return register_binfmt(&irix_format); | ||
1350 | } | ||
1351 | |||
1352 | static void __exit exit_irix_binfmt(void) | ||
1353 | { | ||
1354 | /* | ||
1355 | * Remove the Irix ELF loader. | ||
1356 | */ | ||
1357 | unregister_binfmt(&irix_format); | ||
1358 | } | ||
1359 | |||
1360 | module_init(init_irix_binfmt) | ||
1361 | module_exit(exit_irix_binfmt) | ||
diff --git a/arch/mips/kernel/irixinv.c b/arch/mips/kernel/irixinv.c deleted file mode 100644 index cf2dcd3d6a93..000000000000 --- a/arch/mips/kernel/irixinv.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* | ||
2 | * Support the inventory interface for IRIX binaries | ||
3 | * This is invoked before the mm layer is working, so we do not | ||
4 | * use the linked lists for the inventory yet. | ||
5 | * | ||
6 | * Miguel de Icaza, 1997. | ||
7 | */ | ||
8 | #include <linux/mm.h> | ||
9 | #include <asm/inventory.h> | ||
10 | #include <asm/uaccess.h> | ||
11 | |||
12 | #define MAX_INVENTORY 50 | ||
13 | int inventory_items = 0; | ||
14 | |||
15 | static inventory_t inventory [MAX_INVENTORY]; | ||
16 | |||
17 | void add_to_inventory(int class, int type, int controller, int unit, int state) | ||
18 | { | ||
19 | inventory_t *ni = &inventory [inventory_items]; | ||
20 | |||
21 | if (inventory_items == MAX_INVENTORY) | ||
22 | return; | ||
23 | |||
24 | ni->inv_class = class; | ||
25 | ni->inv_type = type; | ||
26 | ni->inv_controller = controller; | ||
27 | ni->inv_unit = unit; | ||
28 | ni->inv_state = state; | ||
29 | ni->inv_next = ni; | ||
30 | inventory_items++; | ||
31 | } | ||
32 | |||
33 | int dump_inventory_to_user(void __user *userbuf, int size) | ||
34 | { | ||
35 | inventory_t *inv = &inventory [0]; | ||
36 | inventory_t __user *user = userbuf; | ||
37 | int v; | ||
38 | |||
39 | if (!access_ok(VERIFY_WRITE, userbuf, size)) | ||
40 | return -EFAULT; | ||
41 | |||
42 | for (v = 0; v < inventory_items; v++){ | ||
43 | inv = &inventory [v]; | ||
44 | if (copy_to_user (user, inv, sizeof (inventory_t))) | ||
45 | return -EFAULT; | ||
46 | user++; | ||
47 | } | ||
48 | return inventory_items * sizeof(inventory_t); | ||
49 | } | ||
50 | |||
51 | int __init init_inventory(void) | ||
52 | { | ||
53 | /* | ||
54 | * gross hack while we put the right bits all over the kernel | ||
55 | * most likely this will not let just anyone run the X server | ||
56 | * until we put the right values all over the place | ||
57 | */ | ||
58 | add_to_inventory(10, 3, 0, 0, 16400); | ||
59 | add_to_inventory(1, 1, 150, -1, 12); | ||
60 | add_to_inventory(1, 3, 0, 0, 8976); | ||
61 | add_to_inventory(1, 2, 0, 0, 8976); | ||
62 | add_to_inventory(4, 8, 0, 0, 2); | ||
63 | add_to_inventory(5, 5, 0, 0, 1); | ||
64 | add_to_inventory(3, 3, 0, 0, 32768); | ||
65 | add_to_inventory(3, 4, 0, 0, 32768); | ||
66 | add_to_inventory(3, 8, 0, 0, 524288); | ||
67 | add_to_inventory(3, 9, 0, 0, 64); | ||
68 | add_to_inventory(3, 1, 0, 0, 67108864); | ||
69 | add_to_inventory(12, 3, 0, 0, 16); | ||
70 | add_to_inventory(8, 7, 17, 0, 16777472); | ||
71 | add_to_inventory(8, 0, 0, 0, 1); | ||
72 | add_to_inventory(2, 1, 0, 13, 2); | ||
73 | add_to_inventory(2, 2, 0, 2, 0); | ||
74 | add_to_inventory(2, 2, 0, 1, 0); | ||
75 | add_to_inventory(7, 14, 0, 0, 6); | ||
76 | |||
77 | return 0; | ||
78 | } | ||
diff --git a/arch/mips/kernel/irixioctl.c b/arch/mips/kernel/irixioctl.c deleted file mode 100644 index b39bdba82e02..000000000000 --- a/arch/mips/kernel/irixioctl.c +++ /dev/null | |||
@@ -1,213 +0,0 @@ | |||
1 | /* | ||
2 | * irixioctl.c: A fucking mess... | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) | ||
5 | */ | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/sched.h> | ||
9 | #include <linux/fs.h> | ||
10 | #include <linux/mm.h> | ||
11 | #include <linux/smp.h> | ||
12 | #include <linux/sockios.h> | ||
13 | #include <linux/syscalls.h> | ||
14 | #include <linux/tty.h> | ||
15 | #include <linux/file.h> | ||
16 | #include <linux/rcupdate.h> | ||
17 | |||
18 | #include <asm/uaccess.h> | ||
19 | #include <asm/ioctl.h> | ||
20 | #include <asm/ioctls.h> | ||
21 | |||
22 | #undef DEBUG_IOCTLS | ||
23 | #undef DEBUG_MISSING_IOCTL | ||
24 | |||
25 | struct irix_termios { | ||
26 | tcflag_t c_iflag, c_oflag, c_cflag, c_lflag; | ||
27 | cc_t c_cc[NCCS]; | ||
28 | }; | ||
29 | |||
30 | asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg) | ||
31 | { | ||
32 | struct tty_struct *tp, *rtp; | ||
33 | mm_segment_t old_fs; | ||
34 | int i, error = 0; | ||
35 | |||
36 | #ifdef DEBUG_IOCTLS | ||
37 | printk("[%s:%d] irix_ioctl(%d, ", current->comm, current->pid, fd); | ||
38 | #endif | ||
39 | switch(cmd) { | ||
40 | case 0x00005401: | ||
41 | #ifdef DEBUG_IOCTLS | ||
42 | printk("TCGETA, %08lx) ", arg); | ||
43 | #endif | ||
44 | error = sys_ioctl(fd, TCGETA, arg); | ||
45 | break; | ||
46 | |||
47 | case 0x0000540d: { | ||
48 | struct termios kt; | ||
49 | struct irix_termios __user *it = | ||
50 | (struct irix_termios __user *) arg; | ||
51 | |||
52 | #ifdef DEBUG_IOCTLS | ||
53 | printk("TCGETS, %08lx) ", arg); | ||
54 | #endif | ||
55 | if (!access_ok(VERIFY_WRITE, it, sizeof(*it))) { | ||
56 | error = -EFAULT; | ||
57 | break; | ||
58 | } | ||
59 | old_fs = get_fs(); set_fs(get_ds()); | ||
60 | error = sys_ioctl(fd, TCGETS, (unsigned long) &kt); | ||
61 | set_fs(old_fs); | ||
62 | if (error) | ||
63 | break; | ||
64 | |||
65 | error = __put_user(kt.c_iflag, &it->c_iflag); | ||
66 | error |= __put_user(kt.c_oflag, &it->c_oflag); | ||
67 | error |= __put_user(kt.c_cflag, &it->c_cflag); | ||
68 | error |= __put_user(kt.c_lflag, &it->c_lflag); | ||
69 | |||
70 | for (i = 0; i < NCCS; i++) | ||
71 | error |= __put_user(kt.c_cc[i], &it->c_cc[i]); | ||
72 | break; | ||
73 | } | ||
74 | |||
75 | case 0x0000540e: { | ||
76 | struct termios kt; | ||
77 | struct irix_termios *it = (struct irix_termios *) arg; | ||
78 | |||
79 | #ifdef DEBUG_IOCTLS | ||
80 | printk("TCSETS, %08lx) ", arg); | ||
81 | #endif | ||
82 | if (!access_ok(VERIFY_READ, it, sizeof(*it))) { | ||
83 | error = -EFAULT; | ||
84 | break; | ||
85 | } | ||
86 | old_fs = get_fs(); set_fs(get_ds()); | ||
87 | error = sys_ioctl(fd, TCGETS, (unsigned long) &kt); | ||
88 | set_fs(old_fs); | ||
89 | if (error) | ||
90 | break; | ||
91 | |||
92 | error = __get_user(kt.c_iflag, &it->c_iflag); | ||
93 | error |= __get_user(kt.c_oflag, &it->c_oflag); | ||
94 | error |= __get_user(kt.c_cflag, &it->c_cflag); | ||
95 | error |= __get_user(kt.c_lflag, &it->c_lflag); | ||
96 | |||
97 | for (i = 0; i < NCCS; i++) | ||
98 | error |= __get_user(kt.c_cc[i], &it->c_cc[i]); | ||
99 | |||
100 | if (error) | ||
101 | break; | ||
102 | old_fs = get_fs(); set_fs(get_ds()); | ||
103 | error = sys_ioctl(fd, TCSETS, (unsigned long) &kt); | ||
104 | set_fs(old_fs); | ||
105 | break; | ||
106 | } | ||
107 | |||
108 | case 0x0000540f: | ||
109 | #ifdef DEBUG_IOCTLS | ||
110 | printk("TCSETSW, %08lx) ", arg); | ||
111 | #endif | ||
112 | error = sys_ioctl(fd, TCSETSW, arg); | ||
113 | break; | ||
114 | |||
115 | case 0x00005471: | ||
116 | #ifdef DEBUG_IOCTLS | ||
117 | printk("TIOCNOTTY, %08lx) ", arg); | ||
118 | #endif | ||
119 | error = sys_ioctl(fd, TIOCNOTTY, arg); | ||
120 | break; | ||
121 | |||
122 | case 0x00007416: { | ||
123 | pid_t pid; | ||
124 | #ifdef DEBUG_IOCTLS | ||
125 | printk("TIOCGSID, %08lx) ", arg); | ||
126 | #endif | ||
127 | old_fs = get_fs(); set_fs(get_ds()); | ||
128 | error = sys_ioctl(fd, TIOCGSID, (unsigned long)&pid); | ||
129 | set_fs(old_fs); | ||
130 | if (!error) | ||
131 | error = put_user(pid, (unsigned long __user *) arg); | ||
132 | break; | ||
133 | } | ||
134 | case 0x746e: | ||
135 | /* TIOCSTART, same effect as hitting ^Q */ | ||
136 | #ifdef DEBUG_IOCTLS | ||
137 | printk("TIOCSTART, %08lx) ", arg); | ||
138 | #endif | ||
139 | error = sys_ioctl(fd, TCXONC, TCOON); | ||
140 | break; | ||
141 | |||
142 | case 0x20006968: | ||
143 | #ifdef DEBUG_IOCTLS | ||
144 | printk("SIOCGETLABEL, %08lx) ", arg); | ||
145 | #endif | ||
146 | error = -ENOPKG; | ||
147 | break; | ||
148 | |||
149 | case 0x40047477: | ||
150 | #ifdef DEBUG_IOCTLS | ||
151 | printk("TIOCGPGRP, %08lx) ", arg); | ||
152 | #endif | ||
153 | error = sys_ioctl(fd, TIOCGPGRP, arg); | ||
154 | #ifdef DEBUG_IOCTLS | ||
155 | printk("arg=%d ", *(int *)arg); | ||
156 | #endif | ||
157 | break; | ||
158 | |||
159 | case 0x40087468: | ||
160 | #ifdef DEBUG_IOCTLS | ||
161 | printk("TIOCGWINSZ, %08lx) ", arg); | ||
162 | #endif | ||
163 | error = sys_ioctl(fd, TIOCGWINSZ, arg); | ||
164 | break; | ||
165 | |||
166 | case 0x8004667e: | ||
167 | error = sys_ioctl(fd, FIONBIO, arg); | ||
168 | break; | ||
169 | |||
170 | case 0x80047476: | ||
171 | error = sys_ioctl(fd, TIOCSPGRP, arg); | ||
172 | break; | ||
173 | |||
174 | case 0x8020690c: | ||
175 | error = sys_ioctl(fd, SIOCSIFADDR, arg); | ||
176 | break; | ||
177 | |||
178 | case 0x80206910: | ||
179 | error = sys_ioctl(fd, SIOCSIFFLAGS, arg); | ||
180 | break; | ||
181 | |||
182 | case 0xc0206911: | ||
183 | error = sys_ioctl(fd, SIOCGIFFLAGS, arg); | ||
184 | break; | ||
185 | |||
186 | case 0xc020691b: | ||
187 | error = sys_ioctl(fd, SIOCGIFMETRIC, arg); | ||
188 | break; | ||
189 | |||
190 | default: { | ||
191 | #ifdef DEBUG_MISSING_IOCTL | ||
192 | char *msg = "Unimplemented IOCTL cmd tell linux-mips@linux-mips.org\n"; | ||
193 | |||
194 | #ifdef DEBUG_IOCTLS | ||
195 | printk("UNIMP_IOCTL, %08lx)\n", arg); | ||
196 | #endif | ||
197 | old_fs = get_fs(); set_fs(get_ds()); | ||
198 | sys_write(2, msg, strlen(msg)); | ||
199 | set_fs(old_fs); | ||
200 | printk("[%s:%d] Does unimplemented IRIX ioctl cmd %08lx\n", | ||
201 | current->comm, current->pid, cmd); | ||
202 | do_exit(255); | ||
203 | #else | ||
204 | error = sys_ioctl(fd, cmd, arg); | ||
205 | #endif | ||
206 | } | ||
207 | |||
208 | }; | ||
209 | #ifdef DEBUG_IOCTLS | ||
210 | printk("error=%d\n", error); | ||
211 | #endif | ||
212 | return error; | ||
213 | } | ||
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c deleted file mode 100644 index 0215c805a592..000000000000 --- a/arch/mips/kernel/irixsig.c +++ /dev/null | |||
@@ -1,888 +0,0 @@ | |||
1 | /* | ||
2 | * irixsig.c: WHEEE, IRIX signals! YOW, am I compatible or what?!?! | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) | ||
5 | * Copyright (C) 1997 - 2000 Ralf Baechle (ralf@gnu.org) | ||
6 | * Copyright (C) 2000 Silicon Graphics, Inc. | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/sched.h> | ||
10 | #include <linux/mm.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/smp.h> | ||
13 | #include <linux/time.h> | ||
14 | #include <linux/ptrace.h> | ||
15 | #include <linux/resource.h> | ||
16 | |||
17 | #include <asm/ptrace.h> | ||
18 | #include <asm/uaccess.h> | ||
19 | #include <asm/unistd.h> | ||
20 | |||
21 | #undef DEBUG_SIG | ||
22 | |||
23 | #define _S(nr) (1<<((nr)-1)) | ||
24 | |||
25 | #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) | ||
26 | |||
27 | #define _IRIX_NSIG 128 | ||
28 | #define _IRIX_NSIG_BPW BITS_PER_LONG | ||
29 | #define _IRIX_NSIG_WORDS (_IRIX_NSIG / _IRIX_NSIG_BPW) | ||
30 | |||
31 | typedef struct { | ||
32 | unsigned long sig[_IRIX_NSIG_WORDS]; | ||
33 | } irix_sigset_t; | ||
34 | |||
35 | struct sigctx_irix5 { | ||
36 | u32 rmask, cp0_status; | ||
37 | u64 pc; | ||
38 | u64 regs[32]; | ||
39 | u64 fpregs[32]; | ||
40 | u32 usedfp, fpcsr, fpeir, sstk_flags; | ||
41 | u64 hi, lo; | ||
42 | u64 cp0_cause, cp0_badvaddr, _unused0; | ||
43 | irix_sigset_t sigset; | ||
44 | u64 weird_fpu_thing; | ||
45 | u64 _unused1[31]; | ||
46 | }; | ||
47 | |||
48 | #ifdef DEBUG_SIG | ||
49 | /* Debugging */ | ||
50 | static inline void dump_irix5_sigctx(struct sigctx_irix5 *c) | ||
51 | { | ||
52 | int i; | ||
53 | |||
54 | printk("misc: rmask[%08lx] status[%08lx] pc[%08lx]\n", | ||
55 | (unsigned long) c->rmask, | ||
56 | (unsigned long) c->cp0_status, | ||
57 | (unsigned long) c->pc); | ||
58 | printk("regs: "); | ||
59 | for(i = 0; i < 16; i++) | ||
60 | printk("[%d]<%08lx> ", i, (unsigned long) c->regs[i]); | ||
61 | printk("\nregs: "); | ||
62 | for(i = 16; i < 32; i++) | ||
63 | printk("[%d]<%08lx> ", i, (unsigned long) c->regs[i]); | ||
64 | printk("\nfpregs: "); | ||
65 | for(i = 0; i < 16; i++) | ||
66 | printk("[%d]<%08lx> ", i, (unsigned long) c->fpregs[i]); | ||
67 | printk("\nfpregs: "); | ||
68 | for(i = 16; i < 32; i++) | ||
69 | printk("[%d]<%08lx> ", i, (unsigned long) c->fpregs[i]); | ||
70 | printk("misc: usedfp[%d] fpcsr[%08lx] fpeir[%08lx] stk_flgs[%08lx]\n", | ||
71 | (int) c->usedfp, (unsigned long) c->fpcsr, | ||
72 | (unsigned long) c->fpeir, (unsigned long) c->sstk_flags); | ||
73 | printk("misc: hi[%08lx] lo[%08lx] cause[%08lx] badvaddr[%08lx]\n", | ||
74 | (unsigned long) c->hi, (unsigned long) c->lo, | ||
75 | (unsigned long) c->cp0_cause, (unsigned long) c->cp0_badvaddr); | ||
76 | printk("misc: sigset<0>[%08lx] sigset<1>[%08lx] sigset<2>[%08lx] " | ||
77 | "sigset<3>[%08lx]\n", (unsigned long) c->sigset.sig[0], | ||
78 | (unsigned long) c->sigset.sig[1], | ||
79 | (unsigned long) c->sigset.sig[2], | ||
80 | (unsigned long) c->sigset.sig[3]); | ||
81 | } | ||
82 | #endif | ||
83 | |||
84 | static int setup_irix_frame(struct k_sigaction *ka, struct pt_regs *regs, | ||
85 | int signr, sigset_t *oldmask) | ||
86 | { | ||
87 | struct sigctx_irix5 __user *ctx; | ||
88 | unsigned long sp; | ||
89 | int error, i; | ||
90 | |||
91 | sp = regs->regs[29]; | ||
92 | sp -= sizeof(struct sigctx_irix5); | ||
93 | sp &= ~(0xf); | ||
94 | ctx = (struct sigctx_irix5 __user *) sp; | ||
95 | if (!access_ok(VERIFY_WRITE, ctx, sizeof(*ctx))) | ||
96 | goto segv_and_exit; | ||
97 | |||
98 | error = __put_user(0, &ctx->weird_fpu_thing); | ||
99 | error |= __put_user(~(0x00000001), &ctx->rmask); | ||
100 | error |= __put_user(0, &ctx->regs[0]); | ||
101 | for(i = 1; i < 32; i++) | ||
102 | error |= __put_user((u64) regs->regs[i], &ctx->regs[i]); | ||
103 | |||
104 | error |= __put_user((u64) regs->hi, &ctx->hi); | ||
105 | error |= __put_user((u64) regs->lo, &ctx->lo); | ||
106 | error |= __put_user((u64) regs->cp0_epc, &ctx->pc); | ||
107 | error |= __put_user(!!used_math(), &ctx->usedfp); | ||
108 | error |= __put_user((u64) regs->cp0_cause, &ctx->cp0_cause); | ||
109 | error |= __put_user((u64) regs->cp0_badvaddr, &ctx->cp0_badvaddr); | ||
110 | |||
111 | error |= __put_user(0, &ctx->sstk_flags); /* XXX sigstack unimp... todo... */ | ||
112 | |||
113 | error |= __copy_to_user(&ctx->sigset, oldmask, sizeof(irix_sigset_t)) ? -EFAULT : 0; | ||
114 | |||
115 | if (error) | ||
116 | goto segv_and_exit; | ||
117 | |||
118 | #ifdef DEBUG_SIG | ||
119 | dump_irix5_sigctx(ctx); | ||
120 | #endif | ||
121 | |||
122 | regs->regs[4] = (unsigned long) signr; | ||
123 | regs->regs[5] = 0; /* XXX sigcode XXX */ | ||
124 | regs->regs[6] = regs->regs[29] = sp; | ||
125 | regs->regs[7] = (unsigned long) ka->sa.sa_handler; | ||
126 | regs->regs[25] = regs->cp0_epc = (unsigned long) ka->sa_restorer; | ||
127 | |||
128 | return 1; | ||
129 | |||
130 | segv_and_exit: | ||
131 | force_sigsegv(signr, current); | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static int inline | ||
136 | setup_irix_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, | ||
137 | int signr, sigset_t *oldmask, siginfo_t *info) | ||
138 | { | ||
139 | printk("Aiee: setup_tr_frame wants to be written"); | ||
140 | do_exit(SIGSEGV); | ||
141 | } | ||
142 | |||
143 | static inline int handle_signal(unsigned long sig, siginfo_t *info, | ||
144 | struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs) | ||
145 | { | ||
146 | int ret; | ||
147 | |||
148 | switch(regs->regs[0]) { | ||
149 | case ERESTARTNOHAND: | ||
150 | regs->regs[2] = EINTR; | ||
151 | break; | ||
152 | case ERESTARTSYS: | ||
153 | if(!(ka->sa.sa_flags & SA_RESTART)) { | ||
154 | regs->regs[2] = EINTR; | ||
155 | break; | ||
156 | } | ||
157 | /* fallthrough */ | ||
158 | case ERESTARTNOINTR: /* Userland will reload $v0. */ | ||
159 | regs->cp0_epc -= 8; | ||
160 | } | ||
161 | |||
162 | regs->regs[0] = 0; /* Don't deal with this again. */ | ||
163 | |||
164 | if (ka->sa.sa_flags & SA_SIGINFO) | ||
165 | ret = setup_irix_rt_frame(ka, regs, sig, oldset, info); | ||
166 | else | ||
167 | ret = setup_irix_frame(ka, regs, sig, oldset); | ||
168 | |||
169 | spin_lock_irq(¤t->sighand->siglock); | ||
170 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | ||
171 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
172 | sigaddset(¤t->blocked, sig); | ||
173 | recalc_sigpending(); | ||
174 | spin_unlock_irq(¤t->sighand->siglock); | ||
175 | |||
176 | return ret; | ||
177 | } | ||
178 | |||
179 | void do_irix_signal(struct pt_regs *regs) | ||
180 | { | ||
181 | struct k_sigaction ka; | ||
182 | siginfo_t info; | ||
183 | int signr; | ||
184 | sigset_t *oldset; | ||
185 | |||
186 | /* | ||
187 | * We want the common case to go fast, which is why we may in certain | ||
188 | * cases get here from kernel mode. Just return without doing anything | ||
189 | * if so. | ||
190 | */ | ||
191 | if (!user_mode(regs)) | ||
192 | return; | ||
193 | |||
194 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
195 | oldset = ¤t->saved_sigmask; | ||
196 | else | ||
197 | oldset = ¤t->blocked; | ||
198 | |||
199 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | ||
200 | if (signr > 0) { | ||
201 | /* Whee! Actually deliver the signal. */ | ||
202 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | ||
203 | /* a signal was successfully delivered; the saved | ||
204 | * sigmask will have been stored in the signal frame, | ||
205 | * and will be restored by sigreturn, so we can simply | ||
206 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
207 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
208 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
209 | } | ||
210 | |||
211 | return; | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Who's code doesn't conform to the restartable syscall convention | ||
216 | * dies here!!! The li instruction, a single machine instruction, | ||
217 | * must directly be followed by the syscall instruction. | ||
218 | */ | ||
219 | if (regs->regs[0]) { | ||
220 | if (regs->regs[2] == ERESTARTNOHAND || | ||
221 | regs->regs[2] == ERESTARTSYS || | ||
222 | regs->regs[2] == ERESTARTNOINTR) { | ||
223 | regs->cp0_epc -= 8; | ||
224 | } | ||
225 | if (regs->regs[2] == ERESTART_RESTARTBLOCK) { | ||
226 | regs->regs[2] = __NR_restart_syscall; | ||
227 | regs->regs[7] = regs->regs[26]; | ||
228 | regs->cp0_epc -= 4; | ||
229 | } | ||
230 | regs->regs[0] = 0; /* Don't deal with this again. */ | ||
231 | } | ||
232 | |||
233 | /* | ||
234 | * If there's no signal to deliver, we just put the saved sigmask | ||
235 | * back | ||
236 | */ | ||
237 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | ||
238 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
239 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | asmlinkage void | ||
244 | irix_sigreturn(struct pt_regs *regs) | ||
245 | { | ||
246 | struct sigctx_irix5 __user *context, *magic; | ||
247 | unsigned long umask, mask; | ||
248 | u64 *fregs; | ||
249 | u32 usedfp; | ||
250 | int error, sig, i, base = 0; | ||
251 | sigset_t blocked; | ||
252 | |||
253 | /* Always make any pending restarted system calls return -EINTR */ | ||
254 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
255 | |||
256 | if (regs->regs[2] == 1000) | ||
257 | base = 1; | ||
258 | |||
259 | context = (struct sigctx_irix5 __user *) regs->regs[base + 4]; | ||
260 | magic = (struct sigctx_irix5 __user *) regs->regs[base + 5]; | ||
261 | sig = (int) regs->regs[base + 6]; | ||
262 | #ifdef DEBUG_SIG | ||
263 | printk("[%s:%d] IRIX sigreturn(scp[%p],ucp[%p],sig[%d])\n", | ||
264 | current->comm, current->pid, context, magic, sig); | ||
265 | #endif | ||
266 | if (!context) | ||
267 | context = magic; | ||
268 | if (!access_ok(VERIFY_READ, context, sizeof(struct sigctx_irix5))) | ||
269 | goto badframe; | ||
270 | |||
271 | #ifdef DEBUG_SIG | ||
272 | dump_irix5_sigctx(context); | ||
273 | #endif | ||
274 | |||
275 | error = __get_user(regs->cp0_epc, &context->pc); | ||
276 | error |= __get_user(umask, &context->rmask); | ||
277 | |||
278 | mask = 2; | ||
279 | for (i = 1; i < 32; i++, mask <<= 1) { | ||
280 | if (umask & mask) | ||
281 | error |= __get_user(regs->regs[i], &context->regs[i]); | ||
282 | } | ||
283 | error |= __get_user(regs->hi, &context->hi); | ||
284 | error |= __get_user(regs->lo, &context->lo); | ||
285 | |||
286 | error |= __get_user(usedfp, &context->usedfp); | ||
287 | if ((umask & 1) && usedfp) { | ||
288 | fregs = (u64 *) ¤t->thread.fpu; | ||
289 | |||
290 | for(i = 0; i < 32; i++) | ||
291 | error |= __get_user(fregs[i], &context->fpregs[i]); | ||
292 | error |= __get_user(current->thread.fpu.fcr31, &context->fpcsr); | ||
293 | } | ||
294 | |||
295 | /* XXX do sigstack crapola here... XXX */ | ||
296 | |||
297 | error |= __copy_from_user(&blocked, &context->sigset, sizeof(blocked)) ? -EFAULT : 0; | ||
298 | |||
299 | if (error) | ||
300 | goto badframe; | ||
301 | |||
302 | sigdelsetmask(&blocked, ~_BLOCKABLE); | ||
303 | spin_lock_irq(¤t->sighand->siglock); | ||
304 | current->blocked = blocked; | ||
305 | recalc_sigpending(); | ||
306 | spin_unlock_irq(¤t->sighand->siglock); | ||
307 | |||
308 | /* | ||
309 | * Don't let your children do this ... | ||
310 | */ | ||
311 | __asm__ __volatile__( | ||
312 | "move\t$29,%0\n\t" | ||
313 | "j\tsyscall_exit" | ||
314 | :/* no outputs */ | ||
315 | :"r" (®s)); | ||
316 | /* Unreached */ | ||
317 | |||
318 | badframe: | ||
319 | force_sig(SIGSEGV, current); | ||
320 | } | ||
321 | |||
322 | struct sigact_irix5 { | ||
323 | int flags; | ||
324 | void (*handler)(int); | ||
325 | u32 sigset[4]; | ||
326 | int _unused0[2]; | ||
327 | }; | ||
328 | |||
329 | #define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: | ||
330 | set only the low 32 bit of the sigset. */ | ||
331 | |||
332 | #ifdef DEBUG_SIG | ||
333 | static inline void dump_sigact_irix5(struct sigact_irix5 *p) | ||
334 | { | ||
335 | printk("<f[%d] hndlr[%08lx] msk[%08lx]>", p->flags, | ||
336 | (unsigned long) p->handler, | ||
337 | (unsigned long) p->sigset[0]); | ||
338 | } | ||
339 | #endif | ||
340 | |||
341 | asmlinkage int | ||
342 | irix_sigaction(int sig, const struct sigaction __user *act, | ||
343 | struct sigaction __user *oact, void __user *trampoline) | ||
344 | { | ||
345 | struct k_sigaction new_ka, old_ka; | ||
346 | int ret; | ||
347 | |||
348 | #ifdef DEBUG_SIG | ||
349 | printk(" (%d,%s,%s,%08lx) ", sig, (!new ? "0" : "NEW"), | ||
350 | (!old ? "0" : "OLD"), trampoline); | ||
351 | if(new) { | ||
352 | dump_sigact_irix5(new); printk(" "); | ||
353 | } | ||
354 | #endif | ||
355 | if (act) { | ||
356 | sigset_t mask; | ||
357 | int err; | ||
358 | |||
359 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) | ||
360 | return -EFAULT; | ||
361 | err = __get_user(new_ka.sa.sa_handler, &act->sa_handler); | ||
362 | err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); | ||
363 | |||
364 | err |= __copy_from_user(&mask, &act->sa_mask, sizeof(sigset_t)) ? -EFAULT : 0; | ||
365 | if (err) | ||
366 | return err; | ||
367 | |||
368 | /* | ||
369 | * Hmmm... methinks IRIX libc always passes a valid trampoline | ||
370 | * value for all invocations of sigaction. Will have to | ||
371 | * investigate. POSIX POSIX, die die die... | ||
372 | */ | ||
373 | new_ka.sa_restorer = trampoline; | ||
374 | } | ||
375 | |||
376 | /* XXX Implement SIG_SETMASK32 for IRIX compatibility */ | ||
377 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | ||
378 | |||
379 | if (!ret && oact) { | ||
380 | int err; | ||
381 | |||
382 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact))) | ||
383 | return -EFAULT; | ||
384 | |||
385 | err = __put_user(old_ka.sa.sa_handler, &oact->sa_handler); | ||
386 | err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); | ||
387 | err |= __copy_to_user(&oact->sa_mask, &old_ka.sa.sa_mask, | ||
388 | sizeof(sigset_t)) ? -EFAULT : 0; | ||
389 | if (err) | ||
390 | return -EFAULT; | ||
391 | } | ||
392 | |||
393 | return ret; | ||
394 | } | ||
395 | |||
396 | asmlinkage int irix_sigpending(irix_sigset_t __user *set) | ||
397 | { | ||
398 | return do_sigpending(set, sizeof(*set)); | ||
399 | } | ||
400 | |||
401 | asmlinkage int irix_sigprocmask(int how, irix_sigset_t __user *new, | ||
402 | irix_sigset_t __user *old) | ||
403 | { | ||
404 | sigset_t oldbits, newbits; | ||
405 | |||
406 | if (new) { | ||
407 | if (!access_ok(VERIFY_READ, new, sizeof(*new))) | ||
408 | return -EFAULT; | ||
409 | if (__copy_from_user(&newbits, new, sizeof(unsigned long)*4)) | ||
410 | return -EFAULT; | ||
411 | sigdelsetmask(&newbits, ~_BLOCKABLE); | ||
412 | |||
413 | spin_lock_irq(¤t->sighand->siglock); | ||
414 | oldbits = current->blocked; | ||
415 | |||
416 | switch(how) { | ||
417 | case 1: | ||
418 | sigorsets(&newbits, &oldbits, &newbits); | ||
419 | break; | ||
420 | |||
421 | case 2: | ||
422 | sigandsets(&newbits, &oldbits, &newbits); | ||
423 | break; | ||
424 | |||
425 | case 3: | ||
426 | break; | ||
427 | |||
428 | case 256: | ||
429 | siginitset(&newbits, newbits.sig[0]); | ||
430 | break; | ||
431 | |||
432 | default: | ||
433 | spin_unlock_irq(¤t->sighand->siglock); | ||
434 | return -EINVAL; | ||
435 | } | ||
436 | recalc_sigpending(); | ||
437 | spin_unlock_irq(¤t->sighand->siglock); | ||
438 | } | ||
439 | if (old) | ||
440 | return copy_to_user(old, ¤t->blocked, | ||
441 | sizeof(unsigned long)*4) ? -EFAULT : 0; | ||
442 | |||
443 | return 0; | ||
444 | } | ||
445 | |||
446 | asmlinkage int irix_sigsuspend(struct pt_regs *regs) | ||
447 | { | ||
448 | sigset_t newset; | ||
449 | sigset_t __user *uset; | ||
450 | |||
451 | uset = (sigset_t __user *) regs->regs[4]; | ||
452 | if (copy_from_user(&newset, uset, sizeof(sigset_t))) | ||
453 | return -EFAULT; | ||
454 | sigdelsetmask(&newset, ~_BLOCKABLE); | ||
455 | |||
456 | spin_lock_irq(¤t->sighand->siglock); | ||
457 | current->saved_sigmask = current->blocked; | ||
458 | current->blocked = newset; | ||
459 | recalc_sigpending(); | ||
460 | spin_unlock_irq(¤t->sighand->siglock); | ||
461 | |||
462 | current->state = TASK_INTERRUPTIBLE; | ||
463 | schedule(); | ||
464 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
465 | return -ERESTARTNOHAND; | ||
466 | } | ||
467 | |||
468 | /* hate hate hate... */ | ||
469 | struct irix5_siginfo { | ||
470 | int sig, code, error; | ||
471 | union { | ||
472 | char unused[128 - (3 * 4)]; /* Safety net. */ | ||
473 | struct { | ||
474 | int pid; | ||
475 | union { | ||
476 | int uid; | ||
477 | struct { | ||
478 | int utime, status, stime; | ||
479 | } child; | ||
480 | } procdata; | ||
481 | } procinfo; | ||
482 | |||
483 | unsigned long fault_addr; | ||
484 | |||
485 | struct { | ||
486 | int fd; | ||
487 | long band; | ||
488 | } fileinfo; | ||
489 | |||
490 | unsigned long sigval; | ||
491 | } stuff; | ||
492 | }; | ||
493 | |||
494 | asmlinkage int irix_sigpoll_sys(unsigned long __user *set, | ||
495 | struct irix5_siginfo __user *info, struct timespec __user *tp) | ||
496 | { | ||
497 | long expire = MAX_SCHEDULE_TIMEOUT; | ||
498 | sigset_t kset; | ||
499 | int i, sig, error, timeo = 0; | ||
500 | struct timespec ktp; | ||
501 | |||
502 | #ifdef DEBUG_SIG | ||
503 | printk("[%s:%d] irix_sigpoll_sys(%p,%p,%p)\n", | ||
504 | current->comm, current->pid, set, info, tp); | ||
505 | #endif | ||
506 | |||
507 | /* Must always specify the signal set. */ | ||
508 | if (!set) | ||
509 | return -EINVAL; | ||
510 | |||
511 | if (copy_from_user(&kset, set, sizeof(set))) | ||
512 | return -EFAULT; | ||
513 | |||
514 | if (info && clear_user(info, sizeof(*info))) { | ||
515 | error = -EFAULT; | ||
516 | goto out; | ||
517 | } | ||
518 | |||
519 | if (tp) { | ||
520 | if (copy_from_user(&ktp, tp, sizeof(*tp))) | ||
521 | return -EFAULT; | ||
522 | |||
523 | if (!ktp.tv_sec && !ktp.tv_nsec) | ||
524 | return -EINVAL; | ||
525 | |||
526 | expire = timespec_to_jiffies(&ktp) + | ||
527 | (ktp.tv_sec || ktp.tv_nsec); | ||
528 | } | ||
529 | |||
530 | while(1) { | ||
531 | long tmp = 0; | ||
532 | |||
533 | expire = schedule_timeout_interruptible(expire); | ||
534 | |||
535 | for (i=0; i < _IRIX_NSIG_WORDS; i++) | ||
536 | tmp |= (current->pending.signal.sig[i] & kset.sig[i]); | ||
537 | |||
538 | if (tmp) | ||
539 | break; | ||
540 | if (!expire) { | ||
541 | timeo = 1; | ||
542 | break; | ||
543 | } | ||
544 | if (signal_pending(current)) | ||
545 | return -EINTR; | ||
546 | } | ||
547 | if (timeo) | ||
548 | return -EAGAIN; | ||
549 | |||
550 | for (sig = 1; i <= 65 /* IRIX_NSIG */; sig++) { | ||
551 | if (sigismember (&kset, sig)) | ||
552 | continue; | ||
553 | if (sigismember (¤t->pending.signal, sig)) { | ||
554 | /* XXX need more than this... */ | ||
555 | if (info) | ||
556 | return copy_to_user(&info->sig, &sig, sizeof(sig)); | ||
557 | return 0; | ||
558 | } | ||
559 | } | ||
560 | |||
561 | /* Should not get here, but do something sane if we do. */ | ||
562 | error = -EINTR; | ||
563 | |||
564 | out: | ||
565 | return error; | ||
566 | } | ||
567 | |||
568 | /* This is here because of irix5_siginfo definition. */ | ||
569 | #define IRIX_P_PID 0 | ||
570 | #define IRIX_P_PGID 2 | ||
571 | #define IRIX_P_ALL 7 | ||
572 | |||
573 | #define W_EXITED 1 | ||
574 | #define W_TRAPPED 2 | ||
575 | #define W_STOPPED 4 | ||
576 | #define W_CONT 8 | ||
577 | #define W_NOHANG 64 | ||
578 | |||
579 | #define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG) | ||
580 | |||
581 | asmlinkage int irix_waitsys(int type, int upid, | ||
582 | struct irix5_siginfo __user *info, int options, | ||
583 | struct rusage __user *ru) | ||
584 | { | ||
585 | struct pid *pid = NULL; | ||
586 | int flag, retval; | ||
587 | DECLARE_WAITQUEUE(wait, current); | ||
588 | struct task_struct *tsk; | ||
589 | struct task_struct *p; | ||
590 | struct list_head *_p; | ||
591 | |||
592 | if (!info) | ||
593 | return -EINVAL; | ||
594 | |||
595 | if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) | ||
596 | return -EFAULT; | ||
597 | |||
598 | if (ru) | ||
599 | if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru))) | ||
600 | return -EFAULT; | ||
601 | |||
602 | if (options & ~W_MASK) | ||
603 | return -EINVAL; | ||
604 | |||
605 | if (type != IRIX_P_PID && type != IRIX_P_PGID && type != IRIX_P_ALL) | ||
606 | return -EINVAL; | ||
607 | |||
608 | if (type != IRIX_P_ALL) | ||
609 | pid = find_get_pid(upid); | ||
610 | add_wait_queue(¤t->signal->wait_chldexit, &wait); | ||
611 | repeat: | ||
612 | flag = 0; | ||
613 | current->state = TASK_INTERRUPTIBLE; | ||
614 | read_lock(&tasklist_lock); | ||
615 | tsk = current; | ||
616 | list_for_each(_p, &tsk->children) { | ||
617 | p = list_entry(_p, struct task_struct, sibling); | ||
618 | if ((type == IRIX_P_PID) && task_pid(p) != pid) | ||
619 | continue; | ||
620 | if ((type == IRIX_P_PGID) && task_pgrp(p) != pid) | ||
621 | continue; | ||
622 | if ((p->exit_signal != SIGCHLD)) | ||
623 | continue; | ||
624 | flag = 1; | ||
625 | switch (p->state) { | ||
626 | case TASK_STOPPED: | ||
627 | if (!p->exit_code) | ||
628 | continue; | ||
629 | if (!(options & (W_TRAPPED|W_STOPPED)) && | ||
630 | !(p->ptrace & PT_PTRACED)) | ||
631 | continue; | ||
632 | read_unlock(&tasklist_lock); | ||
633 | |||
634 | /* move to end of parent's list to avoid starvation */ | ||
635 | write_lock_irq(&tasklist_lock); | ||
636 | remove_parent(p); | ||
637 | add_parent(p); | ||
638 | write_unlock_irq(&tasklist_lock); | ||
639 | retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0; | ||
640 | if (retval) | ||
641 | goto end_waitsys; | ||
642 | |||
643 | retval = __put_user(SIGCHLD, &info->sig); | ||
644 | retval |= __put_user(0, &info->code); | ||
645 | retval |= __put_user(task_pid_vnr(p), &info->stuff.procinfo.pid); | ||
646 | retval |= __put_user((p->exit_code >> 8) & 0xff, | ||
647 | &info->stuff.procinfo.procdata.child.status); | ||
648 | retval |= __put_user(p->utime, &info->stuff.procinfo.procdata.child.utime); | ||
649 | retval |= __put_user(p->stime, &info->stuff.procinfo.procdata.child.stime); | ||
650 | if (retval) | ||
651 | goto end_waitsys; | ||
652 | |||
653 | p->exit_code = 0; | ||
654 | goto end_waitsys; | ||
655 | |||
656 | case EXIT_ZOMBIE: | ||
657 | current->signal->cutime += p->utime + p->signal->cutime; | ||
658 | current->signal->cstime += p->stime + p->signal->cstime; | ||
659 | if (ru != NULL) | ||
660 | getrusage(p, RUSAGE_BOTH, ru); | ||
661 | retval = __put_user(SIGCHLD, &info->sig); | ||
662 | retval |= __put_user(1, &info->code); /* CLD_EXITED */ | ||
663 | retval |= __put_user(task_pid_vnr(p), &info->stuff.procinfo.pid); | ||
664 | retval |= __put_user((p->exit_code >> 8) & 0xff, | ||
665 | &info->stuff.procinfo.procdata.child.status); | ||
666 | retval |= __put_user(p->utime, | ||
667 | &info->stuff.procinfo.procdata.child.utime); | ||
668 | retval |= __put_user(p->stime, | ||
669 | &info->stuff.procinfo.procdata.child.stime); | ||
670 | if (retval) | ||
671 | goto end_waitsys; | ||
672 | |||
673 | if (p->real_parent != p->parent) { | ||
674 | write_lock_irq(&tasklist_lock); | ||
675 | remove_parent(p); | ||
676 | p->parent = p->real_parent; | ||
677 | add_parent(p); | ||
678 | do_notify_parent(p, SIGCHLD); | ||
679 | write_unlock_irq(&tasklist_lock); | ||
680 | } else | ||
681 | release_task(p); | ||
682 | goto end_waitsys; | ||
683 | default: | ||
684 | continue; | ||
685 | } | ||
686 | tsk = next_thread(tsk); | ||
687 | } | ||
688 | read_unlock(&tasklist_lock); | ||
689 | if (flag) { | ||
690 | retval = 0; | ||
691 | if (options & W_NOHANG) | ||
692 | goto end_waitsys; | ||
693 | retval = -ERESTARTSYS; | ||
694 | if (signal_pending(current)) | ||
695 | goto end_waitsys; | ||
696 | current->state = TASK_INTERRUPTIBLE; | ||
697 | schedule(); | ||
698 | goto repeat; | ||
699 | } | ||
700 | retval = -ECHILD; | ||
701 | end_waitsys: | ||
702 | current->state = TASK_RUNNING; | ||
703 | remove_wait_queue(¤t->signal->wait_chldexit, &wait); | ||
704 | put_pid(pid); | ||
705 | |||
706 | return retval; | ||
707 | } | ||
708 | |||
709 | struct irix5_context { | ||
710 | u32 flags; | ||
711 | u32 link; | ||
712 | u32 sigmask[4]; | ||
713 | struct { u32 sp, size, flags; } stack; | ||
714 | int regs[36]; | ||
715 | u32 fpregs[32]; | ||
716 | u32 fpcsr; | ||
717 | u32 _unused0; | ||
718 | u32 _unused1[47]; | ||
719 | u32 weird_graphics_thing; | ||
720 | }; | ||
721 | |||
722 | asmlinkage int irix_getcontext(struct pt_regs *regs) | ||
723 | { | ||
724 | int error, i, base = 0; | ||
725 | struct irix5_context __user *ctx; | ||
726 | unsigned long flags; | ||
727 | |||
728 | if (regs->regs[2] == 1000) | ||
729 | base = 1; | ||
730 | ctx = (struct irix5_context __user *) regs->regs[base + 4]; | ||
731 | |||
732 | #ifdef DEBUG_SIG | ||
733 | printk("[%s:%d] irix_getcontext(%p)\n", | ||
734 | current->comm, current->pid, ctx); | ||
735 | #endif | ||
736 | |||
737 | if (!access_ok(VERIFY_WRITE, ctx, sizeof(*ctx))) | ||
738 | return -EFAULT; | ||
739 | |||
740 | error = __put_user(current->thread.irix_oldctx, &ctx->link); | ||
741 | |||
742 | error |= __copy_to_user(&ctx->sigmask, ¤t->blocked, sizeof(irix_sigset_t)) ? -EFAULT : 0; | ||
743 | |||
744 | /* XXX Do sigstack stuff someday... */ | ||
745 | error |= __put_user(0, &ctx->stack.sp); | ||
746 | error |= __put_user(0, &ctx->stack.size); | ||
747 | error |= __put_user(0, &ctx->stack.flags); | ||
748 | |||
749 | error |= __put_user(0, &ctx->weird_graphics_thing); | ||
750 | error |= __put_user(0, &ctx->regs[0]); | ||
751 | for (i = 1; i < 32; i++) | ||
752 | error |= __put_user(regs->regs[i], &ctx->regs[i]); | ||
753 | error |= __put_user(regs->lo, &ctx->regs[32]); | ||
754 | error |= __put_user(regs->hi, &ctx->regs[33]); | ||
755 | error |= __put_user(regs->cp0_cause, &ctx->regs[34]); | ||
756 | error |= __put_user(regs->cp0_epc, &ctx->regs[35]); | ||
757 | |||
758 | flags = 0x0f; | ||
759 | if (!used_math()) { | ||
760 | flags &= ~(0x08); | ||
761 | } else { | ||
762 | /* XXX wheee... */ | ||
763 | printk("Wheee, no code for saving IRIX FPU context yet.\n"); | ||
764 | } | ||
765 | error |= __put_user(flags, &ctx->flags); | ||
766 | |||
767 | return error; | ||
768 | } | ||
769 | |||
770 | asmlinkage void irix_setcontext(struct pt_regs *regs) | ||
771 | { | ||
772 | struct irix5_context __user *ctx; | ||
773 | int err, base = 0; | ||
774 | u32 flags; | ||
775 | |||
776 | if (regs->regs[2] == 1000) | ||
777 | base = 1; | ||
778 | ctx = (struct irix5_context __user *) regs->regs[base + 4]; | ||
779 | |||
780 | #ifdef DEBUG_SIG | ||
781 | printk("[%s:%d] irix_setcontext(%p)\n", | ||
782 | current->comm, current->pid, ctx); | ||
783 | #endif | ||
784 | |||
785 | if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))) | ||
786 | goto segv_and_exit; | ||
787 | |||
788 | err = __get_user(flags, &ctx->flags); | ||
789 | if (flags & 0x02) { | ||
790 | /* XXX sigstack garbage, todo... */ | ||
791 | printk("Wheee, cannot do sigstack stuff in setcontext\n"); | ||
792 | } | ||
793 | |||
794 | if (flags & 0x04) { | ||
795 | int i; | ||
796 | |||
797 | /* XXX extra control block stuff... todo... */ | ||
798 | for (i = 1; i < 32; i++) | ||
799 | err |= __get_user(regs->regs[i], &ctx->regs[i]); | ||
800 | err |= __get_user(regs->lo, &ctx->regs[32]); | ||
801 | err |= __get_user(regs->hi, &ctx->regs[33]); | ||
802 | err |= __get_user(regs->cp0_epc, &ctx->regs[35]); | ||
803 | } | ||
804 | |||
805 | if (flags & 0x08) | ||
806 | /* XXX fpu context, blah... */ | ||
807 | printk(KERN_ERR "Wheee, cannot restore FPU context yet...\n"); | ||
808 | |||
809 | err |= __get_user(current->thread.irix_oldctx, &ctx->link); | ||
810 | if (err) | ||
811 | goto segv_and_exit; | ||
812 | |||
813 | /* | ||
814 | * Don't let your children do this ... | ||
815 | */ | ||
816 | __asm__ __volatile__( | ||
817 | "move\t$29,%0\n\t" | ||
818 | "j\tsyscall_exit" | ||
819 | :/* no outputs */ | ||
820 | :"r" (®s)); | ||
821 | /* Unreached */ | ||
822 | |||
823 | segv_and_exit: | ||
824 | force_sigsegv(SIGSEGV, current); | ||
825 | } | ||
826 | |||
827 | struct irix_sigstack { | ||
828 | unsigned long sp; | ||
829 | int status; | ||
830 | }; | ||
831 | |||
832 | asmlinkage int irix_sigstack(struct irix_sigstack __user *new, | ||
833 | struct irix_sigstack __user *old) | ||
834 | { | ||
835 | #ifdef DEBUG_SIG | ||
836 | printk("[%s:%d] irix_sigstack(%p,%p)\n", | ||
837 | current->comm, current->pid, new, old); | ||
838 | #endif | ||
839 | if (new) { | ||
840 | if (!access_ok(VERIFY_READ, new, sizeof(*new))) | ||
841 | return -EFAULT; | ||
842 | } | ||
843 | |||
844 | if (old) { | ||
845 | if (!access_ok(VERIFY_WRITE, old, sizeof(*old))) | ||
846 | return -EFAULT; | ||
847 | } | ||
848 | |||
849 | return 0; | ||
850 | } | ||
851 | |||
852 | struct irix_sigaltstack { unsigned long sp; int size; int status; }; | ||
853 | |||
854 | asmlinkage int irix_sigaltstack(struct irix_sigaltstack __user *new, | ||
855 | struct irix_sigaltstack __user *old) | ||
856 | { | ||
857 | #ifdef DEBUG_SIG | ||
858 | printk("[%s:%d] irix_sigaltstack(%p,%p)\n", | ||
859 | current->comm, current->pid, new, old); | ||
860 | #endif | ||
861 | if (new) | ||
862 | if (!access_ok(VERIFY_READ, new, sizeof(*new))) | ||
863 | return -EFAULT; | ||
864 | |||
865 | if (old) { | ||
866 | if (!access_ok(VERIFY_WRITE, old, sizeof(*old))) | ||
867 | return -EFAULT; | ||
868 | } | ||
869 | |||
870 | return 0; | ||
871 | } | ||
872 | |||
873 | struct irix_procset { | ||
874 | int cmd, ltype, lid, rtype, rid; | ||
875 | }; | ||
876 | |||
877 | asmlinkage int irix_sigsendset(struct irix_procset __user *pset, int sig) | ||
878 | { | ||
879 | if (!access_ok(VERIFY_READ, pset, sizeof(*pset))) | ||
880 | return -EFAULT; | ||
881 | #ifdef DEBUG_SIG | ||
882 | printk("[%s:%d] irix_sigsendset([%d,%d,%d,%d,%d],%d)\n", | ||
883 | current->comm, current->pid, | ||
884 | pset->cmd, pset->ltype, pset->lid, pset->rtype, pset->rid, | ||
885 | sig); | ||
886 | #endif | ||
887 | return -EINVAL; | ||
888 | } | ||
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index e3309ff9ece4..6045b9a51a35 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c | |||
@@ -44,8 +44,6 @@ again: | |||
44 | return irq; | 44 | return irq; |
45 | } | 45 | } |
46 | 46 | ||
47 | EXPORT_SYMBOL_GPL(allocate_irqno); | ||
48 | |||
49 | /* | 47 | /* |
50 | * Allocate the 16 legacy interrupts for i8259 devices. This happens early | 48 | * Allocate the 16 legacy interrupts for i8259 devices. This happens early |
51 | * in the kernel initialization so treating allocation failure as BUG() is | 49 | * in the kernel initialization so treating allocation failure as BUG() is |
@@ -66,8 +64,6 @@ void free_irqno(unsigned int irq) | |||
66 | smp_mb__after_clear_bit(); | 64 | smp_mb__after_clear_bit(); |
67 | } | 65 | } |
68 | 66 | ||
69 | EXPORT_SYMBOL_GPL(free_irqno); | ||
70 | |||
71 | /* | 67 | /* |
72 | * 'what should we do if we get a hw irq event on an illegal vector'. | 68 | * 'what should we do if we get a hw irq event on an illegal vector'. |
73 | * each architecture has to answer this themselves. | 69 | * each architecture has to answer this themselves. |
diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c index 640fb0cc6e39..d01665a453f5 100644 --- a/arch/mips/kernel/mips-mt.c +++ b/arch/mips/kernel/mips-mt.c | |||
@@ -4,7 +4,6 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/device.h> | 6 | #include <linux/device.h> |
7 | #include <linux/kallsyms.h> | ||
8 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
9 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
10 | #include <linux/module.h> | 9 | #include <linux/module.h> |
@@ -84,9 +83,9 @@ void mips_mt_regdump(unsigned long mvpctl) | |||
84 | read_vpe_c0_vpeconf0()); | 83 | read_vpe_c0_vpeconf0()); |
85 | printk(" VPE%d.Status : %08lx\n", | 84 | printk(" VPE%d.Status : %08lx\n", |
86 | i, read_vpe_c0_status()); | 85 | i, read_vpe_c0_status()); |
87 | printk(" VPE%d.EPC : %08lx ", | 86 | printk(" VPE%d.EPC : %08lx %pS\n", |
88 | i, read_vpe_c0_epc()); | 87 | i, read_vpe_c0_epc(), |
89 | print_symbol("%s\n", read_vpe_c0_epc()); | 88 | (void *) read_vpe_c0_epc()); |
90 | printk(" VPE%d.Cause : %08lx\n", | 89 | printk(" VPE%d.Cause : %08lx\n", |
91 | i, read_vpe_c0_cause()); | 90 | i, read_vpe_c0_cause()); |
92 | printk(" VPE%d.Config7 : %08lx\n", | 91 | printk(" VPE%d.Config7 : %08lx\n", |
@@ -111,8 +110,8 @@ void mips_mt_regdump(unsigned long mvpctl) | |||
111 | } | 110 | } |
112 | printk(" TCStatus : %08lx\n", tcstatval); | 111 | printk(" TCStatus : %08lx\n", tcstatval); |
113 | printk(" TCBind : %08lx\n", read_tc_c0_tcbind()); | 112 | printk(" TCBind : %08lx\n", read_tc_c0_tcbind()); |
114 | printk(" TCRestart : %08lx ", read_tc_c0_tcrestart()); | 113 | printk(" TCRestart : %08lx %pS\n", |
115 | print_symbol("%s\n", read_tc_c0_tcrestart()); | 114 | read_tc_c0_tcrestart(), (void *) read_tc_c0_tcrestart()); |
116 | printk(" TCHalt : %08lx\n", haltval); | 115 | printk(" TCHalt : %08lx\n", haltval); |
117 | printk(" TCContext : %08lx\n", read_tc_c0_tccontext()); | 116 | printk(" TCContext : %08lx\n", read_tc_c0_tccontext()); |
118 | if (!haltval) | 117 | if (!haltval) |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 2c09a442e5e5..c06f5b5d764c 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -125,13 +125,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | |||
125 | *childregs = *regs; | 125 | *childregs = *regs; |
126 | childregs->regs[7] = 0; /* Clear error flag */ | 126 | childregs->regs[7] = 0; /* Clear error flag */ |
127 | 127 | ||
128 | #if defined(CONFIG_BINFMT_IRIX) | ||
129 | if (current->personality != PER_LINUX) { | ||
130 | /* Under IRIX things are a little different. */ | ||
131 | childregs->regs[3] = 1; | ||
132 | regs->regs[3] = 0; | ||
133 | } | ||
134 | #endif | ||
135 | childregs->regs[2] = 0; /* Child gets zero as return value */ | 128 | childregs->regs[2] = 0; /* Child gets zero as return value */ |
136 | regs->regs[2] = p->pid; | 129 | regs->regs[2] = p->pid; |
137 | 130 | ||
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 08a9c5070ea8..c058c0b61a2a 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -34,12 +34,8 @@ NESTED(handle_sys, PT_SIZE, sp) | |||
34 | 34 | ||
35 | lw t1, PT_EPC(sp) # skip syscall on return | 35 | lw t1, PT_EPC(sp) # skip syscall on return |
36 | 36 | ||
37 | #if defined(CONFIG_BINFMT_IRIX) | ||
38 | sltiu t0, v0, MAX_SYSCALL_NO + 1 # check syscall number | ||
39 | #else | ||
40 | subu v0, v0, __NR_O32_Linux # check syscall number | 37 | subu v0, v0, __NR_O32_Linux # check syscall number |
41 | sltiu t0, v0, __NR_O32_Linux_syscalls + 1 | 38 | sltiu t0, v0, __NR_O32_Linux_syscalls + 1 |
42 | #endif | ||
43 | addiu t1, 4 # skip to next instruction | 39 | addiu t1, 4 # skip to next instruction |
44 | sw t1, PT_EPC(sp) | 40 | sw t1, PT_EPC(sp) |
45 | beqz t0, illegal_syscall | 41 | beqz t0, illegal_syscall |
@@ -264,22 +260,14 @@ bad_alignment: | |||
264 | END(sys_sysmips) | 260 | END(sys_sysmips) |
265 | 261 | ||
266 | LEAF(sys_syscall) | 262 | LEAF(sys_syscall) |
267 | #if defined(CONFIG_BINFMT_IRIX) | ||
268 | sltiu v0, a0, MAX_SYSCALL_NO + 1 # check syscall number | ||
269 | #else | ||
270 | subu t0, a0, __NR_O32_Linux # check syscall number | 263 | subu t0, a0, __NR_O32_Linux # check syscall number |
271 | sltiu v0, t0, __NR_O32_Linux_syscalls + 1 | 264 | sltiu v0, t0, __NR_O32_Linux_syscalls + 1 |
272 | #endif | ||
273 | sll t1, t0, 3 | 265 | sll t1, t0, 3 |
274 | beqz v0, einval | 266 | beqz v0, einval |
275 | 267 | ||
276 | lw t2, sys_call_table(t1) # syscall routine | 268 | lw t2, sys_call_table(t1) # syscall routine |
277 | 269 | ||
278 | #if defined(CONFIG_BINFMT_IRIX) | ||
279 | li v1, 4000 # nr of sys_syscall | ||
280 | #else | ||
281 | li v1, 4000 - __NR_O32_Linux # index of sys_syscall | 270 | li v1, 4000 - __NR_O32_Linux # index of sys_syscall |
282 | #endif | ||
283 | beq t0, v1, einval # do not recurse | 271 | beq t0, v1, einval # do not recurse |
284 | 272 | ||
285 | /* Some syscalls like execve get their arguments from struct pt_regs | 273 | /* Some syscalls like execve get their arguments from struct pt_regs |
@@ -324,13 +312,6 @@ einval: li v0, -EINVAL | |||
324 | .endm | 312 | .endm |
325 | 313 | ||
326 | .macro syscalltable | 314 | .macro syscalltable |
327 | #if defined(CONFIG_BINFMT_IRIX) | ||
328 | mille sys_ni_syscall 0 /* 0 - 999 SVR4 flavour */ | ||
329 | mille sys_ni_syscall 0 /* 1000 - 1999 32-bit IRIX */ | ||
330 | mille sys_ni_syscall 0 /* 2000 - 2999 BSD43 flavour */ | ||
331 | mille sys_ni_syscall 0 /* 3000 - 3999 POSIX flavour */ | ||
332 | #endif | ||
333 | |||
334 | sys sys_syscall 8 /* 4000 */ | 315 | sys sys_syscall 8 /* 4000 */ |
335 | sys sys_exit 1 | 316 | sys sys_exit 1 |
336 | sys sys_fork 0 | 317 | sys sys_fork 0 |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index c6a063b2a0d9..8af84867e74d 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -68,13 +68,6 @@ static char command_line[CL_SIZE]; | |||
68 | const unsigned long mips_io_port_base __read_mostly = -1; | 68 | const unsigned long mips_io_port_base __read_mostly = -1; |
69 | EXPORT_SYMBOL(mips_io_port_base); | 69 | EXPORT_SYMBOL(mips_io_port_base); |
70 | 70 | ||
71 | /* | ||
72 | * isa_slot_offset is the address where E(ISA) busaddress 0 is mapped | ||
73 | * for the processor. | ||
74 | */ | ||
75 | unsigned long isa_slot_offset; | ||
76 | EXPORT_SYMBOL(isa_slot_offset); | ||
77 | |||
78 | static struct resource code_resource = { .name = "Kernel code", }; | 71 | static struct resource code_resource = { .name = "Kernel code", }; |
79 | static struct resource data_resource = { .name = "Kernel data", }; | 72 | static struct resource data_resource = { .name = "Kernel data", }; |
80 | 73 | ||
@@ -557,11 +550,7 @@ void __init setup_arch(char **cmdline_p) | |||
557 | prom_init(); | 550 | prom_init(); |
558 | 551 | ||
559 | #ifdef CONFIG_EARLY_PRINTK | 552 | #ifdef CONFIG_EARLY_PRINTK |
560 | { | 553 | setup_early_printk(); |
561 | extern void setup_early_printk(void); | ||
562 | |||
563 | setup_early_printk(); | ||
564 | } | ||
565 | #endif | 554 | #endif |
566 | cpu_report(); | 555 | cpu_report(); |
567 | check_bugs_early(); | 556 | check_bugs_early(); |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c deleted file mode 100644 index c357762b8012..000000000000 --- a/arch/mips/kernel/sysirix.c +++ /dev/null | |||
@@ -1,2140 +0,0 @@ | |||
1 | /* | ||
2 | * sysirix.c: IRIX system call emulation. | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller | ||
5 | * Copyright (C) 1997 Miguel de Icaza | ||
6 | * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/sched.h> | ||
10 | #include <linux/binfmts.h> | ||
11 | #include <linux/capability.h> | ||
12 | #include <linux/highuid.h> | ||
13 | #include <linux/pagemap.h> | ||
14 | #include <linux/mm.h> | ||
15 | #include <linux/mman.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/swap.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/time.h> | ||
20 | #include <linux/timex.h> | ||
21 | #include <linux/times.h> | ||
22 | #include <linux/elf.h> | ||
23 | #include <linux/msg.h> | ||
24 | #include <linux/shm.h> | ||
25 | #include <linux/smp.h> | ||
26 | #include <linux/smp_lock.h> | ||
27 | #include <linux/utsname.h> | ||
28 | #include <linux/file.h> | ||
29 | #include <linux/vfs.h> | ||
30 | #include <linux/namei.h> | ||
31 | #include <linux/socket.h> | ||
32 | #include <linux/security.h> | ||
33 | #include <linux/syscalls.h> | ||
34 | #include <linux/resource.h> | ||
35 | |||
36 | #include <asm/ptrace.h> | ||
37 | #include <asm/page.h> | ||
38 | #include <asm/uaccess.h> | ||
39 | #include <asm/inventory.h> | ||
40 | |||
41 | /* 2,191 lines of complete and utter shit coming up... */ | ||
42 | |||
43 | extern int max_threads; | ||
44 | |||
45 | /* The sysmp commands supported thus far. */ | ||
46 | #define MP_NPROCS 1 /* # processor in complex */ | ||
47 | #define MP_NAPROCS 2 /* # active processors in complex */ | ||
48 | #define MP_PGSIZE 14 /* Return system page size in v1. */ | ||
49 | |||
50 | asmlinkage int irix_sysmp(struct pt_regs *regs) | ||
51 | { | ||
52 | unsigned long cmd; | ||
53 | int base = 0; | ||
54 | int error = 0; | ||
55 | |||
56 | if(regs->regs[2] == 1000) | ||
57 | base = 1; | ||
58 | cmd = regs->regs[base + 4]; | ||
59 | switch(cmd) { | ||
60 | case MP_PGSIZE: | ||
61 | error = PAGE_SIZE; | ||
62 | break; | ||
63 | case MP_NPROCS: | ||
64 | case MP_NAPROCS: | ||
65 | error = num_online_cpus(); | ||
66 | break; | ||
67 | default: | ||
68 | printk("SYSMP[%s:%d]: Unsupported opcode %d\n", | ||
69 | current->comm, current->pid, (int)cmd); | ||
70 | error = -EINVAL; | ||
71 | break; | ||
72 | } | ||
73 | |||
74 | return error; | ||
75 | } | ||
76 | |||
77 | /* The prctl commands. */ | ||
78 | #define PR_MAXPROCS 1 /* Tasks/user. */ | ||
79 | #define PR_ISBLOCKED 2 /* If blocked, return 1. */ | ||
80 | #define PR_SETSTACKSIZE 3 /* Set largest task stack size. */ | ||
81 | #define PR_GETSTACKSIZE 4 /* Get largest task stack size. */ | ||
82 | #define PR_MAXPPROCS 5 /* Num parallel tasks. */ | ||
83 | #define PR_UNBLKONEXEC 6 /* When task exec/exit's, unblock. */ | ||
84 | #define PR_SETEXITSIG 8 /* When task exit's, set signal. */ | ||
85 | #define PR_RESIDENT 9 /* Make task unswappable. */ | ||
86 | #define PR_ATTACHADDR 10 /* (Re-)Connect a vma to a task. */ | ||
87 | #define PR_DETACHADDR 11 /* Disconnect a vma from a task. */ | ||
88 | #define PR_TERMCHILD 12 /* Kill child if the parent dies. */ | ||
89 | #define PR_GETSHMASK 13 /* Get the sproc() share mask. */ | ||
90 | #define PR_GETNSHARE 14 /* Number of share group members. */ | ||
91 | #define PR_COREPID 15 /* Add task pid to name when it core. */ | ||
92 | #define PR_ATTACHADDRPERM 16 /* (Re-)Connect vma, with specified prot. */ | ||
93 | #define PR_PTHREADEXIT 17 /* Kill a pthread, only for IRIX 6.[234] */ | ||
94 | |||
95 | asmlinkage int irix_prctl(unsigned option, ...) | ||
96 | { | ||
97 | va_list args; | ||
98 | int error = 0; | ||
99 | |||
100 | va_start(args, option); | ||
101 | switch (option) { | ||
102 | case PR_MAXPROCS: | ||
103 | printk("irix_prctl[%s:%d]: Wants PR_MAXPROCS\n", | ||
104 | current->comm, current->pid); | ||
105 | error = max_threads; | ||
106 | break; | ||
107 | |||
108 | case PR_ISBLOCKED: { | ||
109 | struct task_struct *task; | ||
110 | |||
111 | printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n", | ||
112 | current->comm, current->pid); | ||
113 | read_lock(&tasklist_lock); | ||
114 | task = find_task_by_vpid(va_arg(args, pid_t)); | ||
115 | error = -ESRCH; | ||
116 | if (error) | ||
117 | error = (task->run_list.next != NULL); | ||
118 | read_unlock(&tasklist_lock); | ||
119 | /* Can _your_ OS find this out that fast? */ | ||
120 | break; | ||
121 | } | ||
122 | |||
123 | case PR_SETSTACKSIZE: { | ||
124 | long value = va_arg(args, long); | ||
125 | |||
126 | printk("irix_prctl[%s:%d]: Wants PR_SETSTACKSIZE<%08lx>\n", | ||
127 | current->comm, current->pid, (unsigned long) value); | ||
128 | if (value > RLIM_INFINITY) | ||
129 | value = RLIM_INFINITY; | ||
130 | if (capable(CAP_SYS_ADMIN)) { | ||
131 | task_lock(current->group_leader); | ||
132 | current->signal->rlim[RLIMIT_STACK].rlim_max = | ||
133 | current->signal->rlim[RLIMIT_STACK].rlim_cur = value; | ||
134 | task_unlock(current->group_leader); | ||
135 | error = value; | ||
136 | break; | ||
137 | } | ||
138 | task_lock(current->group_leader); | ||
139 | if (value > current->signal->rlim[RLIMIT_STACK].rlim_max) { | ||
140 | error = -EINVAL; | ||
141 | task_unlock(current->group_leader); | ||
142 | break; | ||
143 | } | ||
144 | current->signal->rlim[RLIMIT_STACK].rlim_cur = value; | ||
145 | task_unlock(current->group_leader); | ||
146 | error = value; | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | case PR_GETSTACKSIZE: | ||
151 | printk("irix_prctl[%s:%d]: Wants PR_GETSTACKSIZE\n", | ||
152 | current->comm, current->pid); | ||
153 | error = current->signal->rlim[RLIMIT_STACK].rlim_cur; | ||
154 | break; | ||
155 | |||
156 | case PR_MAXPPROCS: | ||
157 | printk("irix_prctl[%s:%d]: Wants PR_MAXPROCS\n", | ||
158 | current->comm, current->pid); | ||
159 | error = 1; | ||
160 | break; | ||
161 | |||
162 | case PR_UNBLKONEXEC: | ||
163 | printk("irix_prctl[%s:%d]: Wants PR_UNBLKONEXEC\n", | ||
164 | current->comm, current->pid); | ||
165 | error = -EINVAL; | ||
166 | break; | ||
167 | |||
168 | case PR_SETEXITSIG: | ||
169 | printk("irix_prctl[%s:%d]: Wants PR_SETEXITSIG\n", | ||
170 | current->comm, current->pid); | ||
171 | |||
172 | /* We can probably play some game where we set the task | ||
173 | * exit_code to some non-zero value when this is requested, | ||
174 | * and check whether exit_code is already set in do_exit(). | ||
175 | */ | ||
176 | error = -EINVAL; | ||
177 | break; | ||
178 | |||
179 | case PR_RESIDENT: | ||
180 | printk("irix_prctl[%s:%d]: Wants PR_RESIDENT\n", | ||
181 | current->comm, current->pid); | ||
182 | error = 0; /* Compatibility indeed. */ | ||
183 | break; | ||
184 | |||
185 | case PR_ATTACHADDR: | ||
186 | printk("irix_prctl[%s:%d]: Wants PR_ATTACHADDR\n", | ||
187 | current->comm, current->pid); | ||
188 | error = -EINVAL; | ||
189 | break; | ||
190 | |||
191 | case PR_DETACHADDR: | ||
192 | printk("irix_prctl[%s:%d]: Wants PR_DETACHADDR\n", | ||
193 | current->comm, current->pid); | ||
194 | error = -EINVAL; | ||
195 | break; | ||
196 | |||
197 | case PR_TERMCHILD: | ||
198 | printk("irix_prctl[%s:%d]: Wants PR_TERMCHILD\n", | ||
199 | current->comm, current->pid); | ||
200 | error = -EINVAL; | ||
201 | break; | ||
202 | |||
203 | case PR_GETSHMASK: | ||
204 | printk("irix_prctl[%s:%d]: Wants PR_GETSHMASK\n", | ||
205 | current->comm, current->pid); | ||
206 | error = -EINVAL; /* Until I have the sproc() stuff in. */ | ||
207 | break; | ||
208 | |||
209 | case PR_GETNSHARE: | ||
210 | error = 0; /* Until I have the sproc() stuff in. */ | ||
211 | break; | ||
212 | |||
213 | case PR_COREPID: | ||
214 | printk("irix_prctl[%s:%d]: Wants PR_COREPID\n", | ||
215 | current->comm, current->pid); | ||
216 | error = -EINVAL; | ||
217 | break; | ||
218 | |||
219 | case PR_ATTACHADDRPERM: | ||
220 | printk("irix_prctl[%s:%d]: Wants PR_ATTACHADDRPERM\n", | ||
221 | current->comm, current->pid); | ||
222 | error = -EINVAL; | ||
223 | break; | ||
224 | |||
225 | default: | ||
226 | printk("irix_prctl[%s:%d]: Non-existant opcode %d\n", | ||
227 | current->comm, current->pid, option); | ||
228 | error = -EINVAL; | ||
229 | break; | ||
230 | } | ||
231 | va_end(args); | ||
232 | |||
233 | return error; | ||
234 | } | ||
235 | |||
236 | #undef DEBUG_PROCGRPS | ||
237 | |||
238 | extern unsigned long irix_mapelf(int fd, struct elf_phdr __user *user_phdrp, int cnt); | ||
239 | extern char *prom_getenv(char *name); | ||
240 | extern long prom_setenv(char *name, char *value); | ||
241 | |||
242 | /* The syssgi commands supported thus far. */ | ||
243 | #define SGI_SYSID 1 /* Return unique per-machine identifier. */ | ||
244 | #define SGI_INVENT 5 /* Fetch inventory */ | ||
245 | # define SGI_INV_SIZEOF 1 | ||
246 | # define SGI_INV_READ 2 | ||
247 | #define SGI_RDNAME 6 /* Return string name of a process. */ | ||
248 | #define SGI_SETNVRAM 8 /* Set PROM variable. */ | ||
249 | #define SGI_GETNVRAM 9 /* Get PROM variable. */ | ||
250 | #define SGI_SETPGID 21 /* Set process group id. */ | ||
251 | #define SGI_SYSCONF 22 /* POSIX sysconf garbage. */ | ||
252 | #define SGI_PATHCONF 24 /* POSIX sysconf garbage. */ | ||
253 | #define SGI_SETGROUPS 40 /* POSIX sysconf garbage. */ | ||
254 | #define SGI_GETGROUPS 41 /* POSIX sysconf garbage. */ | ||
255 | #define SGI_RUSAGE 56 /* BSD style rusage(). */ | ||
256 | #define SGI_SSYNC 62 /* Synchronous fs sync. */ | ||
257 | #define SGI_GETSID 65 /* SysVr4 get session id. */ | ||
258 | #define SGI_ELFMAP 68 /* Map an elf image. */ | ||
259 | #define SGI_TOSSTSAVE 108 /* Toss saved vma's. */ | ||
260 | #define SGI_FP_BCOPY 129 /* Should FPU bcopy be used on this machine? */ | ||
261 | #define SGI_PHYSP 1011 /* Translate virtual into physical page. */ | ||
262 | |||
263 | asmlinkage int irix_syssgi(struct pt_regs *regs) | ||
264 | { | ||
265 | unsigned long cmd; | ||
266 | int retval, base = 0; | ||
267 | |||
268 | if (regs->regs[2] == 1000) | ||
269 | base = 1; | ||
270 | |||
271 | cmd = regs->regs[base + 4]; | ||
272 | switch(cmd) { | ||
273 | case SGI_SYSID: { | ||
274 | char __user *buf = (char __user *) regs->regs[base + 5]; | ||
275 | |||
276 | /* XXX Use ethernet addr.... */ | ||
277 | retval = clear_user(buf, 64) ? -EFAULT : 0; | ||
278 | break; | ||
279 | } | ||
280 | #if 0 | ||
281 | case SGI_RDNAME: { | ||
282 | int pid = (int) regs->regs[base + 5]; | ||
283 | char __user *buf = (char __user *) regs->regs[base + 6]; | ||
284 | struct task_struct *p; | ||
285 | char tcomm[sizeof(current->comm)]; | ||
286 | |||
287 | read_lock(&tasklist_lock); | ||
288 | p = find_task_by_pid(pid); | ||
289 | if (!p) { | ||
290 | read_unlock(&tasklist_lock); | ||
291 | retval = -ESRCH; | ||
292 | break; | ||
293 | } | ||
294 | get_task_comm(tcomm, p); | ||
295 | read_unlock(&tasklist_lock); | ||
296 | |||
297 | /* XXX Need to check sizes. */ | ||
298 | retval = copy_to_user(buf, tcomm, sizeof(tcomm)) ? -EFAULT : 0; | ||
299 | break; | ||
300 | } | ||
301 | |||
302 | case SGI_GETNVRAM: { | ||
303 | char __user *name = (char __user *) regs->regs[base+5]; | ||
304 | char __user *buf = (char __user *) regs->regs[base+6]; | ||
305 | char *value; | ||
306 | return -EINVAL; /* til I fix it */ | ||
307 | value = prom_getenv(name); /* PROM lock? */ | ||
308 | if (!value) { | ||
309 | retval = -EINVAL; | ||
310 | break; | ||
311 | } | ||
312 | /* Do I strlen() for the length? */ | ||
313 | retval = copy_to_user(buf, value, 128) ? -EFAULT : 0; | ||
314 | break; | ||
315 | } | ||
316 | |||
317 | case SGI_SETNVRAM: { | ||
318 | char __user *name = (char __user *) regs->regs[base+5]; | ||
319 | char __user *value = (char __user *) regs->regs[base+6]; | ||
320 | return -EINVAL; /* til I fix it */ | ||
321 | retval = prom_setenv(name, value); | ||
322 | /* XXX make sure retval conforms to syssgi(2) */ | ||
323 | printk("[%s:%d] setnvram(\"%s\", \"%s\"): retval %d", | ||
324 | current->comm, current->pid, name, value, retval); | ||
325 | /* if (retval == PROM_ENOENT) | ||
326 | retval = -ENOENT; */ | ||
327 | break; | ||
328 | } | ||
329 | #endif | ||
330 | |||
331 | case SGI_SETPGID: { | ||
332 | #ifdef DEBUG_PROCGRPS | ||
333 | printk("[%s:%d] setpgid(%d, %d) ", | ||
334 | current->comm, current->pid, | ||
335 | (int) regs->regs[base + 5], (int)regs->regs[base + 6]); | ||
336 | #endif | ||
337 | retval = sys_setpgid(regs->regs[base + 5], regs->regs[base + 6]); | ||
338 | |||
339 | #ifdef DEBUG_PROCGRPS | ||
340 | printk("retval=%d\n", retval); | ||
341 | #endif | ||
342 | } | ||
343 | |||
344 | case SGI_SYSCONF: { | ||
345 | switch(regs->regs[base + 5]) { | ||
346 | case 1: | ||
347 | retval = (MAX_ARG_PAGES >> 4); /* XXX estimate... */ | ||
348 | goto out; | ||
349 | case 2: | ||
350 | retval = max_threads; | ||
351 | goto out; | ||
352 | case 3: | ||
353 | retval = HZ; | ||
354 | goto out; | ||
355 | case 4: | ||
356 | retval = NGROUPS_MAX; | ||
357 | goto out; | ||
358 | case 5: | ||
359 | retval = sysctl_nr_open; | ||
360 | goto out; | ||
361 | case 6: | ||
362 | retval = 1; | ||
363 | goto out; | ||
364 | case 7: | ||
365 | retval = 1; | ||
366 | goto out; | ||
367 | case 8: | ||
368 | retval = 199009; | ||
369 | goto out; | ||
370 | case 11: | ||
371 | retval = PAGE_SIZE; | ||
372 | goto out; | ||
373 | case 12: | ||
374 | retval = 4; | ||
375 | goto out; | ||
376 | case 25: | ||
377 | case 26: | ||
378 | case 27: | ||
379 | case 28: | ||
380 | case 29: | ||
381 | case 30: | ||
382 | retval = 0; | ||
383 | goto out; | ||
384 | case 31: | ||
385 | retval = 32; | ||
386 | goto out; | ||
387 | default: | ||
388 | retval = -EINVAL; | ||
389 | goto out; | ||
390 | }; | ||
391 | } | ||
392 | |||
393 | case SGI_SETGROUPS: | ||
394 | retval = sys_setgroups((int) regs->regs[base + 5], | ||
395 | (gid_t __user *) regs->regs[base + 6]); | ||
396 | break; | ||
397 | |||
398 | case SGI_GETGROUPS: | ||
399 | retval = sys_getgroups((int) regs->regs[base + 5], | ||
400 | (gid_t __user *) regs->regs[base + 6]); | ||
401 | break; | ||
402 | |||
403 | case SGI_RUSAGE: { | ||
404 | struct rusage __user *ru = (struct rusage __user *) regs->regs[base + 6]; | ||
405 | |||
406 | switch((int) regs->regs[base + 5]) { | ||
407 | case 0: | ||
408 | /* rusage self */ | ||
409 | retval = getrusage(current, RUSAGE_SELF, ru); | ||
410 | goto out; | ||
411 | |||
412 | case -1: | ||
413 | /* rusage children */ | ||
414 | retval = getrusage(current, RUSAGE_CHILDREN, ru); | ||
415 | goto out; | ||
416 | |||
417 | default: | ||
418 | retval = -EINVAL; | ||
419 | goto out; | ||
420 | }; | ||
421 | } | ||
422 | |||
423 | case SGI_SSYNC: | ||
424 | sys_sync(); | ||
425 | retval = 0; | ||
426 | break; | ||
427 | |||
428 | case SGI_GETSID: | ||
429 | #ifdef DEBUG_PROCGRPS | ||
430 | printk("[%s:%d] getsid(%d) ", current->comm, current->pid, | ||
431 | (int) regs->regs[base + 5]); | ||
432 | #endif | ||
433 | retval = sys_getsid(regs->regs[base + 5]); | ||
434 | #ifdef DEBUG_PROCGRPS | ||
435 | printk("retval=%d\n", retval); | ||
436 | #endif | ||
437 | break; | ||
438 | |||
439 | case SGI_ELFMAP: | ||
440 | retval = irix_mapelf((int) regs->regs[base + 5], | ||
441 | (struct elf_phdr __user *) regs->regs[base + 6], | ||
442 | (int) regs->regs[base + 7]); | ||
443 | break; | ||
444 | |||
445 | case SGI_TOSSTSAVE: | ||
446 | /* XXX We don't need to do anything? */ | ||
447 | retval = 0; | ||
448 | break; | ||
449 | |||
450 | case SGI_FP_BCOPY: | ||
451 | retval = 0; | ||
452 | break; | ||
453 | |||
454 | case SGI_PHYSP: { | ||
455 | unsigned long addr = regs->regs[base + 5]; | ||
456 | int __user *pageno = (int __user *) (regs->regs[base + 6]); | ||
457 | struct mm_struct *mm = current->mm; | ||
458 | pgd_t *pgdp; | ||
459 | pud_t *pudp; | ||
460 | pmd_t *pmdp; | ||
461 | pte_t *ptep; | ||
462 | |||
463 | down_read(&mm->mmap_sem); | ||
464 | pgdp = pgd_offset(mm, addr); | ||
465 | pudp = pud_offset(pgdp, addr); | ||
466 | pmdp = pmd_offset(pudp, addr); | ||
467 | ptep = pte_offset(pmdp, addr); | ||
468 | retval = -EINVAL; | ||
469 | if (ptep) { | ||
470 | pte_t pte = *ptep; | ||
471 | |||
472 | if (pte_val(pte) & (_PAGE_VALID | _PAGE_PRESENT)) { | ||
473 | /* b0rked on 64-bit */ | ||
474 | retval = put_user((pte_val(pte) & PAGE_MASK) >> | ||
475 | PAGE_SHIFT, pageno); | ||
476 | } | ||
477 | } | ||
478 | up_read(&mm->mmap_sem); | ||
479 | break; | ||
480 | } | ||
481 | |||
482 | case SGI_INVENT: { | ||
483 | int arg1 = (int) regs->regs [base + 5]; | ||
484 | void __user *buffer = (void __user *) regs->regs [base + 6]; | ||
485 | int count = (int) regs->regs [base + 7]; | ||
486 | |||
487 | switch (arg1) { | ||
488 | case SGI_INV_SIZEOF: | ||
489 | retval = sizeof(inventory_t); | ||
490 | break; | ||
491 | case SGI_INV_READ: | ||
492 | retval = dump_inventory_to_user(buffer, count); | ||
493 | break; | ||
494 | default: | ||
495 | retval = -EINVAL; | ||
496 | } | ||
497 | break; | ||
498 | } | ||
499 | |||
500 | default: | ||
501 | printk("irix_syssgi: Unsupported command %d\n", (int)cmd); | ||
502 | retval = -EINVAL; | ||
503 | break; | ||
504 | }; | ||
505 | |||
506 | out: | ||
507 | return retval; | ||
508 | } | ||
509 | |||
510 | asmlinkage int irix_gtime(struct pt_regs *regs) | ||
511 | { | ||
512 | return get_seconds(); | ||
513 | } | ||
514 | |||
515 | /* | ||
516 | * IRIX is completely broken... it returns 0 on success, otherwise | ||
517 | * ENOMEM. | ||
518 | */ | ||
519 | asmlinkage int irix_brk(unsigned long brk) | ||
520 | { | ||
521 | unsigned long rlim; | ||
522 | unsigned long newbrk, oldbrk; | ||
523 | struct mm_struct *mm = current->mm; | ||
524 | int ret; | ||
525 | |||
526 | down_write(&mm->mmap_sem); | ||
527 | if (brk < mm->end_code) { | ||
528 | ret = -ENOMEM; | ||
529 | goto out; | ||
530 | } | ||
531 | |||
532 | newbrk = PAGE_ALIGN(brk); | ||
533 | oldbrk = PAGE_ALIGN(mm->brk); | ||
534 | if (oldbrk == newbrk) { | ||
535 | mm->brk = brk; | ||
536 | ret = 0; | ||
537 | goto out; | ||
538 | } | ||
539 | |||
540 | /* | ||
541 | * Always allow shrinking brk | ||
542 | */ | ||
543 | if (brk <= mm->brk) { | ||
544 | mm->brk = brk; | ||
545 | do_munmap(mm, newbrk, oldbrk-newbrk); | ||
546 | ret = 0; | ||
547 | goto out; | ||
548 | } | ||
549 | /* | ||
550 | * Check against rlimit and stack.. | ||
551 | */ | ||
552 | rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; | ||
553 | if (rlim >= RLIM_INFINITY) | ||
554 | rlim = ~0; | ||
555 | if (brk - mm->end_code > rlim) { | ||
556 | ret = -ENOMEM; | ||
557 | goto out; | ||
558 | } | ||
559 | |||
560 | /* | ||
561 | * Check against existing mmap mappings. | ||
562 | */ | ||
563 | if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) { | ||
564 | ret = -ENOMEM; | ||
565 | goto out; | ||
566 | } | ||
567 | |||
568 | /* | ||
569 | * Ok, looks good - let it rip. | ||
570 | */ | ||
571 | if (do_brk(oldbrk, newbrk-oldbrk) != oldbrk) { | ||
572 | ret = -ENOMEM; | ||
573 | goto out; | ||
574 | } | ||
575 | mm->brk = brk; | ||
576 | ret = 0; | ||
577 | |||
578 | out: | ||
579 | up_write(&mm->mmap_sem); | ||
580 | return ret; | ||
581 | } | ||
582 | |||
583 | asmlinkage int irix_getpid(struct pt_regs *regs) | ||
584 | { | ||
585 | regs->regs[3] = task_pid_vnr(current->real_parent); | ||
586 | return task_pid_vnr(current); | ||
587 | } | ||
588 | |||
589 | asmlinkage int irix_getuid(struct pt_regs *regs) | ||
590 | { | ||
591 | regs->regs[3] = current->euid; | ||
592 | return current->uid; | ||
593 | } | ||
594 | |||
595 | asmlinkage int irix_getgid(struct pt_regs *regs) | ||
596 | { | ||
597 | regs->regs[3] = current->egid; | ||
598 | return current->gid; | ||
599 | } | ||
600 | |||
601 | asmlinkage int irix_stime(int value) | ||
602 | { | ||
603 | int err; | ||
604 | struct timespec tv; | ||
605 | |||
606 | tv.tv_sec = value; | ||
607 | tv.tv_nsec = 0; | ||
608 | err = security_settime(&tv, NULL); | ||
609 | if (err) | ||
610 | return err; | ||
611 | |||
612 | write_seqlock_irq(&xtime_lock); | ||
613 | xtime.tv_sec = value; | ||
614 | xtime.tv_nsec = 0; | ||
615 | ntp_clear(); | ||
616 | write_sequnlock_irq(&xtime_lock); | ||
617 | |||
618 | return 0; | ||
619 | } | ||
620 | |||
621 | static inline void jiffiestotv(unsigned long jiffies, struct timeval *value) | ||
622 | { | ||
623 | value->tv_usec = (jiffies % HZ) * (1000000 / HZ); | ||
624 | value->tv_sec = jiffies / HZ; | ||
625 | } | ||
626 | |||
627 | static inline void getitimer_real(struct itimerval *value) | ||
628 | { | ||
629 | register unsigned long val, interval; | ||
630 | |||
631 | interval = current->it_real_incr; | ||
632 | val = 0; | ||
633 | if (del_timer(¤t->real_timer)) { | ||
634 | unsigned long now = jiffies; | ||
635 | val = current->real_timer.expires; | ||
636 | add_timer(¤t->real_timer); | ||
637 | /* look out for negative/zero itimer.. */ | ||
638 | if (val <= now) | ||
639 | val = now+1; | ||
640 | val -= now; | ||
641 | } | ||
642 | jiffiestotv(val, &value->it_value); | ||
643 | jiffiestotv(interval, &value->it_interval); | ||
644 | } | ||
645 | |||
646 | asmlinkage unsigned int irix_alarm(unsigned int seconds) | ||
647 | { | ||
648 | return alarm_setitimer(seconds); | ||
649 | } | ||
650 | |||
651 | asmlinkage int irix_pause(void) | ||
652 | { | ||
653 | current->state = TASK_INTERRUPTIBLE; | ||
654 | schedule(); | ||
655 | |||
656 | return -EINTR; | ||
657 | } | ||
658 | |||
659 | /* XXX need more than this... */ | ||
660 | asmlinkage int irix_mount(char __user *dev_name, char __user *dir_name, | ||
661 | unsigned long flags, char __user *type, void __user *data, int datalen) | ||
662 | { | ||
663 | printk("[%s:%d] irix_mount(%p,%p,%08lx,%p,%p,%d)\n", | ||
664 | current->comm, current->pid, | ||
665 | dev_name, dir_name, flags, type, data, datalen); | ||
666 | |||
667 | return sys_mount(dev_name, dir_name, type, flags, data); | ||
668 | } | ||
669 | |||
670 | struct irix_statfs { | ||
671 | short f_type; | ||
672 | long f_bsize, f_frsize, f_blocks, f_bfree, f_files, f_ffree; | ||
673 | char f_fname[6], f_fpack[6]; | ||
674 | }; | ||
675 | |||
676 | asmlinkage int irix_statfs(const char __user *path, | ||
677 | struct irix_statfs __user *buf, int len, int fs_type) | ||
678 | { | ||
679 | struct nameidata nd; | ||
680 | struct kstatfs kbuf; | ||
681 | int error, i; | ||
682 | |||
683 | /* We don't support this feature yet. */ | ||
684 | if (fs_type) { | ||
685 | error = -EINVAL; | ||
686 | goto out; | ||
687 | } | ||
688 | if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statfs))) { | ||
689 | error = -EFAULT; | ||
690 | goto out; | ||
691 | } | ||
692 | |||
693 | error = user_path_walk(path, &nd); | ||
694 | if (error) | ||
695 | goto out; | ||
696 | |||
697 | error = vfs_statfs(nd.path.dentry, &kbuf); | ||
698 | if (error) | ||
699 | goto dput_and_out; | ||
700 | |||
701 | error = __put_user(kbuf.f_type, &buf->f_type); | ||
702 | error |= __put_user(kbuf.f_bsize, &buf->f_bsize); | ||
703 | error |= __put_user(kbuf.f_frsize, &buf->f_frsize); | ||
704 | error |= __put_user(kbuf.f_blocks, &buf->f_blocks); | ||
705 | error |= __put_user(kbuf.f_bfree, &buf->f_bfree); | ||
706 | error |= __put_user(kbuf.f_files, &buf->f_files); | ||
707 | error |= __put_user(kbuf.f_ffree, &buf->f_ffree); | ||
708 | for (i = 0; i < 6; i++) { | ||
709 | error |= __put_user(0, &buf->f_fname[i]); | ||
710 | error |= __put_user(0, &buf->f_fpack[i]); | ||
711 | } | ||
712 | |||
713 | dput_and_out: | ||
714 | path_put(&nd.path); | ||
715 | out: | ||
716 | return error; | ||
717 | } | ||
718 | |||
719 | asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf) | ||
720 | { | ||
721 | struct kstatfs kbuf; | ||
722 | struct file *file; | ||
723 | int error, i; | ||
724 | |||
725 | if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statfs))) { | ||
726 | error = -EFAULT; | ||
727 | goto out; | ||
728 | } | ||
729 | |||
730 | if (!(file = fget(fd))) { | ||
731 | error = -EBADF; | ||
732 | goto out; | ||
733 | } | ||
734 | |||
735 | error = vfs_statfs(file->f_path.dentry, &kbuf); | ||
736 | if (error) | ||
737 | goto out_f; | ||
738 | |||
739 | error = __put_user(kbuf.f_type, &buf->f_type); | ||
740 | error |= __put_user(kbuf.f_bsize, &buf->f_bsize); | ||
741 | error |= __put_user(kbuf.f_frsize, &buf->f_frsize); | ||
742 | error |= __put_user(kbuf.f_blocks, &buf->f_blocks); | ||
743 | error |= __put_user(kbuf.f_bfree, &buf->f_bfree); | ||
744 | error |= __put_user(kbuf.f_files, &buf->f_files); | ||
745 | error |= __put_user(kbuf.f_ffree, &buf->f_ffree); | ||
746 | |||
747 | for (i = 0; i < 6; i++) { | ||
748 | error |= __put_user(0, &buf->f_fname[i]); | ||
749 | error |= __put_user(0, &buf->f_fpack[i]); | ||
750 | } | ||
751 | |||
752 | out_f: | ||
753 | fput(file); | ||
754 | out: | ||
755 | return error; | ||
756 | } | ||
757 | |||
758 | asmlinkage int irix_setpgrp(int flags) | ||
759 | { | ||
760 | int error; | ||
761 | |||
762 | #ifdef DEBUG_PROCGRPS | ||
763 | printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags); | ||
764 | #endif | ||
765 | if(!flags) | ||
766 | error = task_pgrp_vnr(current); | ||
767 | else | ||
768 | error = sys_setsid(); | ||
769 | #ifdef DEBUG_PROCGRPS | ||
770 | printk("returning %d\n", error); | ||
771 | #endif | ||
772 | |||
773 | return error; | ||
774 | } | ||
775 | |||
776 | asmlinkage int irix_times(struct tms __user *tbuf) | ||
777 | { | ||
778 | int err = 0; | ||
779 | |||
780 | if (tbuf) { | ||
781 | if (!access_ok(VERIFY_WRITE, tbuf, sizeof *tbuf)) | ||
782 | return -EFAULT; | ||
783 | |||
784 | err = __put_user(current->utime, &tbuf->tms_utime); | ||
785 | err |= __put_user(current->stime, &tbuf->tms_stime); | ||
786 | err |= __put_user(current->signal->cutime, &tbuf->tms_cutime); | ||
787 | err |= __put_user(current->signal->cstime, &tbuf->tms_cstime); | ||
788 | } | ||
789 | |||
790 | return err; | ||
791 | } | ||
792 | |||
793 | asmlinkage int irix_exec(struct pt_regs *regs) | ||
794 | { | ||
795 | int error, base = 0; | ||
796 | char *filename; | ||
797 | |||
798 | if(regs->regs[2] == 1000) | ||
799 | base = 1; | ||
800 | filename = getname((char __user *) (long)regs->regs[base + 4]); | ||
801 | error = PTR_ERR(filename); | ||
802 | if (IS_ERR(filename)) | ||
803 | return error; | ||
804 | |||
805 | error = do_execve(filename, (char __user * __user *) (long)regs->regs[base + 5], | ||
806 | NULL, regs); | ||
807 | putname(filename); | ||
808 | |||
809 | return error; | ||
810 | } | ||
811 | |||
812 | asmlinkage int irix_exece(struct pt_regs *regs) | ||
813 | { | ||
814 | int error, base = 0; | ||
815 | char *filename; | ||
816 | |||
817 | if (regs->regs[2] == 1000) | ||
818 | base = 1; | ||
819 | filename = getname((char __user *) (long)regs->regs[base + 4]); | ||
820 | error = PTR_ERR(filename); | ||
821 | if (IS_ERR(filename)) | ||
822 | return error; | ||
823 | error = do_execve(filename, (char __user * __user *) (long)regs->regs[base + 5], | ||
824 | (char __user * __user *) (long)regs->regs[base + 6], regs); | ||
825 | putname(filename); | ||
826 | |||
827 | return error; | ||
828 | } | ||
829 | |||
830 | asmlinkage unsigned long irix_gethostid(void) | ||
831 | { | ||
832 | printk("[%s:%d]: irix_gethostid() called...\n", | ||
833 | current->comm, current->pid); | ||
834 | |||
835 | return -EINVAL; | ||
836 | } | ||
837 | |||
838 | asmlinkage unsigned long irix_sethostid(unsigned long val) | ||
839 | { | ||
840 | printk("[%s:%d]: irix_sethostid(%08lx) called...\n", | ||
841 | current->comm, current->pid, val); | ||
842 | |||
843 | return -EINVAL; | ||
844 | } | ||
845 | |||
846 | asmlinkage int irix_socket(int family, int type, int protocol) | ||
847 | { | ||
848 | switch(type) { | ||
849 | case 1: | ||
850 | type = SOCK_DGRAM; | ||
851 | break; | ||
852 | |||
853 | case 2: | ||
854 | type = SOCK_STREAM; | ||
855 | break; | ||
856 | |||
857 | case 3: | ||
858 | type = 9; /* Invalid... */ | ||
859 | break; | ||
860 | |||
861 | case 4: | ||
862 | type = SOCK_RAW; | ||
863 | break; | ||
864 | |||
865 | case 5: | ||
866 | type = SOCK_RDM; | ||
867 | break; | ||
868 | |||
869 | case 6: | ||
870 | type = SOCK_SEQPACKET; | ||
871 | break; | ||
872 | |||
873 | default: | ||
874 | break; | ||
875 | } | ||
876 | |||
877 | return sys_socket(family, type, protocol); | ||
878 | } | ||
879 | |||
880 | asmlinkage int irix_getdomainname(char __user *name, int len) | ||
881 | { | ||
882 | int err; | ||
883 | |||
884 | down_read(&uts_sem); | ||
885 | if (len > __NEW_UTS_LEN) | ||
886 | len = __NEW_UTS_LEN; | ||
887 | err = copy_to_user(name, utsname()->domainname, len) ? -EFAULT : 0; | ||
888 | up_read(&uts_sem); | ||
889 | |||
890 | return err; | ||
891 | } | ||
892 | |||
893 | asmlinkage unsigned long irix_getpagesize(void) | ||
894 | { | ||
895 | return PAGE_SIZE; | ||
896 | } | ||
897 | |||
898 | asmlinkage int irix_msgsys(int opcode, unsigned long arg0, unsigned long arg1, | ||
899 | unsigned long arg2, unsigned long arg3, | ||
900 | unsigned long arg4) | ||
901 | { | ||
902 | switch (opcode) { | ||
903 | case 0: | ||
904 | return sys_msgget((key_t) arg0, (int) arg1); | ||
905 | case 1: | ||
906 | return sys_msgctl((int) arg0, (int) arg1, | ||
907 | (struct msqid_ds __user *)arg2); | ||
908 | case 2: | ||
909 | return sys_msgrcv((int) arg0, (struct msgbuf __user *) arg1, | ||
910 | (size_t) arg2, (long) arg3, (int) arg4); | ||
911 | case 3: | ||
912 | return sys_msgsnd((int) arg0, (struct msgbuf __user *) arg1, | ||
913 | (size_t) arg2, (int) arg3); | ||
914 | default: | ||
915 | return -EINVAL; | ||
916 | } | ||
917 | } | ||
918 | |||
919 | asmlinkage int irix_shmsys(int opcode, unsigned long arg0, unsigned long arg1, | ||
920 | unsigned long arg2, unsigned long arg3) | ||
921 | { | ||
922 | switch (opcode) { | ||
923 | case 0: | ||
924 | return do_shmat((int) arg0, (char __user *) arg1, (int) arg2, | ||
925 | (unsigned long *) arg3); | ||
926 | case 1: | ||
927 | return sys_shmctl((int)arg0, (int)arg1, | ||
928 | (struct shmid_ds __user *)arg2); | ||
929 | case 2: | ||
930 | return sys_shmdt((char __user *)arg0); | ||
931 | case 3: | ||
932 | return sys_shmget((key_t) arg0, (int) arg1, (int) arg2); | ||
933 | default: | ||
934 | return -EINVAL; | ||
935 | } | ||
936 | } | ||
937 | |||
938 | asmlinkage int irix_semsys(int opcode, unsigned long arg0, unsigned long arg1, | ||
939 | unsigned long arg2, int arg3) | ||
940 | { | ||
941 | switch (opcode) { | ||
942 | case 0: | ||
943 | return sys_semctl((int) arg0, (int) arg1, (int) arg2, | ||
944 | (union semun) arg3); | ||
945 | case 1: | ||
946 | return sys_semget((key_t) arg0, (int) arg1, (int) arg2); | ||
947 | case 2: | ||
948 | return sys_semop((int) arg0, (struct sembuf __user *)arg1, | ||
949 | (unsigned int) arg2); | ||
950 | default: | ||
951 | return -EINVAL; | ||
952 | } | ||
953 | } | ||
954 | |||
955 | static inline loff_t llseek(struct file *file, loff_t offset, int origin) | ||
956 | { | ||
957 | loff_t (*fn)(struct file *, loff_t, int); | ||
958 | loff_t retval; | ||
959 | |||
960 | fn = default_llseek; | ||
961 | if (file->f_op && file->f_op->llseek) | ||
962 | fn = file->f_op->llseek; | ||
963 | lock_kernel(); | ||
964 | retval = fn(file, offset, origin); | ||
965 | unlock_kernel(); | ||
966 | |||
967 | return retval; | ||
968 | } | ||
969 | |||
970 | asmlinkage int irix_lseek64(int fd, int _unused, int offhi, int offlow, | ||
971 | int origin) | ||
972 | { | ||
973 | struct file * file; | ||
974 | loff_t offset; | ||
975 | int retval; | ||
976 | |||
977 | retval = -EBADF; | ||
978 | file = fget(fd); | ||
979 | if (!file) | ||
980 | goto bad; | ||
981 | retval = -EINVAL; | ||
982 | if (origin > 2) | ||
983 | goto out_putf; | ||
984 | |||
985 | offset = llseek(file, ((loff_t) offhi << 32) | offlow, origin); | ||
986 | retval = (int) offset; | ||
987 | |||
988 | out_putf: | ||
989 | fput(file); | ||
990 | bad: | ||
991 | return retval; | ||
992 | } | ||
993 | |||
994 | asmlinkage int irix_sginap(int ticks) | ||
995 | { | ||
996 | schedule_timeout_interruptible(ticks); | ||
997 | return 0; | ||
998 | } | ||
999 | |||
1000 | asmlinkage int irix_sgikopt(char __user *istring, char __user *ostring, int len) | ||
1001 | { | ||
1002 | return -EINVAL; | ||
1003 | } | ||
1004 | |||
1005 | asmlinkage int irix_gettimeofday(struct timeval __user *tv) | ||
1006 | { | ||
1007 | time_t sec; | ||
1008 | long nsec, seq; | ||
1009 | int err; | ||
1010 | |||
1011 | if (!access_ok(VERIFY_WRITE, tv, sizeof(struct timeval))) | ||
1012 | return -EFAULT; | ||
1013 | |||
1014 | do { | ||
1015 | seq = read_seqbegin(&xtime_lock); | ||
1016 | sec = xtime.tv_sec; | ||
1017 | nsec = xtime.tv_nsec; | ||
1018 | } while (read_seqretry(&xtime_lock, seq)); | ||
1019 | |||
1020 | err = __put_user(sec, &tv->tv_sec); | ||
1021 | err |= __put_user((nsec / 1000), &tv->tv_usec); | ||
1022 | |||
1023 | return err; | ||
1024 | } | ||
1025 | |||
1026 | #define IRIX_MAP_AUTOGROW 0x40 | ||
1027 | |||
1028 | asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, | ||
1029 | int flags, int fd, off_t offset) | ||
1030 | { | ||
1031 | struct file *file = NULL; | ||
1032 | unsigned long retval; | ||
1033 | |||
1034 | if (!(flags & MAP_ANONYMOUS)) { | ||
1035 | if (!(file = fget(fd))) | ||
1036 | return -EBADF; | ||
1037 | |||
1038 | /* Ok, bad taste hack follows, try to think in something else | ||
1039 | * when reading this. */ | ||
1040 | if (flags & IRIX_MAP_AUTOGROW) { | ||
1041 | unsigned long old_pos; | ||
1042 | long max_size = offset + len; | ||
1043 | |||
1044 | if (max_size > file->f_path.dentry->d_inode->i_size) { | ||
1045 | old_pos = sys_lseek(fd, max_size - 1, 0); | ||
1046 | sys_write(fd, (void __user *) "", 1); | ||
1047 | sys_lseek(fd, old_pos, 0); | ||
1048 | } | ||
1049 | } | ||
1050 | } | ||
1051 | |||
1052 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
1053 | |||
1054 | down_write(¤t->mm->mmap_sem); | ||
1055 | retval = do_mmap(file, addr, len, prot, flags, offset); | ||
1056 | up_write(¤t->mm->mmap_sem); | ||
1057 | if (file) | ||
1058 | fput(file); | ||
1059 | |||
1060 | return retval; | ||
1061 | } | ||
1062 | |||
1063 | asmlinkage int irix_madvise(unsigned long addr, int len, int behavior) | ||
1064 | { | ||
1065 | printk("[%s:%d] Wheee.. irix_madvise(%08lx,%d,%d)\n", | ||
1066 | current->comm, current->pid, addr, len, behavior); | ||
1067 | |||
1068 | return -EINVAL; | ||
1069 | } | ||
1070 | |||
1071 | asmlinkage int irix_pagelock(char __user *addr, int len, int op) | ||
1072 | { | ||
1073 | printk("[%s:%d] Wheee.. irix_pagelock(%p,%d,%d)\n", | ||
1074 | current->comm, current->pid, addr, len, op); | ||
1075 | |||
1076 | return -EINVAL; | ||
1077 | } | ||
1078 | |||
1079 | asmlinkage int irix_quotactl(struct pt_regs *regs) | ||
1080 | { | ||
1081 | printk("[%s:%d] Wheee.. irix_quotactl()\n", | ||
1082 | current->comm, current->pid); | ||
1083 | |||
1084 | return -EINVAL; | ||
1085 | } | ||
1086 | |||
1087 | asmlinkage int irix_BSDsetpgrp(int pid, int pgrp) | ||
1088 | { | ||
1089 | int error; | ||
1090 | |||
1091 | #ifdef DEBUG_PROCGRPS | ||
1092 | printk("[%s:%d] BSDsetpgrp(%d, %d) ", current->comm, current->pid, | ||
1093 | pid, pgrp); | ||
1094 | #endif | ||
1095 | if(!pid) | ||
1096 | pid = task_pid_vnr(current); | ||
1097 | |||
1098 | /* Wheee, weird sysv thing... */ | ||
1099 | if ((pgrp == 0) && (pid == task_pid_vnr(current))) | ||
1100 | error = sys_setsid(); | ||
1101 | else | ||
1102 | error = sys_setpgid(pid, pgrp); | ||
1103 | |||
1104 | #ifdef DEBUG_PROCGRPS | ||
1105 | printk("error = %d\n", error); | ||
1106 | #endif | ||
1107 | |||
1108 | return error; | ||
1109 | } | ||
1110 | |||
1111 | asmlinkage int irix_systeminfo(int cmd, char __user *buf, int cnt) | ||
1112 | { | ||
1113 | printk("[%s:%d] Wheee.. irix_systeminfo(%d,%p,%d)\n", | ||
1114 | current->comm, current->pid, cmd, buf, cnt); | ||
1115 | |||
1116 | return -EINVAL; | ||
1117 | } | ||
1118 | |||
1119 | struct iuname { | ||
1120 | char sysname[257], nodename[257], release[257]; | ||
1121 | char version[257], machine[257]; | ||
1122 | char m_type[257], base_rel[257]; | ||
1123 | char _unused0[257], _unused1[257], _unused2[257]; | ||
1124 | char _unused3[257], _unused4[257], _unused5[257]; | ||
1125 | }; | ||
1126 | |||
1127 | asmlinkage int irix_uname(struct iuname __user *buf) | ||
1128 | { | ||
1129 | down_read(&uts_sem); | ||
1130 | if (copy_from_user(utsname()->sysname, buf->sysname, 65) | ||
1131 | || copy_from_user(utsname()->nodename, buf->nodename, 65) | ||
1132 | || copy_from_user(utsname()->release, buf->release, 65) | ||
1133 | || copy_from_user(utsname()->version, buf->version, 65) | ||
1134 | || copy_from_user(utsname()->machine, buf->machine, 65)) { | ||
1135 | return -EFAULT; | ||
1136 | } | ||
1137 | up_read(&uts_sem); | ||
1138 | |||
1139 | return 1; | ||
1140 | } | ||
1141 | |||
1142 | #undef DEBUG_XSTAT | ||
1143 | |||
1144 | static int irix_xstat32_xlate(struct kstat *stat, void __user *ubuf) | ||
1145 | { | ||
1146 | struct xstat32 { | ||
1147 | u32 st_dev, st_pad1[3], st_ino, st_mode, st_nlink, st_uid, st_gid; | ||
1148 | u32 st_rdev, st_pad2[2], st_size, st_pad3; | ||
1149 | u32 st_atime0, st_atime1; | ||
1150 | u32 st_mtime0, st_mtime1; | ||
1151 | u32 st_ctime0, st_ctime1; | ||
1152 | u32 st_blksize, st_blocks; | ||
1153 | char st_fstype[16]; | ||
1154 | u32 st_pad4[8]; | ||
1155 | } ub; | ||
1156 | |||
1157 | if (!sysv_valid_dev(stat->dev) || !sysv_valid_dev(stat->rdev)) | ||
1158 | return -EOVERFLOW; | ||
1159 | ub.st_dev = sysv_encode_dev(stat->dev); | ||
1160 | ub.st_ino = stat->ino; | ||
1161 | ub.st_mode = stat->mode; | ||
1162 | ub.st_nlink = stat->nlink; | ||
1163 | SET_UID(ub.st_uid, stat->uid); | ||
1164 | SET_GID(ub.st_gid, stat->gid); | ||
1165 | ub.st_rdev = sysv_encode_dev(stat->rdev); | ||
1166 | #if BITS_PER_LONG == 32 | ||
1167 | if (stat->size > MAX_NON_LFS) | ||
1168 | return -EOVERFLOW; | ||
1169 | #endif | ||
1170 | ub.st_size = stat->size; | ||
1171 | ub.st_atime0 = stat->atime.tv_sec; | ||
1172 | ub.st_atime1 = stat->atime.tv_nsec; | ||
1173 | ub.st_mtime0 = stat->mtime.tv_sec; | ||
1174 | ub.st_mtime1 = stat->atime.tv_nsec; | ||
1175 | ub.st_ctime0 = stat->ctime.tv_sec; | ||
1176 | ub.st_ctime1 = stat->atime.tv_nsec; | ||
1177 | ub.st_blksize = stat->blksize; | ||
1178 | ub.st_blocks = stat->blocks; | ||
1179 | strcpy(ub.st_fstype, "efs"); | ||
1180 | |||
1181 | return copy_to_user(ubuf, &ub, sizeof(ub)) ? -EFAULT : 0; | ||
1182 | } | ||
1183 | |||
1184 | static int irix_xstat64_xlate(struct kstat *stat, void __user *ubuf) | ||
1185 | { | ||
1186 | struct xstat64 { | ||
1187 | u32 st_dev; s32 st_pad1[3]; | ||
1188 | unsigned long long st_ino; | ||
1189 | u32 st_mode; | ||
1190 | u32 st_nlink; s32 st_uid; s32 st_gid; u32 st_rdev; | ||
1191 | s32 st_pad2[2]; | ||
1192 | long long st_size; | ||
1193 | s32 st_pad3; | ||
1194 | struct { s32 tv_sec, tv_nsec; } st_atime, st_mtime, st_ctime; | ||
1195 | s32 st_blksize; | ||
1196 | long long st_blocks; | ||
1197 | char st_fstype[16]; | ||
1198 | s32 st_pad4[8]; | ||
1199 | } ks; | ||
1200 | |||
1201 | if (!sysv_valid_dev(stat->dev) || !sysv_valid_dev(stat->rdev)) | ||
1202 | return -EOVERFLOW; | ||
1203 | |||
1204 | ks.st_dev = sysv_encode_dev(stat->dev); | ||
1205 | ks.st_pad1[0] = ks.st_pad1[1] = ks.st_pad1[2] = 0; | ||
1206 | ks.st_ino = (unsigned long long) stat->ino; | ||
1207 | ks.st_mode = (u32) stat->mode; | ||
1208 | ks.st_nlink = (u32) stat->nlink; | ||
1209 | ks.st_uid = (s32) stat->uid; | ||
1210 | ks.st_gid = (s32) stat->gid; | ||
1211 | ks.st_rdev = sysv_encode_dev(stat->rdev); | ||
1212 | ks.st_pad2[0] = ks.st_pad2[1] = 0; | ||
1213 | ks.st_size = (long long) stat->size; | ||
1214 | ks.st_pad3 = 0; | ||
1215 | |||
1216 | /* XXX hackety hack... */ | ||
1217 | ks.st_atime.tv_sec = (s32) stat->atime.tv_sec; | ||
1218 | ks.st_atime.tv_nsec = stat->atime.tv_nsec; | ||
1219 | ks.st_mtime.tv_sec = (s32) stat->mtime.tv_sec; | ||
1220 | ks.st_mtime.tv_nsec = stat->mtime.tv_nsec; | ||
1221 | ks.st_ctime.tv_sec = (s32) stat->ctime.tv_sec; | ||
1222 | ks.st_ctime.tv_nsec = stat->ctime.tv_nsec; | ||
1223 | |||
1224 | ks.st_blksize = (s32) stat->blksize; | ||
1225 | ks.st_blocks = (long long) stat->blocks; | ||
1226 | memset(ks.st_fstype, 0, 16); | ||
1227 | ks.st_pad4[0] = ks.st_pad4[1] = ks.st_pad4[2] = ks.st_pad4[3] = 0; | ||
1228 | ks.st_pad4[4] = ks.st_pad4[5] = ks.st_pad4[6] = ks.st_pad4[7] = 0; | ||
1229 | |||
1230 | /* Now write it all back. */ | ||
1231 | return copy_to_user(ubuf, &ks, sizeof(ks)) ? -EFAULT : 0; | ||
1232 | } | ||
1233 | |||
1234 | asmlinkage int irix_xstat(int version, char __user *filename, struct stat __user *statbuf) | ||
1235 | { | ||
1236 | int retval; | ||
1237 | struct kstat stat; | ||
1238 | |||
1239 | #ifdef DEBUG_XSTAT | ||
1240 | printk("[%s:%d] Wheee.. irix_xstat(%d,%s,%p) ", | ||
1241 | current->comm, current->pid, version, filename, statbuf); | ||
1242 | #endif | ||
1243 | |||
1244 | retval = vfs_stat(filename, &stat); | ||
1245 | if (!retval) { | ||
1246 | switch(version) { | ||
1247 | case 2: | ||
1248 | retval = irix_xstat32_xlate(&stat, statbuf); | ||
1249 | break; | ||
1250 | case 3: | ||
1251 | retval = irix_xstat64_xlate(&stat, statbuf); | ||
1252 | break; | ||
1253 | default: | ||
1254 | retval = -EINVAL; | ||
1255 | } | ||
1256 | } | ||
1257 | return retval; | ||
1258 | } | ||
1259 | |||
1260 | asmlinkage int irix_lxstat(int version, char __user *filename, struct stat __user *statbuf) | ||
1261 | { | ||
1262 | int error; | ||
1263 | struct kstat stat; | ||
1264 | |||
1265 | #ifdef DEBUG_XSTAT | ||
1266 | printk("[%s:%d] Wheee.. irix_lxstat(%d,%s,%p) ", | ||
1267 | current->comm, current->pid, version, filename, statbuf); | ||
1268 | #endif | ||
1269 | |||
1270 | error = vfs_lstat(filename, &stat); | ||
1271 | |||
1272 | if (!error) { | ||
1273 | switch (version) { | ||
1274 | case 2: | ||
1275 | error = irix_xstat32_xlate(&stat, statbuf); | ||
1276 | break; | ||
1277 | case 3: | ||
1278 | error = irix_xstat64_xlate(&stat, statbuf); | ||
1279 | break; | ||
1280 | default: | ||
1281 | error = -EINVAL; | ||
1282 | } | ||
1283 | } | ||
1284 | return error; | ||
1285 | } | ||
1286 | |||
1287 | asmlinkage int irix_fxstat(int version, int fd, struct stat __user *statbuf) | ||
1288 | { | ||
1289 | int error; | ||
1290 | struct kstat stat; | ||
1291 | |||
1292 | #ifdef DEBUG_XSTAT | ||
1293 | printk("[%s:%d] Wheee.. irix_fxstat(%d,%d,%p) ", | ||
1294 | current->comm, current->pid, version, fd, statbuf); | ||
1295 | #endif | ||
1296 | |||
1297 | error = vfs_fstat(fd, &stat); | ||
1298 | if (!error) { | ||
1299 | switch (version) { | ||
1300 | case 2: | ||
1301 | error = irix_xstat32_xlate(&stat, statbuf); | ||
1302 | break; | ||
1303 | case 3: | ||
1304 | error = irix_xstat64_xlate(&stat, statbuf); | ||
1305 | break; | ||
1306 | default: | ||
1307 | error = -EINVAL; | ||
1308 | } | ||
1309 | } | ||
1310 | return error; | ||
1311 | } | ||
1312 | |||
1313 | asmlinkage int irix_xmknod(int ver, char __user *filename, int mode, unsigned dev) | ||
1314 | { | ||
1315 | int retval; | ||
1316 | printk("[%s:%d] Wheee.. irix_xmknod(%d,%s,%x,%x)\n", | ||
1317 | current->comm, current->pid, ver, filename, mode, dev); | ||
1318 | |||
1319 | switch(ver) { | ||
1320 | case 2: | ||
1321 | /* shouldn't we convert here as well as on stat()? */ | ||
1322 | retval = sys_mknod(filename, mode, dev); | ||
1323 | break; | ||
1324 | |||
1325 | default: | ||
1326 | retval = -EINVAL; | ||
1327 | break; | ||
1328 | }; | ||
1329 | |||
1330 | return retval; | ||
1331 | } | ||
1332 | |||
1333 | asmlinkage int irix_swapctl(int cmd, char __user *arg) | ||
1334 | { | ||
1335 | printk("[%s:%d] Wheee.. irix_swapctl(%d,%p)\n", | ||
1336 | current->comm, current->pid, cmd, arg); | ||
1337 | |||
1338 | return -EINVAL; | ||
1339 | } | ||
1340 | |||
1341 | struct irix_statvfs { | ||
1342 | u32 f_bsize; u32 f_frsize; u32 f_blocks; | ||
1343 | u32 f_bfree; u32 f_bavail; u32 f_files; u32 f_ffree; u32 f_favail; | ||
1344 | u32 f_fsid; char f_basetype[16]; | ||
1345 | u32 f_flag; u32 f_namemax; | ||
1346 | char f_fstr[32]; u32 f_filler[16]; | ||
1347 | }; | ||
1348 | |||
1349 | asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf) | ||
1350 | { | ||
1351 | struct nameidata nd; | ||
1352 | struct kstatfs kbuf; | ||
1353 | int error, i; | ||
1354 | |||
1355 | printk("[%s:%d] Wheee.. irix_statvfs(%s,%p)\n", | ||
1356 | current->comm, current->pid, fname, buf); | ||
1357 | if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs))) | ||
1358 | return -EFAULT; | ||
1359 | |||
1360 | error = user_path_walk(fname, &nd); | ||
1361 | if (error) | ||
1362 | goto out; | ||
1363 | error = vfs_statfs(nd.path.dentry, &kbuf); | ||
1364 | if (error) | ||
1365 | goto dput_and_out; | ||
1366 | |||
1367 | error |= __put_user(kbuf.f_bsize, &buf->f_bsize); | ||
1368 | error |= __put_user(kbuf.f_frsize, &buf->f_frsize); | ||
1369 | error |= __put_user(kbuf.f_blocks, &buf->f_blocks); | ||
1370 | error |= __put_user(kbuf.f_bfree, &buf->f_bfree); | ||
1371 | error |= __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */ | ||
1372 | error |= __put_user(kbuf.f_files, &buf->f_files); | ||
1373 | error |= __put_user(kbuf.f_ffree, &buf->f_ffree); | ||
1374 | error |= __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */ | ||
1375 | #ifdef __MIPSEB__ | ||
1376 | error |= __put_user(kbuf.f_fsid.val[1], &buf->f_fsid); | ||
1377 | #else | ||
1378 | error |= __put_user(kbuf.f_fsid.val[0], &buf->f_fsid); | ||
1379 | #endif | ||
1380 | for (i = 0; i < 16; i++) | ||
1381 | error |= __put_user(0, &buf->f_basetype[i]); | ||
1382 | error |= __put_user(0, &buf->f_flag); | ||
1383 | error |= __put_user(kbuf.f_namelen, &buf->f_namemax); | ||
1384 | for (i = 0; i < 32; i++) | ||
1385 | error |= __put_user(0, &buf->f_fstr[i]); | ||
1386 | |||
1387 | dput_and_out: | ||
1388 | path_put(&nd.path); | ||
1389 | out: | ||
1390 | return error; | ||
1391 | } | ||
1392 | |||
1393 | asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf) | ||
1394 | { | ||
1395 | struct kstatfs kbuf; | ||
1396 | struct file *file; | ||
1397 | int error, i; | ||
1398 | |||
1399 | printk("[%s:%d] Wheee.. irix_fstatvfs(%d,%p)\n", | ||
1400 | current->comm, current->pid, fd, buf); | ||
1401 | |||
1402 | if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs))) | ||
1403 | return -EFAULT; | ||
1404 | |||
1405 | if (!(file = fget(fd))) { | ||
1406 | error = -EBADF; | ||
1407 | goto out; | ||
1408 | } | ||
1409 | error = vfs_statfs(file->f_path.dentry, &kbuf); | ||
1410 | if (error) | ||
1411 | goto out_f; | ||
1412 | |||
1413 | error = __put_user(kbuf.f_bsize, &buf->f_bsize); | ||
1414 | error |= __put_user(kbuf.f_frsize, &buf->f_frsize); | ||
1415 | error |= __put_user(kbuf.f_blocks, &buf->f_blocks); | ||
1416 | error |= __put_user(kbuf.f_bfree, &buf->f_bfree); | ||
1417 | error |= __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */ | ||
1418 | error |= __put_user(kbuf.f_files, &buf->f_files); | ||
1419 | error |= __put_user(kbuf.f_ffree, &buf->f_ffree); | ||
1420 | error |= __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */ | ||
1421 | #ifdef __MIPSEB__ | ||
1422 | error |= __put_user(kbuf.f_fsid.val[1], &buf->f_fsid); | ||
1423 | #else | ||
1424 | error |= __put_user(kbuf.f_fsid.val[0], &buf->f_fsid); | ||
1425 | #endif | ||
1426 | for(i = 0; i < 16; i++) | ||
1427 | error |= __put_user(0, &buf->f_basetype[i]); | ||
1428 | error |= __put_user(0, &buf->f_flag); | ||
1429 | error |= __put_user(kbuf.f_namelen, &buf->f_namemax); | ||
1430 | error |= __clear_user(&buf->f_fstr, sizeof(buf->f_fstr)) ? -EFAULT : 0; | ||
1431 | |||
1432 | out_f: | ||
1433 | fput(file); | ||
1434 | out: | ||
1435 | return error; | ||
1436 | } | ||
1437 | |||
1438 | asmlinkage int irix_priocntl(struct pt_regs *regs) | ||
1439 | { | ||
1440 | printk("[%s:%d] Wheee.. irix_priocntl()\n", | ||
1441 | current->comm, current->pid); | ||
1442 | |||
1443 | return -EINVAL; | ||
1444 | } | ||
1445 | |||
1446 | asmlinkage int irix_sigqueue(int pid, int sig, int code, int val) | ||
1447 | { | ||
1448 | printk("[%s:%d] Wheee.. irix_sigqueue(%d,%d,%d,%d)\n", | ||
1449 | current->comm, current->pid, pid, sig, code, val); | ||
1450 | |||
1451 | return -EINVAL; | ||
1452 | } | ||
1453 | |||
1454 | asmlinkage int irix_truncate64(char __user *name, int pad, int size1, int size2) | ||
1455 | { | ||
1456 | int retval; | ||
1457 | |||
1458 | if (size1) { | ||
1459 | retval = -EINVAL; | ||
1460 | goto out; | ||
1461 | } | ||
1462 | retval = sys_truncate(name, size2); | ||
1463 | |||
1464 | out: | ||
1465 | return retval; | ||
1466 | } | ||
1467 | |||
1468 | asmlinkage int irix_ftruncate64(int fd, int pad, int size1, int size2) | ||
1469 | { | ||
1470 | int retval; | ||
1471 | |||
1472 | if (size1) { | ||
1473 | retval = -EINVAL; | ||
1474 | goto out; | ||
1475 | } | ||
1476 | retval = sys_ftruncate(fd, size2); | ||
1477 | |||
1478 | out: | ||
1479 | return retval; | ||
1480 | } | ||
1481 | |||
1482 | asmlinkage int irix_mmap64(struct pt_regs *regs) | ||
1483 | { | ||
1484 | int len, prot, flags, fd, off1, off2, error, base = 0; | ||
1485 | unsigned long addr, pgoff, *sp; | ||
1486 | struct file *file = NULL; | ||
1487 | int err; | ||
1488 | |||
1489 | if (regs->regs[2] == 1000) | ||
1490 | base = 1; | ||
1491 | sp = (unsigned long *) (regs->regs[29] + 16); | ||
1492 | addr = regs->regs[base + 4]; | ||
1493 | len = regs->regs[base + 5]; | ||
1494 | prot = regs->regs[base + 6]; | ||
1495 | if (!base) { | ||
1496 | flags = regs->regs[base + 7]; | ||
1497 | if (!access_ok(VERIFY_READ, sp, (4 * sizeof(unsigned long)))) | ||
1498 | return -EFAULT; | ||
1499 | fd = sp[0]; | ||
1500 | err = __get_user(off1, &sp[1]); | ||
1501 | err |= __get_user(off2, &sp[2]); | ||
1502 | } else { | ||
1503 | if (!access_ok(VERIFY_READ, sp, (5 * sizeof(unsigned long)))) | ||
1504 | return -EFAULT; | ||
1505 | err = __get_user(flags, &sp[0]); | ||
1506 | err |= __get_user(fd, &sp[1]); | ||
1507 | err |= __get_user(off1, &sp[2]); | ||
1508 | err |= __get_user(off2, &sp[3]); | ||
1509 | } | ||
1510 | |||
1511 | if (err) | ||
1512 | return err; | ||
1513 | |||
1514 | if (off1 & PAGE_MASK) | ||
1515 | return -EOVERFLOW; | ||
1516 | |||
1517 | pgoff = (off1 << (32 - PAGE_SHIFT)) | (off2 >> PAGE_SHIFT); | ||
1518 | |||
1519 | if (!(flags & MAP_ANONYMOUS)) { | ||
1520 | if (!(file = fget(fd))) | ||
1521 | return -EBADF; | ||
1522 | |||
1523 | /* Ok, bad taste hack follows, try to think in something else | ||
1524 | when reading this */ | ||
1525 | if (flags & IRIX_MAP_AUTOGROW) { | ||
1526 | unsigned long old_pos; | ||
1527 | long max_size = off2 + len; | ||
1528 | |||
1529 | if (max_size > file->f_path.dentry->d_inode->i_size) { | ||
1530 | old_pos = sys_lseek(fd, max_size - 1, 0); | ||
1531 | sys_write(fd, (void __user *) "", 1); | ||
1532 | sys_lseek(fd, old_pos, 0); | ||
1533 | } | ||
1534 | } | ||
1535 | } | ||
1536 | |||
1537 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
1538 | |||
1539 | down_write(¤t->mm->mmap_sem); | ||
1540 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
1541 | up_write(¤t->mm->mmap_sem); | ||
1542 | |||
1543 | if (file) | ||
1544 | fput(file); | ||
1545 | |||
1546 | return error; | ||
1547 | } | ||
1548 | |||
1549 | asmlinkage int irix_dmi(struct pt_regs *regs) | ||
1550 | { | ||
1551 | printk("[%s:%d] Wheee.. irix_dmi()\n", | ||
1552 | current->comm, current->pid); | ||
1553 | |||
1554 | return -EINVAL; | ||
1555 | } | ||
1556 | |||
1557 | asmlinkage int irix_pread(int fd, char __user *buf, int cnt, int off64, | ||
1558 | int off1, int off2) | ||
1559 | { | ||
1560 | printk("[%s:%d] Wheee.. irix_pread(%d,%p,%d,%d,%d,%d)\n", | ||
1561 | current->comm, current->pid, fd, buf, cnt, off64, off1, off2); | ||
1562 | |||
1563 | return -EINVAL; | ||
1564 | } | ||
1565 | |||
1566 | asmlinkage int irix_pwrite(int fd, char __user *buf, int cnt, int off64, | ||
1567 | int off1, int off2) | ||
1568 | { | ||
1569 | printk("[%s:%d] Wheee.. irix_pwrite(%d,%p,%d,%d,%d,%d)\n", | ||
1570 | current->comm, current->pid, fd, buf, cnt, off64, off1, off2); | ||
1571 | |||
1572 | return -EINVAL; | ||
1573 | } | ||
1574 | |||
1575 | asmlinkage int irix_sgifastpath(int cmd, unsigned long arg0, unsigned long arg1, | ||
1576 | unsigned long arg2, unsigned long arg3, | ||
1577 | unsigned long arg4, unsigned long arg5) | ||
1578 | { | ||
1579 | printk("[%s:%d] Wheee.. irix_fastpath(%d,%08lx,%08lx,%08lx,%08lx," | ||
1580 | "%08lx,%08lx)\n", | ||
1581 | current->comm, current->pid, cmd, arg0, arg1, arg2, | ||
1582 | arg3, arg4, arg5); | ||
1583 | |||
1584 | return -EINVAL; | ||
1585 | } | ||
1586 | |||
1587 | struct irix_statvfs64 { | ||
1588 | u32 f_bsize; u32 f_frsize; | ||
1589 | u64 f_blocks; u64 f_bfree; u64 f_bavail; | ||
1590 | u64 f_files; u64 f_ffree; u64 f_favail; | ||
1591 | u32 f_fsid; | ||
1592 | char f_basetype[16]; | ||
1593 | u32 f_flag; u32 f_namemax; | ||
1594 | char f_fstr[32]; | ||
1595 | u32 f_filler[16]; | ||
1596 | }; | ||
1597 | |||
1598 | asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *buf) | ||
1599 | { | ||
1600 | struct nameidata nd; | ||
1601 | struct kstatfs kbuf; | ||
1602 | int error, i; | ||
1603 | |||
1604 | printk("[%s:%d] Wheee.. irix_statvfs64(%s,%p)\n", | ||
1605 | current->comm, current->pid, fname, buf); | ||
1606 | if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs64))) { | ||
1607 | error = -EFAULT; | ||
1608 | goto out; | ||
1609 | } | ||
1610 | |||
1611 | error = user_path_walk(fname, &nd); | ||
1612 | if (error) | ||
1613 | goto out; | ||
1614 | error = vfs_statfs(nd.path.dentry, &kbuf); | ||
1615 | if (error) | ||
1616 | goto dput_and_out; | ||
1617 | |||
1618 | error = __put_user(kbuf.f_bsize, &buf->f_bsize); | ||
1619 | error |= __put_user(kbuf.f_frsize, &buf->f_frsize); | ||
1620 | error |= __put_user(kbuf.f_blocks, &buf->f_blocks); | ||
1621 | error |= __put_user(kbuf.f_bfree, &buf->f_bfree); | ||
1622 | error |= __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */ | ||
1623 | error |= __put_user(kbuf.f_files, &buf->f_files); | ||
1624 | error |= __put_user(kbuf.f_ffree, &buf->f_ffree); | ||
1625 | error |= __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */ | ||
1626 | #ifdef __MIPSEB__ | ||
1627 | error |= __put_user(kbuf.f_fsid.val[1], &buf->f_fsid); | ||
1628 | #else | ||
1629 | error |= __put_user(kbuf.f_fsid.val[0], &buf->f_fsid); | ||
1630 | #endif | ||
1631 | for(i = 0; i < 16; i++) | ||
1632 | error |= __put_user(0, &buf->f_basetype[i]); | ||
1633 | error |= __put_user(0, &buf->f_flag); | ||
1634 | error |= __put_user(kbuf.f_namelen, &buf->f_namemax); | ||
1635 | for(i = 0; i < 32; i++) | ||
1636 | error |= __put_user(0, &buf->f_fstr[i]); | ||
1637 | |||
1638 | dput_and_out: | ||
1639 | path_put(&nd.path); | ||
1640 | out: | ||
1641 | return error; | ||
1642 | } | ||
1643 | |||
1644 | asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf) | ||
1645 | { | ||
1646 | struct kstatfs kbuf; | ||
1647 | struct file *file; | ||
1648 | int error, i; | ||
1649 | |||
1650 | printk("[%s:%d] Wheee.. irix_fstatvfs64(%d,%p)\n", | ||
1651 | current->comm, current->pid, fd, buf); | ||
1652 | |||
1653 | if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs))) { | ||
1654 | error = -EFAULT; | ||
1655 | goto out; | ||
1656 | } | ||
1657 | if (!(file = fget(fd))) { | ||
1658 | error = -EBADF; | ||
1659 | goto out; | ||
1660 | } | ||
1661 | error = vfs_statfs(file->f_path.dentry, &kbuf); | ||
1662 | if (error) | ||
1663 | goto out_f; | ||
1664 | |||
1665 | error = __put_user(kbuf.f_bsize, &buf->f_bsize); | ||
1666 | error |= __put_user(kbuf.f_frsize, &buf->f_frsize); | ||
1667 | error |= __put_user(kbuf.f_blocks, &buf->f_blocks); | ||
1668 | error |= __put_user(kbuf.f_bfree, &buf->f_bfree); | ||
1669 | error |= __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */ | ||
1670 | error |= __put_user(kbuf.f_files, &buf->f_files); | ||
1671 | error |= __put_user(kbuf.f_ffree, &buf->f_ffree); | ||
1672 | error |= __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */ | ||
1673 | #ifdef __MIPSEB__ | ||
1674 | error |= __put_user(kbuf.f_fsid.val[1], &buf->f_fsid); | ||
1675 | #else | ||
1676 | error |= __put_user(kbuf.f_fsid.val[0], &buf->f_fsid); | ||
1677 | #endif | ||
1678 | for(i = 0; i < 16; i++) | ||
1679 | error |= __put_user(0, &buf->f_basetype[i]); | ||
1680 | error |= __put_user(0, &buf->f_flag); | ||
1681 | error |= __put_user(kbuf.f_namelen, &buf->f_namemax); | ||
1682 | error |= __clear_user(buf->f_fstr, sizeof(buf->f_fstr[i])) ? -EFAULT : 0; | ||
1683 | |||
1684 | out_f: | ||
1685 | fput(file); | ||
1686 | out: | ||
1687 | return error; | ||
1688 | } | ||
1689 | |||
1690 | asmlinkage int irix_getmountid(char __user *fname, unsigned long __user *midbuf) | ||
1691 | { | ||
1692 | int err; | ||
1693 | |||
1694 | printk("[%s:%d] irix_getmountid(%s, %p)\n", | ||
1695 | current->comm, current->pid, fname, midbuf); | ||
1696 | if (!access_ok(VERIFY_WRITE, midbuf, (sizeof(unsigned long) * 4))) | ||
1697 | return -EFAULT; | ||
1698 | |||
1699 | /* | ||
1700 | * The idea with this system call is that when trying to determine | ||
1701 | * 'pwd' and it's a toss-up for some reason, userland can use the | ||
1702 | * fsid of the filesystem to try and make the right decision, but | ||
1703 | * we don't have this so for now. XXX | ||
1704 | */ | ||
1705 | err = __put_user(0, &midbuf[0]); | ||
1706 | err |= __put_user(0, &midbuf[1]); | ||
1707 | err |= __put_user(0, &midbuf[2]); | ||
1708 | err |= __put_user(0, &midbuf[3]); | ||
1709 | |||
1710 | return err; | ||
1711 | } | ||
1712 | |||
1713 | asmlinkage int irix_nsproc(unsigned long entry, unsigned long mask, | ||
1714 | unsigned long arg, unsigned long sp, int slen) | ||
1715 | { | ||
1716 | printk("[%s:%d] Wheee.. irix_nsproc(%08lx,%08lx,%08lx,%08lx,%d)\n", | ||
1717 | current->comm, current->pid, entry, mask, arg, sp, slen); | ||
1718 | |||
1719 | return -EINVAL; | ||
1720 | } | ||
1721 | |||
1722 | #undef DEBUG_GETDENTS | ||
1723 | |||
1724 | struct irix_dirent32 { | ||
1725 | u32 d_ino; | ||
1726 | u32 d_off; | ||
1727 | unsigned short d_reclen; | ||
1728 | char d_name[1]; | ||
1729 | }; | ||
1730 | |||
1731 | struct irix_dirent32_callback { | ||
1732 | struct irix_dirent32 __user *current_dir; | ||
1733 | struct irix_dirent32 __user *previous; | ||
1734 | int count; | ||
1735 | int error; | ||
1736 | }; | ||
1737 | |||
1738 | #define NAME_OFFSET32(de) ((int) ((de)->d_name - (char *) (de))) | ||
1739 | #define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1)) | ||
1740 | |||
1741 | static int irix_filldir32(void *__buf, const char *name, | ||
1742 | int namlen, loff_t offset, u64 ino, unsigned int d_type) | ||
1743 | { | ||
1744 | struct irix_dirent32 __user *dirent; | ||
1745 | struct irix_dirent32_callback *buf = __buf; | ||
1746 | unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1); | ||
1747 | int err = 0; | ||
1748 | u32 d_ino; | ||
1749 | |||
1750 | #ifdef DEBUG_GETDENTS | ||
1751 | printk("\nirix_filldir32[reclen<%d>namlen<%d>count<%d>]", | ||
1752 | reclen, namlen, buf->count); | ||
1753 | #endif | ||
1754 | buf->error = -EINVAL; /* only used if we fail.. */ | ||
1755 | if (reclen > buf->count) | ||
1756 | return -EINVAL; | ||
1757 | d_ino = ino; | ||
1758 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | ||
1759 | return -EOVERFLOW; | ||
1760 | dirent = buf->previous; | ||
1761 | if (dirent) | ||
1762 | err = __put_user(offset, &dirent->d_off); | ||
1763 | dirent = buf->current_dir; | ||
1764 | err |= __put_user(dirent, &buf->previous); | ||
1765 | err |= __put_user(d_ino, &dirent->d_ino); | ||
1766 | err |= __put_user(reclen, &dirent->d_reclen); | ||
1767 | err |= copy_to_user((char __user *)dirent->d_name, name, namlen) ? -EFAULT : 0; | ||
1768 | err |= __put_user(0, &dirent->d_name[namlen]); | ||
1769 | dirent = (struct irix_dirent32 __user *) ((char __user *) dirent + reclen); | ||
1770 | |||
1771 | buf->current_dir = dirent; | ||
1772 | buf->count -= reclen; | ||
1773 | |||
1774 | return err; | ||
1775 | } | ||
1776 | |||
1777 | asmlinkage int irix_ngetdents(unsigned int fd, void __user * dirent, | ||
1778 | unsigned int count, int __user *eob) | ||
1779 | { | ||
1780 | struct file *file; | ||
1781 | struct irix_dirent32 __user *lastdirent; | ||
1782 | struct irix_dirent32_callback buf; | ||
1783 | int error; | ||
1784 | |||
1785 | #ifdef DEBUG_GETDENTS | ||
1786 | printk("[%s:%d] ngetdents(%d, %p, %d, %p) ", current->comm, | ||
1787 | current->pid, fd, dirent, count, eob); | ||
1788 | #endif | ||
1789 | error = -EBADF; | ||
1790 | file = fget(fd); | ||
1791 | if (!file) | ||
1792 | goto out; | ||
1793 | |||
1794 | buf.current_dir = (struct irix_dirent32 __user *) dirent; | ||
1795 | buf.previous = NULL; | ||
1796 | buf.count = count; | ||
1797 | buf.error = 0; | ||
1798 | |||
1799 | error = vfs_readdir(file, irix_filldir32, &buf); | ||
1800 | if (error < 0) | ||
1801 | goto out_putf; | ||
1802 | |||
1803 | error = buf.error; | ||
1804 | lastdirent = buf.previous; | ||
1805 | if (lastdirent) { | ||
1806 | put_user(file->f_pos, &lastdirent->d_off); | ||
1807 | error = count - buf.count; | ||
1808 | } | ||
1809 | |||
1810 | if (put_user(0, eob) < 0) { | ||
1811 | error = -EFAULT; | ||
1812 | goto out_putf; | ||
1813 | } | ||
1814 | |||
1815 | #ifdef DEBUG_GETDENTS | ||
1816 | printk("eob=%d returning %d\n", *eob, count - buf.count); | ||
1817 | #endif | ||
1818 | error = count - buf.count; | ||
1819 | |||
1820 | out_putf: | ||
1821 | fput(file); | ||
1822 | out: | ||
1823 | return error; | ||
1824 | } | ||
1825 | |||
1826 | struct irix_dirent64 { | ||
1827 | u64 d_ino; | ||
1828 | u64 d_off; | ||
1829 | unsigned short d_reclen; | ||
1830 | char d_name[1]; | ||
1831 | }; | ||
1832 | |||
1833 | struct irix_dirent64_callback { | ||
1834 | struct irix_dirent64 __user *curr; | ||
1835 | struct irix_dirent64 __user *previous; | ||
1836 | int count; | ||
1837 | int error; | ||
1838 | }; | ||
1839 | |||
1840 | #define NAME_OFFSET64(de) ((int) ((de)->d_name - (char *) (de))) | ||
1841 | #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) | ||
1842 | |||
1843 | static int irix_filldir64(void *__buf, const char *name, | ||
1844 | int namlen, loff_t offset, u64 ino, unsigned int d_type) | ||
1845 | { | ||
1846 | struct irix_dirent64 __user *dirent; | ||
1847 | struct irix_dirent64_callback * buf = __buf; | ||
1848 | unsigned short reclen = ROUND_UP64(NAME_OFFSET64(dirent) + namlen + 1); | ||
1849 | int err = 0; | ||
1850 | |||
1851 | if (!access_ok(VERIFY_WRITE, buf, sizeof(*buf))) | ||
1852 | return -EFAULT; | ||
1853 | |||
1854 | if (__put_user(-EINVAL, &buf->error)) /* only used if we fail.. */ | ||
1855 | return -EFAULT; | ||
1856 | if (reclen > buf->count) | ||
1857 | return -EINVAL; | ||
1858 | dirent = buf->previous; | ||
1859 | if (dirent) | ||
1860 | err = __put_user(offset, &dirent->d_off); | ||
1861 | dirent = buf->curr; | ||
1862 | buf->previous = dirent; | ||
1863 | err |= __put_user(ino, &dirent->d_ino); | ||
1864 | err |= __put_user(reclen, &dirent->d_reclen); | ||
1865 | err |= __copy_to_user((char __user *)dirent->d_name, name, namlen) | ||
1866 | ? -EFAULT : 0; | ||
1867 | err |= __put_user(0, &dirent->d_name[namlen]); | ||
1868 | |||
1869 | dirent = (struct irix_dirent64 __user *) ((char __user *) dirent + reclen); | ||
1870 | |||
1871 | buf->curr = dirent; | ||
1872 | buf->count -= reclen; | ||
1873 | |||
1874 | return err; | ||
1875 | } | ||
1876 | |||
1877 | asmlinkage int irix_getdents64(int fd, void __user *dirent, int cnt) | ||
1878 | { | ||
1879 | struct file *file; | ||
1880 | struct irix_dirent64 __user *lastdirent; | ||
1881 | struct irix_dirent64_callback buf; | ||
1882 | int error; | ||
1883 | |||
1884 | #ifdef DEBUG_GETDENTS | ||
1885 | printk("[%s:%d] getdents64(%d, %p, %d) ", current->comm, | ||
1886 | current->pid, fd, dirent, cnt); | ||
1887 | #endif | ||
1888 | error = -EBADF; | ||
1889 | if (!(file = fget(fd))) | ||
1890 | goto out; | ||
1891 | |||
1892 | error = -EFAULT; | ||
1893 | if (!access_ok(VERIFY_WRITE, dirent, cnt)) | ||
1894 | goto out_f; | ||
1895 | |||
1896 | error = -EINVAL; | ||
1897 | if (cnt < (sizeof(struct irix_dirent64) + 255)) | ||
1898 | goto out_f; | ||
1899 | |||
1900 | buf.curr = (struct irix_dirent64 __user *) dirent; | ||
1901 | buf.previous = NULL; | ||
1902 | buf.count = cnt; | ||
1903 | buf.error = 0; | ||
1904 | error = vfs_readdir(file, irix_filldir64, &buf); | ||
1905 | if (error < 0) | ||
1906 | goto out_f; | ||
1907 | lastdirent = buf.previous; | ||
1908 | if (!lastdirent) { | ||
1909 | error = buf.error; | ||
1910 | goto out_f; | ||
1911 | } | ||
1912 | if (put_user(file->f_pos, &lastdirent->d_off)) | ||
1913 | return -EFAULT; | ||
1914 | #ifdef DEBUG_GETDENTS | ||
1915 | printk("returning %d\n", cnt - buf.count); | ||
1916 | #endif | ||
1917 | error = cnt - buf.count; | ||
1918 | |||
1919 | out_f: | ||
1920 | fput(file); | ||
1921 | out: | ||
1922 | return error; | ||
1923 | } | ||
1924 | |||
1925 | asmlinkage int irix_ngetdents64(int fd, void __user *dirent, int cnt, int *eob) | ||
1926 | { | ||
1927 | struct file *file; | ||
1928 | struct irix_dirent64 __user *lastdirent; | ||
1929 | struct irix_dirent64_callback buf; | ||
1930 | int error; | ||
1931 | |||
1932 | #ifdef DEBUG_GETDENTS | ||
1933 | printk("[%s:%d] ngetdents64(%d, %p, %d) ", current->comm, | ||
1934 | current->pid, fd, dirent, cnt); | ||
1935 | #endif | ||
1936 | error = -EBADF; | ||
1937 | if (!(file = fget(fd))) | ||
1938 | goto out; | ||
1939 | |||
1940 | error = -EFAULT; | ||
1941 | if (!access_ok(VERIFY_WRITE, dirent, cnt) || | ||
1942 | !access_ok(VERIFY_WRITE, eob, sizeof(*eob))) | ||
1943 | goto out_f; | ||
1944 | |||
1945 | error = -EINVAL; | ||
1946 | if (cnt < (sizeof(struct irix_dirent64) + 255)) | ||
1947 | goto out_f; | ||
1948 | |||
1949 | *eob = 0; | ||
1950 | buf.curr = (struct irix_dirent64 __user *) dirent; | ||
1951 | buf.previous = NULL; | ||
1952 | buf.count = cnt; | ||
1953 | buf.error = 0; | ||
1954 | error = vfs_readdir(file, irix_filldir64, &buf); | ||
1955 | if (error < 0) | ||
1956 | goto out_f; | ||
1957 | lastdirent = buf.previous; | ||
1958 | if (!lastdirent) { | ||
1959 | error = buf.error; | ||
1960 | goto out_f; | ||
1961 | } | ||
1962 | if (put_user(file->f_pos, &lastdirent->d_off)) | ||
1963 | return -EFAULT; | ||
1964 | #ifdef DEBUG_GETDENTS | ||
1965 | printk("eob=%d returning %d\n", *eob, cnt - buf.count); | ||
1966 | #endif | ||
1967 | error = cnt - buf.count; | ||
1968 | |||
1969 | out_f: | ||
1970 | fput(file); | ||
1971 | out: | ||
1972 | return error; | ||
1973 | } | ||
1974 | |||
1975 | asmlinkage int irix_uadmin(unsigned long op, unsigned long func, unsigned long arg) | ||
1976 | { | ||
1977 | int retval; | ||
1978 | |||
1979 | switch (op) { | ||
1980 | case 1: | ||
1981 | /* Reboot */ | ||
1982 | printk("[%s:%d] irix_uadmin: Wants to reboot...\n", | ||
1983 | current->comm, current->pid); | ||
1984 | retval = -EINVAL; | ||
1985 | goto out; | ||
1986 | |||
1987 | case 2: | ||
1988 | /* Shutdown */ | ||
1989 | printk("[%s:%d] irix_uadmin: Wants to shutdown...\n", | ||
1990 | current->comm, current->pid); | ||
1991 | retval = -EINVAL; | ||
1992 | goto out; | ||
1993 | |||
1994 | case 4: | ||
1995 | /* Remount-root */ | ||
1996 | printk("[%s:%d] irix_uadmin: Wants to remount root...\n", | ||
1997 | current->comm, current->pid); | ||
1998 | retval = -EINVAL; | ||
1999 | goto out; | ||
2000 | |||
2001 | case 8: | ||
2002 | /* Kill all tasks. */ | ||
2003 | printk("[%s:%d] irix_uadmin: Wants to kill all tasks...\n", | ||
2004 | current->comm, current->pid); | ||
2005 | retval = -EINVAL; | ||
2006 | goto out; | ||
2007 | |||
2008 | case 256: | ||
2009 | /* Set magic mushrooms... */ | ||
2010 | printk("[%s:%d] irix_uadmin: Wants to set magic mushroom[%d]...\n", | ||
2011 | current->comm, current->pid, (int) func); | ||
2012 | retval = -EINVAL; | ||
2013 | goto out; | ||
2014 | |||
2015 | default: | ||
2016 | printk("[%s:%d] irix_uadmin: Unknown operation [%d]...\n", | ||
2017 | current->comm, current->pid, (int) op); | ||
2018 | retval = -EINVAL; | ||
2019 | goto out; | ||
2020 | }; | ||
2021 | |||
2022 | out: | ||
2023 | return retval; | ||
2024 | } | ||
2025 | |||
2026 | asmlinkage int irix_utssys(char __user *inbuf, int arg, int type, char __user *outbuf) | ||
2027 | { | ||
2028 | int retval; | ||
2029 | |||
2030 | switch(type) { | ||
2031 | case 0: | ||
2032 | /* uname() */ | ||
2033 | retval = irix_uname((struct iuname __user *)inbuf); | ||
2034 | goto out; | ||
2035 | |||
2036 | case 2: | ||
2037 | /* ustat() */ | ||
2038 | printk("[%s:%d] irix_utssys: Wants to do ustat()\n", | ||
2039 | current->comm, current->pid); | ||
2040 | retval = -EINVAL; | ||
2041 | goto out; | ||
2042 | |||
2043 | case 3: | ||
2044 | /* fusers() */ | ||
2045 | printk("[%s:%d] irix_utssys: Wants to do fusers()\n", | ||
2046 | current->comm, current->pid); | ||
2047 | retval = -EINVAL; | ||
2048 | goto out; | ||
2049 | |||
2050 | default: | ||
2051 | printk("[%s:%d] irix_utssys: Wants to do unknown type[%d]\n", | ||
2052 | current->comm, current->pid, (int) type); | ||
2053 | retval = -EINVAL; | ||
2054 | goto out; | ||
2055 | } | ||
2056 | |||
2057 | out: | ||
2058 | return retval; | ||
2059 | } | ||
2060 | |||
2061 | #undef DEBUG_FCNTL | ||
2062 | |||
2063 | #define IRIX_F_ALLOCSP 10 | ||
2064 | |||
2065 | asmlinkage int irix_fcntl(int fd, int cmd, int arg) | ||
2066 | { | ||
2067 | int retval; | ||
2068 | |||
2069 | #ifdef DEBUG_FCNTL | ||
2070 | printk("[%s:%d] irix_fcntl(%d, %d, %d) ", current->comm, | ||
2071 | current->pid, fd, cmd, arg); | ||
2072 | #endif | ||
2073 | if (cmd == IRIX_F_ALLOCSP){ | ||
2074 | return 0; | ||
2075 | } | ||
2076 | retval = sys_fcntl(fd, cmd, arg); | ||
2077 | #ifdef DEBUG_FCNTL | ||
2078 | printk("%d\n", retval); | ||
2079 | #endif | ||
2080 | return retval; | ||
2081 | } | ||
2082 | |||
2083 | asmlinkage int irix_ulimit(int cmd, int arg) | ||
2084 | { | ||
2085 | int retval; | ||
2086 | |||
2087 | switch(cmd) { | ||
2088 | case 1: | ||
2089 | printk("[%s:%d] irix_ulimit: Wants to get file size limit.\n", | ||
2090 | current->comm, current->pid); | ||
2091 | retval = -EINVAL; | ||
2092 | goto out; | ||
2093 | |||
2094 | case 2: | ||
2095 | printk("[%s:%d] irix_ulimit: Wants to set file size limit.\n", | ||
2096 | current->comm, current->pid); | ||
2097 | retval = -EINVAL; | ||
2098 | goto out; | ||
2099 | |||
2100 | case 3: | ||
2101 | printk("[%s:%d] irix_ulimit: Wants to get brk limit.\n", | ||
2102 | current->comm, current->pid); | ||
2103 | retval = -EINVAL; | ||
2104 | goto out; | ||
2105 | |||
2106 | case 4: | ||
2107 | #if 0 | ||
2108 | printk("[%s:%d] irix_ulimit: Wants to get fd limit.\n", | ||
2109 | current->comm, current->pid); | ||
2110 | retval = -EINVAL; | ||
2111 | goto out; | ||
2112 | #endif | ||
2113 | retval = current->signal->rlim[RLIMIT_NOFILE].rlim_cur; | ||
2114 | goto out; | ||
2115 | |||
2116 | case 5: | ||
2117 | printk("[%s:%d] irix_ulimit: Wants to get txt offset.\n", | ||
2118 | current->comm, current->pid); | ||
2119 | retval = -EINVAL; | ||
2120 | goto out; | ||
2121 | |||
2122 | default: | ||
2123 | printk("[%s:%d] irix_ulimit: Unknown command [%d].\n", | ||
2124 | current->comm, current->pid, cmd); | ||
2125 | retval = -EINVAL; | ||
2126 | goto out; | ||
2127 | } | ||
2128 | out: | ||
2129 | return retval; | ||
2130 | } | ||
2131 | |||
2132 | asmlinkage int irix_unimp(struct pt_regs *regs) | ||
2133 | { | ||
2134 | printk("irix_unimp [%s:%d] v0=%d v1=%d a0=%08lx a1=%08lx a2=%08lx " | ||
2135 | "a3=%08lx\n", current->comm, current->pid, | ||
2136 | (int) regs->regs[2], (int) regs->regs[3], | ||
2137 | regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]); | ||
2138 | |||
2139 | return -ENOSYS; | ||
2140 | } | ||
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index f9165d1a17bf..b8ea4e9d0d87 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -71,7 +71,6 @@ extern asmlinkage void handle_reserved(void); | |||
71 | extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, | 71 | extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, |
72 | struct mips_fpu_struct *ctx, int has_fpu); | 72 | struct mips_fpu_struct *ctx, int has_fpu); |
73 | 73 | ||
74 | void (*board_watchpoint_handler)(struct pt_regs *regs); | ||
75 | void (*board_be_init)(void); | 74 | void (*board_be_init)(void); |
76 | int (*board_be_handler)(struct pt_regs *regs, int is_fixup); | 75 | int (*board_be_handler)(struct pt_regs *regs, int is_fixup); |
77 | void (*board_nmi_handler_setup)(void); | 76 | void (*board_nmi_handler_setup)(void); |
@@ -249,11 +248,11 @@ static void __show_regs(const struct pt_regs *regs) | |||
249 | /* | 248 | /* |
250 | * Saved cp0 registers | 249 | * Saved cp0 registers |
251 | */ | 250 | */ |
252 | printk("epc : %0*lx ", field, regs->cp0_epc); | 251 | printk("epc : %0*lx %pS\n", field, regs->cp0_epc, |
253 | print_symbol("%s ", regs->cp0_epc); | 252 | (void *) regs->cp0_epc); |
254 | printk(" %s\n", print_tainted()); | 253 | printk(" %s\n", print_tainted()); |
255 | printk("ra : %0*lx ", field, regs->regs[31]); | 254 | printk("ra : %0*lx %pS\n", field, regs->regs[31], |
256 | print_symbol("%s\n", regs->regs[31]); | 255 | (void *) regs->regs[31]); |
257 | 256 | ||
258 | printk("Status: %08x ", (uint32_t) regs->cp0_status); | 257 | printk("Status: %08x ", (uint32_t) regs->cp0_status); |
259 | 258 | ||
@@ -892,11 +891,6 @@ asmlinkage void do_mdmx(struct pt_regs *regs) | |||
892 | 891 | ||
893 | asmlinkage void do_watch(struct pt_regs *regs) | 892 | asmlinkage void do_watch(struct pt_regs *regs) |
894 | { | 893 | { |
895 | if (board_watchpoint_handler) { | ||
896 | (*board_watchpoint_handler)(regs); | ||
897 | return; | ||
898 | } | ||
899 | |||
900 | /* | 894 | /* |
901 | * We use the watch exception where available to detect stack | 895 | * We use the watch exception where available to detect stack |
902 | * overflows. | 896 | * overflows. |