Commit cf52c468352993ca420fe0b4ada976dc1f614026

Authored by Chen Liqin
1 parent 324f40fbb0

score: add old syscall support

Showing 3 changed files with 40 additions and 2 deletions Side-by-side Diff

arch/score/include/asm/unistd.h
... ... @@ -3,6 +3,11 @@
3 3  
4 4 #define __ARCH_HAVE_MMU
5 5  
  6 +#define __ARCH_WANT_SYSCALL_NO_AT
  7 +#define __ARCH_WANT_SYSCALL_NO_FLAGS
  8 +#define __ARCH_WANT_SYSCALL_OFF_T
  9 +#define __ARCH_WANT_SYSCALL_DEPRECATED
  10 +
6 11 #include <asm-generic/unistd.h>
7 12  
8 13 #endif /* _ASM_SCORE_UNISTD_H */
arch/score/kernel/entry.S
... ... @@ -499,4 +499,16 @@
499 499 mv r4, r0
500 500 la r8, score_sigaltstack
501 501 br r8
  502 +
  503 +#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
  504 +ENTRY(sys_fork)
  505 + mv r4, r0
  506 + la r8, score_fork
  507 + br r8
  508 +
  509 +ENTRY(sys_vfork)
  510 + mv r4, r0
  511 + la r8, score_vfork
  512 + br r8
  513 +#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
arch/score/kernel/sys_score.c
... ... @@ -25,6 +25,7 @@
25 25  
26 26 #include <linux/file.h>
27 27 #include <linux/fs.h>
  28 +#include <linux/mm.h>
28 29 #include <linux/mman.h>
29 30 #include <linux/module.h>
30 31 #include <linux/unistd.h>
... ... @@ -49,8 +50,7 @@
49 50 }
50 51  
51 52 down_write(&current->mm->mmap_sem);
52   - error = do_mmap_pgoff(file, addr, len, prot, flags,
53   - pgoff >> (PAGE_SHIFT - 12));
  53 + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
54 54 up_write(&current->mm->mmap_sem);
55 55  
56 56 if (file)
... ... @@ -59,6 +59,19 @@
59 59 return error;
60 60 }
61 61  
  62 +asmlinkage long
  63 +sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
  64 + unsigned long flags, unsigned long fd, off_t pgoff)
  65 +{
  66 + return sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
  67 +}
  68 +
  69 +asmlinkage long
  70 +score_fork(struct pt_regs *regs)
  71 +{
  72 + return do_fork(SIGCHLD, regs->regs[0], regs, 0, NULL, NULL);
  73 +}
  74 +
62 75 /*
63 76 * Clone a task - this clones the calling program thread.
64 77 * This is called indirectly via a small wrapper
... ... @@ -79,6 +92,13 @@
79 92  
80 93 return do_fork(clone_flags, newsp, regs, 0,
81 94 parent_tidptr, child_tidptr);
  95 +}
  96 +
  97 +asmlinkage long
  98 +score_vfork(struct pt_regs *regs)
  99 +{
  100 + return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
  101 + regs->regs[0], regs, 0, NULL, NULL);
82 102 }
83 103  
84 104 /*