# 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
--- /dev/null
+#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)
--- /dev/null
+/*
+ * 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
+++ /dev/null
-#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
--- /dev/null
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall3 (__ptr_t, dma_memcpy, __ptr_t, dest, __ptr_t, src, size_t, len);
+
--- /dev/null
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall2 (__ptr_t, sram_alloc, size_t, len, unsigned long, flags);
+
--- /dev/null
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall1 (__ptr_t, sram_free, __ptr_t, addr);
+