Title: [9124] trunk/arch/blackfin: Task[#6243] blackfin:cacheflush: add syscall sys_cacheflush
Revision
9124
Author
sonicz
Date
2010-09-06 06:16:04 -0400 (Mon, 06 Sep 2010)

Log Message

Task[#6243] blackfin:cacheflush: add syscall sys_cacheflush

This syscall is for compiler to deal with trampline user code.

Modified Paths

Diff

Modified: trunk/arch/blackfin/include/asm/ptrace.h (9123 => 9124)


--- trunk/arch/blackfin/include/asm/ptrace.h	2010-09-06 07:21:59 UTC (rev 9123)
+++ trunk/arch/blackfin/include/asm/ptrace.h	2010-09-06 10:16:04 UTC (rev 9124)
@@ -113,6 +113,9 @@
 /* common code demands this function */
 #define ptrace_disable(child) user_disable_single_step(child)
 
+extern inline int is_user_addr_valid(struct task_struct *child,
+				unsigned long start, unsigned long len);
+
 /*
  * Get the address of the live pt_regs for the specified task.
  * These are saved onto the top kernel stack when the process

Modified: trunk/arch/blackfin/include/asm/unistd.h (9123 => 9124)


--- trunk/arch/blackfin/include/asm/unistd.h	2010-09-06 07:21:59 UTC (rev 9123)
+++ trunk/arch/blackfin/include/asm/unistd.h	2010-09-06 10:16:04 UTC (rev 9124)
@@ -389,8 +389,9 @@
 #define __NR_rt_tgsigqueueinfo	368
 #define __NR_perf_event_open	369
 #define __NR_recvmmsg		370
+#define __NR_cacheflush		371
 
-#define __NR_syscall		371
+#define __NR_syscall		372
 #define NR_syscalls		__NR_syscall
 
 /* Old optional stuff no one actually uses */

Modified: trunk/arch/blackfin/kernel/ptrace.c (9123 => 9124)


--- trunk/arch/blackfin/kernel/ptrace.c	2010-09-06 07:21:59 UTC (rev 9123)
+++ trunk/arch/blackfin/kernel/ptrace.c	2010-09-06 10:16:04 UTC (rev 9124)
@@ -114,7 +114,7 @@
 /*
  * check that an address falls within the bounds of the target process's memory mappings
  */
-static inline int is_user_addr_valid(struct task_struct *child,
+inline int is_user_addr_valid(struct task_struct *child,
 				     unsigned long start, unsigned long len)
 {
 	struct vm_area_struct *vma;

Modified: trunk/arch/blackfin/kernel/sys_bfin.c (9123 => 9124)


--- trunk/arch/blackfin/kernel/sys_bfin.c	2010-09-06 07:21:59 UTC (rev 9123)
+++ trunk/arch/blackfin/kernel/sys_bfin.c	2010-09-06 10:16:04 UTC (rev 9124)
@@ -21,6 +21,8 @@
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>
+#include <asm/cachectl.h>
+#include <asm/ptrace.h>
 
 asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
 {
@@ -70,3 +72,16 @@
 
 	return ret;
 }
+
+SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, len, int, op)
+{
+	if (is_user_addr_valid(current, addr, len) == 0) {
+		if (op & DCACHE)
+			blackfin_dcache_flush_range(addr, addr + len);
+		if (op & ICACHE)
+			blackfin_icache_flush_range(addr, addr + len);
+		return 0;
+	}
+
+	return -EINVAL;
+}

Modified: trunk/arch/blackfin/mach-common/entry.S (9123 => 9124)


--- trunk/arch/blackfin/mach-common/entry.S	2010-09-06 07:21:59 UTC (rev 9123)
+++ trunk/arch/blackfin/mach-common/entry.S	2010-09-06 10:16:04 UTC (rev 9124)
@@ -1734,6 +1734,7 @@
 	.long _sys_rt_tgsigqueueinfo
 	.long _sys_perf_event_open
 	.long _sys_recvmmsg		/* 370 */
+	.long _sys_cacheflush
 
 	.rept NR_syscalls-(.-_sys_call_table)/4
 	.long _sys_ni_syscall
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to