Blackfin: add new cacheflush syscall
Flushing caches sometimes requires anomaly workarounds which require supervisor-only insns. Normally we don't need to flush caches from userspace so this isn't a problem, but when gcc generates trampolines on the stack, we do. So add a new syscall for gcc to use modeled after the mips version. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:

committed by
Mike Frysinger

parent
73775b892e
commit
99a5b2878b
@@ -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 @@ asmlinkage int sys_bfin_spinlock(int *p)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, len, int, op)
|
||||
{
|
||||
if (is_user_addr_valid(current, addr, len) != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (op & DCACHE)
|
||||
blackfin_dcache_flush_range(addr, addr + len);
|
||||
if (op & ICACHE)
|
||||
blackfin_icache_flush_range(addr, addr + len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user