diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /arch/mn10300/kernel | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/mn10300/kernel')
-rw-r--r-- | arch/mn10300/kernel/entry.S | 5 | ||||
-rw-r--r-- | arch/mn10300/kernel/irq.c | 4 | ||||
-rw-r--r-- | arch/mn10300/kernel/kprobes.c | 61 | ||||
-rw-r--r-- | arch/mn10300/kernel/mn10300-serial.c | 3 | ||||
-rw-r--r-- | arch/mn10300/kernel/process.c | 14 | ||||
-rw-r--r-- | arch/mn10300/kernel/setup.c | 1 | ||||
-rw-r--r-- | arch/mn10300/kernel/signal.c | 2 | ||||
-rw-r--r-- | arch/mn10300/kernel/sys_mn10300.c | 142 |
8 files changed, 44 insertions, 188 deletions
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S index a94e7ea3faa6..d9ed5a15c547 100644 --- a/arch/mn10300/kernel/entry.S +++ b/arch/mn10300/kernel/entry.S | |||
@@ -468,7 +468,7 @@ ENTRY(sys_call_table) | |||
468 | .long sys_settimeofday | 468 | .long sys_settimeofday |
469 | .long sys_getgroups16 /* 80 */ | 469 | .long sys_getgroups16 /* 80 */ |
470 | .long sys_setgroups16 | 470 | .long sys_setgroups16 |
471 | .long old_select | 471 | .long sys_old_select |
472 | .long sys_symlink | 472 | .long sys_symlink |
473 | .long sys_lstat | 473 | .long sys_lstat |
474 | .long sys_readlink /* 85 */ | 474 | .long sys_readlink /* 85 */ |
@@ -578,7 +578,7 @@ ENTRY(sys_call_table) | |||
578 | .long sys_ni_syscall /* reserved for streams2 */ | 578 | .long sys_ni_syscall /* reserved for streams2 */ |
579 | .long sys_vfork /* 190 */ | 579 | .long sys_vfork /* 190 */ |
580 | .long sys_getrlimit | 580 | .long sys_getrlimit |
581 | .long sys_mmap2 | 581 | .long sys_mmap_pgoff |
582 | .long sys_truncate64 | 582 | .long sys_truncate64 |
583 | .long sys_ftruncate64 | 583 | .long sys_ftruncate64 |
584 | .long sys_stat64 /* 195 */ | 584 | .long sys_stat64 /* 195 */ |
@@ -724,6 +724,7 @@ ENTRY(sys_call_table) | |||
724 | .long sys_pwritev /* 335 */ | 724 | .long sys_pwritev /* 335 */ |
725 | .long sys_rt_tgsigqueueinfo | 725 | .long sys_rt_tgsigqueueinfo |
726 | .long sys_perf_event_open | 726 | .long sys_perf_event_open |
727 | .long sys_recvmmsg | ||
727 | 728 | ||
728 | 729 | ||
729 | nr_syscalls=(.-sys_call_table)/4 | 730 | nr_syscalls=(.-sys_call_table)/4 |
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c index 4c3c58ef5cda..e2d5ed891f37 100644 --- a/arch/mn10300/kernel/irq.c +++ b/arch/mn10300/kernel/irq.c | |||
@@ -215,7 +215,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
215 | 215 | ||
216 | /* display information rows, one per active CPU */ | 216 | /* display information rows, one per active CPU */ |
217 | case 1 ... NR_IRQS - 1: | 217 | case 1 ... NR_IRQS - 1: |
218 | spin_lock_irqsave(&irq_desc[i].lock, flags); | 218 | raw_spin_lock_irqsave(&irq_desc[i].lock, flags); |
219 | 219 | ||
220 | action = irq_desc[i].action; | 220 | action = irq_desc[i].action; |
221 | if (action) { | 221 | if (action) { |
@@ -235,7 +235,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
235 | seq_putc(p, '\n'); | 235 | seq_putc(p, '\n'); |
236 | } | 236 | } |
237 | 237 | ||
238 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 238 | raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
239 | break; | 239 | break; |
240 | 240 | ||
241 | /* polish off with NMI and error counters */ | 241 | /* polish off with NMI and error counters */ |
diff --git a/arch/mn10300/kernel/kprobes.c b/arch/mn10300/kernel/kprobes.c index dacafab00eb2..67e6389d625a 100644 --- a/arch/mn10300/kernel/kprobes.c +++ b/arch/mn10300/kernel/kprobes.c | |||
@@ -31,13 +31,13 @@ const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist); | |||
31 | #define KPROBE_HIT_ACTIVE 0x00000001 | 31 | #define KPROBE_HIT_ACTIVE 0x00000001 |
32 | #define KPROBE_HIT_SS 0x00000002 | 32 | #define KPROBE_HIT_SS 0x00000002 |
33 | 33 | ||
34 | static struct kprobe *current_kprobe; | 34 | static struct kprobe *cur_kprobe; |
35 | static unsigned long current_kprobe_orig_pc; | 35 | static unsigned long cur_kprobe_orig_pc; |
36 | static unsigned long current_kprobe_next_pc; | 36 | static unsigned long cur_kprobe_next_pc; |
37 | static int current_kprobe_ss_flags; | 37 | static int cur_kprobe_ss_flags; |
38 | static unsigned long kprobe_status; | 38 | static unsigned long kprobe_status; |
39 | static kprobe_opcode_t current_kprobe_ss_buf[MAX_INSN_SIZE + 2]; | 39 | static kprobe_opcode_t cur_kprobe_ss_buf[MAX_INSN_SIZE + 2]; |
40 | static unsigned long current_kprobe_bp_addr; | 40 | static unsigned long cur_kprobe_bp_addr; |
41 | 41 | ||
42 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; | 42 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; |
43 | 43 | ||
@@ -399,26 +399,25 @@ void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) | |||
399 | { | 399 | { |
400 | unsigned long nextpc; | 400 | unsigned long nextpc; |
401 | 401 | ||
402 | current_kprobe_orig_pc = regs->pc; | 402 | cur_kprobe_orig_pc = regs->pc; |
403 | memcpy(current_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE); | 403 | memcpy(cur_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE); |
404 | regs->pc = (unsigned long) current_kprobe_ss_buf; | 404 | regs->pc = (unsigned long) cur_kprobe_ss_buf; |
405 | 405 | ||
406 | nextpc = find_nextpc(regs, ¤t_kprobe_ss_flags); | 406 | nextpc = find_nextpc(regs, &cur_kprobe_ss_flags); |
407 | if (current_kprobe_ss_flags & SINGLESTEP_PCREL) | 407 | if (cur_kprobe_ss_flags & SINGLESTEP_PCREL) |
408 | current_kprobe_next_pc = | 408 | cur_kprobe_next_pc = cur_kprobe_orig_pc + (nextpc - regs->pc); |
409 | current_kprobe_orig_pc + (nextpc - regs->pc); | ||
410 | else | 409 | else |
411 | current_kprobe_next_pc = nextpc; | 410 | cur_kprobe_next_pc = nextpc; |
412 | 411 | ||
413 | /* branching instructions need special handling */ | 412 | /* branching instructions need special handling */ |
414 | if (current_kprobe_ss_flags & SINGLESTEP_BRANCH) | 413 | if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) |
415 | nextpc = singlestep_branch_setup(regs); | 414 | nextpc = singlestep_branch_setup(regs); |
416 | 415 | ||
417 | current_kprobe_bp_addr = nextpc; | 416 | cur_kprobe_bp_addr = nextpc; |
418 | 417 | ||
419 | *(u8 *) nextpc = BREAKPOINT_INSTRUCTION; | 418 | *(u8 *) nextpc = BREAKPOINT_INSTRUCTION; |
420 | mn10300_dcache_flush_range2((unsigned) current_kprobe_ss_buf, | 419 | mn10300_dcache_flush_range2((unsigned) cur_kprobe_ss_buf, |
421 | sizeof(current_kprobe_ss_buf)); | 420 | sizeof(cur_kprobe_ss_buf)); |
422 | mn10300_icache_inv(); | 421 | mn10300_icache_inv(); |
423 | } | 422 | } |
424 | 423 | ||
@@ -440,7 +439,7 @@ static inline int __kprobes kprobe_handler(struct pt_regs *regs) | |||
440 | disarm_kprobe(p, regs); | 439 | disarm_kprobe(p, regs); |
441 | ret = 1; | 440 | ret = 1; |
442 | } else { | 441 | } else { |
443 | p = current_kprobe; | 442 | p = cur_kprobe; |
444 | if (p->break_handler && p->break_handler(p, regs)) | 443 | if (p->break_handler && p->break_handler(p, regs)) |
445 | goto ss_probe; | 444 | goto ss_probe; |
446 | } | 445 | } |
@@ -464,7 +463,7 @@ static inline int __kprobes kprobe_handler(struct pt_regs *regs) | |||
464 | } | 463 | } |
465 | 464 | ||
466 | kprobe_status = KPROBE_HIT_ACTIVE; | 465 | kprobe_status = KPROBE_HIT_ACTIVE; |
467 | current_kprobe = p; | 466 | cur_kprobe = p; |
468 | if (p->pre_handler(p, regs)) { | 467 | if (p->pre_handler(p, regs)) { |
469 | /* handler has already set things up, so skip ss setup */ | 468 | /* handler has already set things up, so skip ss setup */ |
470 | return 1; | 469 | return 1; |
@@ -491,8 +490,8 @@ no_kprobe: | |||
491 | static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) | 490 | static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) |
492 | { | 491 | { |
493 | /* we may need to fixup regs/stack after singlestepping a call insn */ | 492 | /* we may need to fixup regs/stack after singlestepping a call insn */ |
494 | if (current_kprobe_ss_flags & SINGLESTEP_BRANCH) { | 493 | if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) { |
495 | regs->pc = current_kprobe_orig_pc; | 494 | regs->pc = cur_kprobe_orig_pc; |
496 | switch (p->ainsn.insn[0]) { | 495 | switch (p->ainsn.insn[0]) { |
497 | case 0xcd: /* CALL (d16,PC) */ | 496 | case 0xcd: /* CALL (d16,PC) */ |
498 | *(unsigned *) regs->sp = regs->mdr = regs->pc + 5; | 497 | *(unsigned *) regs->sp = regs->mdr = regs->pc + 5; |
@@ -523,8 +522,8 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) | |||
523 | } | 522 | } |
524 | } | 523 | } |
525 | 524 | ||
526 | regs->pc = current_kprobe_next_pc; | 525 | regs->pc = cur_kprobe_next_pc; |
527 | current_kprobe_bp_addr = 0; | 526 | cur_kprobe_bp_addr = 0; |
528 | } | 527 | } |
529 | 528 | ||
530 | static inline int __kprobes post_kprobe_handler(struct pt_regs *regs) | 529 | static inline int __kprobes post_kprobe_handler(struct pt_regs *regs) |
@@ -532,10 +531,10 @@ static inline int __kprobes post_kprobe_handler(struct pt_regs *regs) | |||
532 | if (!kprobe_running()) | 531 | if (!kprobe_running()) |
533 | return 0; | 532 | return 0; |
534 | 533 | ||
535 | if (current_kprobe->post_handler) | 534 | if (cur_kprobe->post_handler) |
536 | current_kprobe->post_handler(current_kprobe, regs, 0); | 535 | cur_kprobe->post_handler(cur_kprobe, regs, 0); |
537 | 536 | ||
538 | resume_execution(current_kprobe, regs); | 537 | resume_execution(cur_kprobe, regs); |
539 | reset_current_kprobe(); | 538 | reset_current_kprobe(); |
540 | preempt_enable_no_resched(); | 539 | preempt_enable_no_resched(); |
541 | return 1; | 540 | return 1; |
@@ -545,12 +544,12 @@ static inline int __kprobes post_kprobe_handler(struct pt_regs *regs) | |||
545 | static inline | 544 | static inline |
546 | int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) | 545 | int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) |
547 | { | 546 | { |
548 | if (current_kprobe->fault_handler && | 547 | if (cur_kprobe->fault_handler && |
549 | current_kprobe->fault_handler(current_kprobe, regs, trapnr)) | 548 | cur_kprobe->fault_handler(cur_kprobe, regs, trapnr)) |
550 | return 1; | 549 | return 1; |
551 | 550 | ||
552 | if (kprobe_status & KPROBE_HIT_SS) { | 551 | if (kprobe_status & KPROBE_HIT_SS) { |
553 | resume_execution(current_kprobe, regs); | 552 | resume_execution(cur_kprobe, regs); |
554 | reset_current_kprobe(); | 553 | reset_current_kprobe(); |
555 | preempt_enable_no_resched(); | 554 | preempt_enable_no_resched(); |
556 | } | 555 | } |
@@ -567,7 +566,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
567 | 566 | ||
568 | switch (val) { | 567 | switch (val) { |
569 | case DIE_BREAKPOINT: | 568 | case DIE_BREAKPOINT: |
570 | if (current_kprobe_bp_addr != args->regs->pc) { | 569 | if (cur_kprobe_bp_addr != args->regs->pc) { |
571 | if (kprobe_handler(args->regs)) | 570 | if (kprobe_handler(args->regs)) |
572 | return NOTIFY_STOP; | 571 | return NOTIFY_STOP; |
573 | } else { | 572 | } else { |
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index 229b710fc5d5..ef34d5a0f8bd 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c | |||
@@ -380,7 +380,8 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask) | |||
380 | u32 epsw; | 380 | u32 epsw; |
381 | asm volatile(" bclr %1,(%2) \n" | 381 | asm volatile(" bclr %1,(%2) \n" |
382 | " mov epsw,%0 \n" | 382 | " mov epsw,%0 \n" |
383 | : "=d"(epsw) : "d"(mask), "a"(ptr)); | 383 | : "=d"(epsw) : "d"(mask), "a"(ptr) |
384 | : "cc", "memory"); | ||
384 | return !(epsw & EPSW_FLAG_Z); | 385 | return !(epsw & EPSW_FLAG_Z); |
385 | } | 386 | } |
386 | 387 | ||
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index 892cce82867e..82b817c7f7b6 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/stddef.h> | 18 | #include <linux/stddef.h> |
19 | #include <linux/unistd.h> | 19 | #include <linux/unistd.h> |
20 | #include <linux/ptrace.h> | 20 | #include <linux/ptrace.h> |
21 | #include <linux/slab.h> | ||
22 | #include <linux/user.h> | 21 | #include <linux/user.h> |
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
@@ -26,6 +25,7 @@ | |||
26 | #include <linux/percpu.h> | 25 | #include <linux/percpu.h> |
27 | #include <linux/err.h> | 26 | #include <linux/err.h> |
28 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/slab.h> | ||
29 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
30 | #include <asm/pgtable.h> | 30 | #include <asm/pgtable.h> |
31 | #include <asm/system.h> | 31 | #include <asm/system.h> |
@@ -275,16 +275,12 @@ asmlinkage long sys_execve(char __user *name, | |||
275 | char *filename; | 275 | char *filename; |
276 | int error; | 276 | int error; |
277 | 277 | ||
278 | lock_kernel(); | ||
279 | |||
280 | filename = getname(name); | 278 | filename = getname(name); |
281 | error = PTR_ERR(filename); | 279 | error = PTR_ERR(filename); |
282 | if (!IS_ERR(filename)) { | 280 | if (IS_ERR(filename)) |
283 | error = do_execve(filename, argv, envp, __frame); | 281 | return error; |
284 | putname(filename); | 282 | error = do_execve(filename, argv, envp, __frame); |
285 | } | 283 | putname(filename); |
286 | |||
287 | unlock_kernel(); | ||
288 | return error; | 284 | return error; |
289 | } | 285 | } |
290 | 286 | ||
diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c index 3f24c298a3af..d464affcba0e 100644 --- a/arch/mn10300/kernel/setup.c +++ b/arch/mn10300/kernel/setup.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/stddef.h> | 15 | #include <linux/stddef.h> |
16 | #include <linux/unistd.h> | 16 | #include <linux/unistd.h> |
17 | #include <linux/ptrace.h> | 17 | #include <linux/ptrace.h> |
18 | #include <linux/slab.h> | ||
19 | #include <linux/user.h> | 18 | #include <linux/user.h> |
20 | #include <linux/tty.h> | 19 | #include <linux/tty.h> |
21 | #include <linux/ioport.h> | 20 | #include <linux/ioport.h> |
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index a21f43bc68e2..717db14c2cc3 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -264,7 +264,7 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, | |||
264 | 264 | ||
265 | /* this is the X/Open sanctioned signal stack switching. */ | 265 | /* this is the X/Open sanctioned signal stack switching. */ |
266 | if (ka->sa.sa_flags & SA_ONSTACK) { | 266 | if (ka->sa.sa_flags & SA_ONSTACK) { |
267 | if (!on_sig_stack(sp)) | 267 | if (sas_ss_flags(sp) == 0) |
268 | sp = current->sas_ss_sp + current->sas_ss_size; | 268 | sp = current->sas_ss_sp + current->sas_ss_size; |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c index 8ca5af00334c..815f1355fad4 100644 --- a/arch/mn10300/kernel/sys_mn10300.c +++ b/arch/mn10300/kernel/sys_mn10300.c | |||
@@ -23,151 +23,11 @@ | |||
23 | 23 | ||
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | 25 | ||
26 | #define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */ | ||
27 | |||
28 | /* | ||
29 | * memory mapping syscall | ||
30 | */ | ||
31 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | ||
32 | unsigned long prot, unsigned long flags, | ||
33 | unsigned long fd, unsigned long pgoff) | ||
34 | { | ||
35 | struct file *file = NULL; | ||
36 | long error = -EINVAL; | ||
37 | |||
38 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
39 | |||
40 | if (flags & MAP_FIXED && addr < MIN_MAP_ADDR) | ||
41 | goto out; | ||
42 | |||
43 | error = -EBADF; | ||
44 | if (!(flags & MAP_ANONYMOUS)) { | ||
45 | file = fget(fd); | ||
46 | if (!file) | ||
47 | goto out; | ||
48 | } | ||
49 | |||
50 | down_write(¤t->mm->mmap_sem); | ||
51 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
52 | up_write(¤t->mm->mmap_sem); | ||
53 | |||
54 | if (file) | ||
55 | fput(file); | ||
56 | out: | ||
57 | return error; | ||
58 | } | ||
59 | |||
60 | asmlinkage long old_mmap(unsigned long addr, unsigned long len, | 26 | asmlinkage long old_mmap(unsigned long addr, unsigned long len, |
61 | unsigned long prot, unsigned long flags, | 27 | unsigned long prot, unsigned long flags, |
62 | unsigned long fd, unsigned long offset) | 28 | unsigned long fd, unsigned long offset) |
63 | { | 29 | { |
64 | if (offset & ~PAGE_MASK) | 30 | if (offset & ~PAGE_MASK) |
65 | return -EINVAL; | 31 | return -EINVAL; |
66 | return sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); | 32 | return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); |
67 | } | ||
68 | |||
69 | struct sel_arg_struct { | ||
70 | unsigned long n; | ||
71 | fd_set *inp; | ||
72 | fd_set *outp; | ||
73 | fd_set *exp; | ||
74 | struct timeval *tvp; | ||
75 | }; | ||
76 | |||
77 | asmlinkage int old_select(struct sel_arg_struct __user *arg) | ||
78 | { | ||
79 | struct sel_arg_struct a; | ||
80 | |||
81 | if (copy_from_user(&a, arg, sizeof(a))) | ||
82 | return -EFAULT; | ||
83 | /* sys_select() does the appropriate kernel locking */ | ||
84 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); | ||
85 | } | ||
86 | |||
87 | /* | ||
88 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | ||
89 | * | ||
90 | * This is really horribly ugly. | ||
91 | */ | ||
92 | asmlinkage long sys_ipc(uint call, int first, int second, | ||
93 | int third, void __user *ptr, long fifth) | ||
94 | { | ||
95 | int version, ret; | ||
96 | |||
97 | version = call >> 16; /* hack for backward compatibility */ | ||
98 | call &= 0xffff; | ||
99 | |||
100 | switch (call) { | ||
101 | case SEMOP: | ||
102 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | ||
103 | second, NULL); | ||
104 | case SEMTIMEDOP: | ||
105 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | ||
106 | second, | ||
107 | (const struct timespec __user *)fifth); | ||
108 | case SEMGET: | ||
109 | return sys_semget(first, second, third); | ||
110 | case SEMCTL: { | ||
111 | union semun fourth; | ||
112 | if (!ptr) | ||
113 | return -EINVAL; | ||
114 | if (get_user(fourth.__pad, (void __user * __user *) ptr)) | ||
115 | return -EFAULT; | ||
116 | return sys_semctl(first, second, third, fourth); | ||
117 | } | ||
118 | |||
119 | case MSGSND: | ||
120 | return sys_msgsnd(first, (struct msgbuf __user *) ptr, | ||
121 | second, third); | ||
122 | case MSGRCV: | ||
123 | switch (version) { | ||
124 | case 0: { | ||
125 | struct ipc_kludge tmp; | ||
126 | if (!ptr) | ||
127 | return -EINVAL; | ||
128 | |||
129 | if (copy_from_user(&tmp, | ||
130 | (struct ipc_kludge __user *) ptr, | ||
131 | sizeof(tmp))) | ||
132 | return -EFAULT; | ||
133 | return sys_msgrcv(first, tmp.msgp, second, | ||
134 | tmp.msgtyp, third); | ||
135 | } | ||
136 | default: | ||
137 | return sys_msgrcv(first, | ||
138 | (struct msgbuf __user *) ptr, | ||
139 | second, fifth, third); | ||
140 | } | ||
141 | case MSGGET: | ||
142 | return sys_msgget((key_t) first, second); | ||
143 | case MSGCTL: | ||
144 | return sys_msgctl(first, second, | ||
145 | (struct msqid_ds __user *) ptr); | ||
146 | |||
147 | case SHMAT: | ||
148 | switch (version) { | ||
149 | default: { | ||
150 | ulong raddr; | ||
151 | ret = do_shmat(first, (char __user *) ptr, second, | ||
152 | &raddr); | ||
153 | if (ret) | ||
154 | return ret; | ||
155 | return put_user(raddr, (ulong *) third); | ||
156 | } | ||
157 | case 1: /* iBCS2 emulator entry point */ | ||
158 | if (!segment_eq(get_fs(), get_ds())) | ||
159 | return -EINVAL; | ||
160 | return do_shmat(first, (char __user *) ptr, second, | ||
161 | (ulong *) third); | ||
162 | } | ||
163 | case SHMDT: | ||
164 | return sys_shmdt((char __user *)ptr); | ||
165 | case SHMGET: | ||
166 | return sys_shmget(first, second, third); | ||
167 | case SHMCTL: | ||
168 | return sys_shmctl(first, second, | ||
169 | (struct shmid_ds __user *) ptr); | ||
170 | default: | ||
171 | return -EINVAL; | ||
172 | } | ||
173 | } | 33 | } |