aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/sys_m68k.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k/kernel/sys_m68k.c')
-rw-r--r--arch/m68k/kernel/sys_m68k.c105
1 files changed, 68 insertions, 37 deletions
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 2f431ece7b5f..8623f8dc16f8 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -12,7 +12,6 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/smp_lock.h>
16#include <linux/sem.h> 15#include <linux/sem.h>
17#include <linux/msg.h> 16#include <linux/msg.h>
18#include <linux/shm.h> 17#include <linux/shm.h>
@@ -28,7 +27,10 @@
28#include <asm/traps.h> 27#include <asm/traps.h>
29#include <asm/page.h> 28#include <asm/page.h>
30#include <asm/unistd.h> 29#include <asm/unistd.h>
31#include <linux/elf.h> 30#include <asm/cacheflush.h>
31
32#ifdef CONFIG_MMU
33
32#include <asm/tlb.h> 34#include <asm/tlb.h>
33 35
34asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, 36asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
@@ -377,7 +379,6 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
377 struct vm_area_struct *vma; 379 struct vm_area_struct *vma;
378 int ret = -EINVAL; 380 int ret = -EINVAL;
379 381
380 lock_kernel();
381 if (scope < FLUSH_SCOPE_LINE || scope > FLUSH_SCOPE_ALL || 382 if (scope < FLUSH_SCOPE_LINE || scope > FLUSH_SCOPE_ALL ||
382 cache & ~FLUSH_CACHE_BOTH) 383 cache & ~FLUSH_CACHE_BOTH)
383 goto out; 384 goto out;
@@ -446,43 +447,9 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
446 } 447 }
447 } 448 }
448out: 449out:
449 unlock_kernel();
450 return ret; 450 return ret;
451} 451}
452 452
453asmlinkage int sys_getpagesize(void)
454{
455 return PAGE_SIZE;
456}
457
458/*
459 * Do a system call from kernel instead of calling sys_execve so we
460 * end up with proper pt_regs.
461 */
462int kernel_execve(const char *filename,
463 const char *const argv[],
464 const char *const envp[])
465{
466 register long __res asm ("%d0") = __NR_execve;
467 register long __a asm ("%d1") = (long)(filename);
468 register long __b asm ("%d2") = (long)(argv);
469 register long __c asm ("%d3") = (long)(envp);
470 asm volatile ("trap #0" : "+d" (__res)
471 : "d" (__a), "d" (__b), "d" (__c));
472 return __res;
473}
474
475asmlinkage unsigned long sys_get_thread_area(void)
476{
477 return current_thread_info()->tp_value;
478}
479
480asmlinkage int sys_set_thread_area(unsigned long tp)
481{
482 current_thread_info()->tp_value = tp;
483 return 0;
484}
485
486/* This syscall gets its arguments in A0 (mem), D2 (oldval) and 453/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
487 D1 (newval). */ 454 D1 (newval). */
488asmlinkage int 455asmlinkage int
@@ -542,6 +509,70 @@ sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
542 } 509 }
543} 510}
544 511
512#else
513
514/* sys_cacheflush -- flush (part of) the processor cache. */
515asmlinkage int
516sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
517{
518 flush_cache_all();
519 return 0;
520}
521
522/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
523 D1 (newval). */
524asmlinkage int
525sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
526 unsigned long __user * mem)
527{
528 struct mm_struct *mm = current->mm;
529 unsigned long mem_value;
530
531 down_read(&mm->mmap_sem);
532
533 mem_value = *mem;
534 if (mem_value == oldval)
535 *mem = newval;
536
537 up_read(&mm->mmap_sem);
538 return mem_value;
539}
540
541#endif /* CONFIG_MMU */
542
543asmlinkage int sys_getpagesize(void)
544{
545 return PAGE_SIZE;
546}
547
548/*
549 * Do a system call from kernel instead of calling sys_execve so we
550 * end up with proper pt_regs.
551 */
552int kernel_execve(const char *filename,
553 const char *const argv[],
554 const char *const envp[])
555{
556 register long __res asm ("%d0") = __NR_execve;
557 register long __a asm ("%d1") = (long)(filename);
558 register long __b asm ("%d2") = (long)(argv);
559 register long __c asm ("%d3") = (long)(envp);
560 asm volatile ("trap #0" : "+d" (__res)
561 : "d" (__a), "d" (__b), "d" (__c));
562 return __res;
563}
564
565asmlinkage unsigned long sys_get_thread_area(void)
566{
567 return current_thread_info()->tp_value;
568}
569
570asmlinkage int sys_set_thread_area(unsigned long tp)
571{
572 current_thread_info()->tp_value = tp;
573 return 0;
574}
575
545asmlinkage int sys_atomic_barrier(void) 576asmlinkage int sys_atomic_barrier(void)
546{ 577{
547 /* no code needed for uniprocs */ 578 /* no code needed for uniprocs */