2 * contains various random system calls that have a non-standard
3 * calling sequence on the Linux/Blackfin platform.
5 * Copyright 2004-2009 Analog Devices Inc.
7 * Licensed under the GPL-2 or later
10 #include <linux/spinlock.h>
11 #include <linux/sem.h>
12 #include <linux/msg.h>
13 #include <linux/shm.h>
14 #include <linux/syscalls.h>
15 #include <linux/mman.h>
16 #include <linux/file.h>
18 #include <linux/uaccess.h>
19 #include <linux/ipc.h>
20 #include <linux/unistd.h>
22 #include <asm/cacheflush.h>
24 #include <asm/cachectl.h>
25 #include <asm/ptrace.h>
27 asmlinkage
void *sys_sram_alloc(size_t size
, unsigned long flags
)
29 return sram_alloc_with_lsl(size
, flags
);
32 asmlinkage
int sys_sram_free(const void *addr
)
34 return sram_free_with_lsl(addr
);
37 asmlinkage
void *sys_dma_memcpy(void *dest
, const void *src
, size_t len
)
39 return safe_dma_memcpy(dest
, src
, len
);
42 #if defined(CONFIG_FB) || defined(CONFIG_FB_MODULE)
44 #include <linux/export.h>
45 unsigned long get_fb_unmapped_area(struct file
*filp
, unsigned long orig_addr
,
46 unsigned long len
, unsigned long pgoff
, unsigned long flags
)
48 struct fb_info
*info
= filp
->private_data
;
49 return (unsigned long)info
->screen_base
;
51 EXPORT_SYMBOL(get_fb_unmapped_area
);
54 /* Needed for legacy userspace atomic emulation */
55 static DEFINE_SPINLOCK(bfin_spinlock_lock
);
57 #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
58 __attribute__((l1_text
))
60 asmlinkage
int sys_bfin_spinlock(int *p
)
64 spin_lock(&bfin_spinlock_lock
); /* This would also hold kernel preemption. */
65 ret
= get_user(tmp
, p
);
66 if (likely(ret
== 0)) {
72 spin_unlock(&bfin_spinlock_lock
);
77 SYSCALL_DEFINE3(cacheflush
, unsigned long, addr
, unsigned long, len
, int, op
)
79 if (is_user_addr_valid(current
, addr
, len
) != 0)
83 blackfin_dcache_flush_range(addr
, addr
+ len
);
85 blackfin_icache_flush_range(addr
, addr
+ len
);