From: Mark Salter <msalter@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, Mark Salter <msalter@redhat.com>
Subject: [PATCH v3 13/24] C6X: syscalls
Date: Tue, 27 Sep 2011 16:29:54 -0400 [thread overview]
Message-ID: <1317155405-26235-14-git-send-email-msalter@redhat.com> (raw)
In-Reply-To: <1317155405-26235-1-git-send-email-msalter@redhat.com>
Signed-off-by: Mark Salter <msalter@redhat.com>
---
arch/c6x/include/asm/syscalls.h | 55 +++++++++++++++++++++++++++++
arch/c6x/include/asm/unistd.h | 26 ++++++++++++++
arch/c6x/kernel/sys_c6x.c | 73 +++++++++++++++++++++++++++++++++++++++
3 files changed, 154 insertions(+), 0 deletions(-)
create mode 100644 arch/c6x/include/asm/syscalls.h
create mode 100644 arch/c6x/include/asm/unistd.h
create mode 100644 arch/c6x/kernel/sys_c6x.c
diff --git a/arch/c6x/include/asm/syscalls.h b/arch/c6x/include/asm/syscalls.h
new file mode 100644
index 0000000..aed53da
--- /dev/null
+++ b/arch/c6x/include/asm/syscalls.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 Texas Instruments Incorporated
+ * Author: Mark Salter <msalter@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef __ASM_C6X_SYSCALLS_H
+#define __ASM_C6X_SYSCALLS_H
+
+#include <linux/compiler.h>
+#include <linux/linkage.h>
+#include <linux/types.h>
+
+/* The array of function pointers for syscalls. */
+extern void *sys_call_table[];
+
+/* The following are trampolines in entry.S to handle 64-bit arguments */
+extern long sys_pread_c6x(unsigned int fd, char __user *buf,
+ size_t count, off_t pos_low, off_t pos_high);
+extern long sys_pwrite_c6x(unsigned int fd, const char __user *buf,
+ size_t count, off_t pos_low, off_t pos_high);
+extern long sys_truncate64_c6x(const char __user *path,
+ off_t length_low, off_t length_high);
+extern long sys_ftruncate64_c6x(unsigned int fd,
+ off_t length_low, off_t length_high);
+extern long sys_fadvise64_c6x(int fd, u32 offset_lo, u32 offset_hi,
+ u32 len, int advice);
+extern long sys_fadvise64_64_c6x(int fd, u32 offset_lo, u32 offset_hi,
+ u32 len_lo, u32 len_hi, int advice);
+extern long sys_fallocate_c6x(int fd, int mode,
+ u32 offset_lo, u32 offset_hi,
+ u32 len_lo, u32 len_hi);
+extern int sys_cache_sync(unsigned long s, unsigned long e);
+
+struct pt_regs;
+
+extern asmlinkage long sys_c6x_clone(struct pt_regs *regs);
+extern asmlinkage long sys_c6x_execve(const char __user *name,
+ const char __user *const __user *argv,
+ const char __user *const __user *envp,
+ struct pt_regs *regs);
+
+
+#include <asm-generic/syscalls.h>
+
+#endif /* __ASM_C6X_SYSCALLS_H */
diff --git a/arch/c6x/include/asm/unistd.h b/arch/c6x/include/asm/unistd.h
new file mode 100644
index 0000000..6d54ea4
--- /dev/null
+++ b/arch/c6x/include/asm/unistd.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2011 Texas Instruments Incorporated
+ *
+ * Based on arch/tile version.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for
+ * more details.
+ */
+#if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL)
+#define _ASM_C6X_UNISTD_H
+
+/* Use the standard ABI for syscalls. */
+#include <asm-generic/unistd.h>
+
+/* C6X-specific syscalls. */
+#define __NR_cache_sync (__NR_arch_specific_syscall + 0)
+__SYSCALL(__NR_cache_sync, sys_cache_sync)
+
+#endif /* _ASM_C6X_UNISTD_H */
diff --git a/arch/c6x/kernel/sys_c6x.c b/arch/c6x/kernel/sys_c6x.c
new file mode 100644
index 0000000..f597d26
--- /dev/null
+++ b/arch/c6x/kernel/sys_c6x.c
@@ -0,0 +1,73 @@
+/*
+ * Port on Texas Instruments TMS320C6x architecture
+ *
+ * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
+ * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/syscalls.h>
+#include <linux/uaccess.h>
+
+#include <asm/syscalls.h>
+
+#ifdef CONFIG_ACCESS_CHECK
+int _access_ok(unsigned long addr, unsigned long size)
+{
+ if (!size)
+ return 1;
+
+ if (!addr || addr > (0xffffffffUL - (size - 1)))
+ goto _bad_access;
+
+ if (segment_eq(get_fs(), KERNEL_DS))
+ return 1;
+
+ if (memory_start <= addr && (addr + size - 1) < memory_end)
+ return 1;
+
+_bad_access:
+ pr_debug("Bad access attempt: pid[%d] addr[%08lx] size[0x%lx]\n",
+ current->pid, addr, size);
+ return 0;
+}
+EXPORT_SYMBOL(_access_ok);
+#endif
+
+/* sys_cache_sync -- sync caches over given range */
+asmlinkage int sys_cache_sync(unsigned long s, unsigned long e)
+{
+ L1D_cache_block_writeback_invalidate(s, e);
+ L1P_cache_block_invalidate(s, e);
+
+ return 0;
+}
+
+/* Provide the actual syscall number to call mapping. */
+#undef __SYSCALL
+#define __SYSCALL(nr, call) [nr] = (call),
+
+/*
+ * Use trampolines
+ */
+#define sys_pread64 sys_pread_c6x
+#define sys_pwrite64 sys_pwrite_c6x
+#define sys_truncate64 sys_truncate64_c6x
+#define sys_ftruncate64 sys_ftruncate64_c6x
+#define sys_fadvise64 sys_fadvise64_c6x
+#define sys_fadvise64_64 sys_fadvise64_64_c6x
+#define sys_fallocate sys_fallocate_c6x
+
+/* Use sys_mmap_pgoff directly */
+#define sys_mmap2 sys_mmap_pgoff
+
+/*
+ * Note that we can't include <linux/unistd.h> here since the header
+ * guard will defeat us; <asm/unistd.h> checks for __SYSCALL as well.
+ */
+void *sys_call_table[__NR_syscalls] = {
+ [0 ... __NR_syscalls-1] = sys_ni_syscall,
+#include <asm/unistd.h>
+};
--
1.7.6.2
next prev parent reply other threads:[~2011-09-27 20:32 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-27 20:29 [PATCH v3 00/24] C6X: New architecture Mark Salter
2011-09-27 20:29 ` [PATCH v3 01/24] fix default __strnlen_user macro Mark Salter
2011-09-28 13:20 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 02/24] fixed generic page.h for non-zero PAGE_OFFSET Mark Salter
2011-09-27 20:29 ` [PATCH v3 03/24] add ELF machine define for TI C6X DSPs Mark Salter
2011-09-27 20:29 ` [PATCH v3 04/24] add missing __iomem to generic iounmap declaration Mark Salter
2011-09-28 13:19 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 05/24] C6X: build infrastructure Mark Salter
2011-09-28 13:23 ` Arnd Bergmann
2011-09-28 14:32 ` Mark Salter
2011-09-28 14:57 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 06/24] C6X: early boot code Mark Salter
2011-09-28 13:26 ` Arnd Bergmann
2011-09-28 14:06 ` Mark Salter
2011-09-28 15:00 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 07/24] C6X: devicetree support Mark Salter
2011-09-28 13:31 ` Arnd Bergmann
2011-09-28 14:44 ` Mark Salter
2011-09-28 14:57 ` Arnd Bergmann
2011-09-28 23:11 ` Grant Likely
2011-09-27 20:29 ` [PATCH v3 08/24] C6X: memory management and DMA support Mark Salter
2011-09-28 13:46 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 09/24] C6X: process management Mark Salter
2011-09-28 13:47 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 10/24] C6X: signal management Mark Salter
2011-09-28 13:48 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 11/24] C6X: time management Mark Salter
2011-09-27 23:41 ` Thomas Gleixner
2011-09-28 12:48 ` Mark Salter
2011-09-27 20:29 ` [PATCH v3 12/24] C6X: interrupt handling Mark Salter
2011-09-27 23:30 ` Thomas Gleixner
2011-09-27 20:29 ` Mark Salter [this message]
2011-09-28 13:49 ` [PATCH v3 13/24] C6X: syscalls Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 14/24] C6X: traps Mark Salter
2011-09-28 13:50 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 15/24] C6X: clocks Mark Salter
2011-09-28 13:51 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 16/24] C6X: cache control Mark Salter
2011-09-28 13:52 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 17/24] C6X: loadable module support Mark Salter
2011-09-28 13:54 ` Arnd Bergmann
2011-09-27 20:29 ` [PATCH v3 18/24] C6X: ptrace support Mark Salter
2011-09-28 13:57 ` Arnd Bergmann
2011-09-27 20:30 ` [PATCH v3 19/24] C6X: headers Mark Salter
2011-09-28 14:07 ` Arnd Bergmann
2011-09-29 13:32 ` Mark Salter
2011-09-29 14:24 ` Mark Salter
2011-09-29 14:41 ` Arnd Bergmann
2011-09-27 20:30 ` [PATCH v3 20/24] C6X: library code Mark Salter
2011-09-28 14:09 ` Arnd Bergmann
2011-09-27 20:30 ` [PATCH v3 21/24] C6X: general SoC support Mark Salter
2011-09-28 14:19 ` Arnd Bergmann
2011-09-27 20:30 ` [PATCH v3 22/24] C6X: EMIF - External Memory Interface Mark Salter
2011-09-28 14:13 ` Arnd Bergmann
2011-09-27 20:30 ` [PATCH v3 23/24] C6X: DSCR - Device State Configuration Registers Mark Salter
2011-09-28 14:11 ` Arnd Bergmann
2011-09-27 20:30 ` [PATCH v3 24/24] C6X: MAINTAINERS Mark Salter
2011-09-28 14:09 ` Arnd Bergmann
2011-09-27 23:15 ` [PATCH v3 00/24] C6X: New architecture Stephen Rothwell
2011-09-28 14:33 ` Arnd Bergmann
2011-09-28 21:49 ` Valdis.Kletnieks
2011-09-29 10:33 ` Arnd Bergmann
2011-09-29 12:21 ` Mark Salter
2011-09-29 12:42 ` Valdis.Kletnieks
2011-09-29 13:02 ` Mark Salter
2011-09-29 13:18 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317155405-26235-14-git-send-email-msalter@redhat.com \
--to=msalter@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome