OSDN Git Service

L1 memory support for the Blackfin. A couple new syscalls to manage L1
authorBernd Schmidt <bernds_cb1@t-online.de>
Fri, 18 Jan 2008 13:53:10 +0000 (13:53 -0000)
committerBernd Schmidt <bernds_cb1@t-online.de>
Fri, 18 Jan 2008 13:53:10 +0000 (13:53 -0000)
allocations, dma_memcpy to move stuff between L1 and main memory, and a new
structure to describe the global data in L1 scratchpad memory.

libc/sysdeps/linux/bfin/Makefile.arch
libc/sysdeps/linux/bfin/bfin_l1layout.h [new file with mode: 0644]
libc/sysdeps/linux/bfin/bfin_sram.h [new file with mode: 0644]
libc/sysdeps/linux/bfin/bits/bfin_sram.h [deleted file]
libc/sysdeps/linux/bfin/dma-memcpy.c [new file with mode: 0644]
libc/sysdeps/linux/bfin/sram-alloc.c [new file with mode: 0644]
libc/sysdeps/linux/bfin/sram-free.c [new file with mode: 0644]

index 7a428b3..e8ff306 100644 (file)
@@ -5,8 +5,11 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-CSRC := brk.c bsdsetjmp.c clone.c syscall.c
+CSRC := brk.c bsdsetjmp.c clone.c syscall.c mmap.c \
+       sram-alloc.c sram-free.c dma-memcpy.c
 
 SSRC := __longjmp.S setjmp.S bsd-_setjmp.S vfork.S
 
+ARCH_HEADERS := bfin_l1layout.h bfin_sram.h
+
 include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/bfin/bfin_l1layout.h b/libc/sysdeps/linux/bfin/bfin_l1layout.h
new file mode 100644 (file)
index 0000000..00efd23
--- /dev/null
@@ -0,0 +1,17 @@
+#define L1_SCRATCH_START       0xFFB00000
+
+/* Data that is "mapped" into the process VM at the start of the L1 scratch
+   memory, so that each process can access it at a fixed address.  Used for
+   stack checking.  */
+struct l1_scratch_task_info
+{
+       /* Points to the start of the stack.  */
+       void *stack_start;
+       /* Not updated by the kernel; a user process can modify this to
+          keep track of the lowest address of the stack pointer during its
+          runtime.  */
+       void *lowest_sp;
+};
+
+/* A pointer to the structure in memory.  */
+#define L1_SCRATCH_TASK_INFO ((struct l1_scratch_task_info *)L1_SCRATCH_START)
diff --git a/libc/sysdeps/linux/bfin/bfin_sram.h b/libc/sysdeps/linux/bfin/bfin_sram.h
new file mode 100644 (file)
index 0000000..eea729b
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * bfin_sram.h - userspace interface to L1 memory allocator
+ *
+ * Copyright (c) 2007 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __BFIN_SRAM_H__
+#define __BFIN_SRAM_H__
+
+#include <features.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#define L1_INST_SRAM            0x00000001
+#define L1_DATA_A_SRAM          0x00000002
+#define L1_DATA_B_SRAM          0x00000004
+#define L1_DATA_SRAM            0x00000006
+
+extern void *sram_alloc(size_t size, unsigned long flags)
+       __attribute_malloc__ __attribute_warn_unused_result__;
+extern int sram_free(const void *addr);
+extern void *dma_memcpy(void *dest, const void *src, size_t len)
+       __nonnull((1, 2));
+
+__END_DECLS
+
+#endif
diff --git a/libc/sysdeps/linux/bfin/bits/bfin_sram.h b/libc/sysdeps/linux/bfin/bits/bfin_sram.h
deleted file mode 100644 (file)
index 1ac066a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef BFIN_SRAM_H
-#define BFIN_SRAM_H
-
-#define L1_INST_SRAM            0x00000001
-#define L1_DATA_A_SRAM          0x00000002
-#define L1_DATA_B_SRAM          0x00000004
-#define L1_DATA_SRAM            0x00000006
-extern void *sram_alloc(size_t size, unsigned long flags);
-extern int sram_free(const void *addr);
-extern void *dma_memcpy(void *dest, const void *src, size_t len);
-
-#endif
diff --git a/libc/sysdeps/linux/bfin/dma-memcpy.c b/libc/sysdeps/linux/bfin/dma-memcpy.c
new file mode 100644 (file)
index 0000000..6d7a5b8
--- /dev/null
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall3 (__ptr_t, dma_memcpy, __ptr_t, dest, __ptr_t, src, size_t, len);
+
diff --git a/libc/sysdeps/linux/bfin/sram-alloc.c b/libc/sysdeps/linux/bfin/sram-alloc.c
new file mode 100644 (file)
index 0000000..f0e8bce
--- /dev/null
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall2 (__ptr_t, sram_alloc, size_t, len, unsigned long, flags);
+
diff --git a/libc/sysdeps/linux/bfin/sram-free.c b/libc/sysdeps/linux/bfin/sram-free.c
new file mode 100644 (file)
index 0000000..02bf5d5
--- /dev/null
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall1 (__ptr_t, sram_free, __ptr_t, addr);
+