diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-06-18 15:40:43 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-06-18 15:40:43 +0000 |
commit | 328d2c63d3529eacf2d4c47c949f1f9830bf8470 (patch) | |
tree | 4c0e7ebbe8455843c8b09cd5ccd8e3969a972ce3 /libc | |
parent | fb7f0f49c739f96f2867fbfebdfea4eac4af70db (diff) | |
download | uClibc-alpine-328d2c63d3529eacf2d4c47c949f1f9830bf8470.tar.bz2 uClibc-alpine-328d2c63d3529eacf2d4c47c949f1f9830bf8470.tar.xz |
Synch libc bfin specific with trunk
Diffstat (limited to 'libc')
-rw-r--r-- | libc/sysdeps/linux/bfin/Makefile.arch | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/__longjmp.S | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bfin_l1layout.h | 17 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bfin_sram.h | 30 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/byteswap.h | 94 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/fcntl.h | 32 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/kernel_types.h | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/syscalls.h | 118 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h | 3 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/brk.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bsd-_setjmp.S | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/clone.c | 20 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/crt1.S | 17 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/crtreloc.c | 49 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/dma-memcpy.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/sram-alloc.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/sram-free.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/sys/procfs.h | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/sys/ucontext.h | 3 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/sysdep.h | 20 |
20 files changed, 304 insertions, 147 deletions
diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch index 7a428b380..6c271509e 100644 --- a/libc/sysdeps/linux/bfin/Makefile.arch +++ b/libc/sysdeps/linux/bfin/Makefile.arch @@ -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 \ + 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/__longjmp.S b/libc/sysdeps/linux/bfin/__longjmp.S index bb40c852c..418d591e2 100644 --- a/libc/sysdeps/linux/bfin/__longjmp.S +++ b/libc/sysdeps/linux/bfin/__longjmp.S @@ -98,9 +98,9 @@ ___longjmp: P0 = [SP++]; CC = R0 == 0; - IF !CC JUMP finished; + IF !CC JUMP .Lfinished; R0 = 1; -finished: +.Lfinished: RTS; .size ___longjmp,.-___longjmp diff --git a/libc/sysdeps/linux/bfin/bfin_l1layout.h b/libc/sysdeps/linux/bfin/bfin_l1layout.h new file mode 100644 index 000000000..00efd2358 --- /dev/null +++ b/libc/sysdeps/linux/bfin/bfin_l1layout.h @@ -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 index 000000000..eea729b05 --- /dev/null +++ b/libc/sysdeps/linux/bfin/bfin_sram.h @@ -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/byteswap.h b/libc/sysdeps/linux/bfin/bits/byteswap.h new file mode 100644 index 000000000..74b87d94c --- /dev/null +++ b/libc/sysdeps/linux/bfin/bits/byteswap.h @@ -0,0 +1,94 @@ +/* File: libc/sysdeps/linux/bfin/bits/byteswap.h + * + * Copyright 2004-2006 Analog Devices Inc. + * + * Enter bugs at http://blackfin.uclinux.org/ + * + * Licensed under the GPL-2 or later. + */ + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." +#endif + +#ifndef _BITS_BYTESWAP_H +#define _BITS_BYTESWAP_H 1 + +/* Swap bytes in 16 bit value. */ +#define __bswap_constant_16(x) \ + ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) + +#ifdef __GNUC__ +# define __bswap_16(x) \ + (__extension__ \ + ({ register unsigned short int __v, __x = (x); \ + if (__builtin_constant_p (__x)) \ + __v = __bswap_constant_16 (__x); \ + else \ + __asm__ ("%0 = PACK (%1.L, %1.L);" \ + "%0 >>= 8;" \ + : "=d" (__v) \ + : "d" (__x)); \ + __v; })) +#else +static __inline unsigned short int +__bswap_16 (unsigned short int __bsx) +{ + return __bswap_constant_16 (__bsx); +} +#endif + +/* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ + (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) + +#ifdef __GNUC__ +# define __bswap_32(x) \ + (__extension__ \ + ({ register unsigned int __v, __x = (x); \ + if (__builtin_constant_p (__x)) \ + __v = __bswap_constant_32 (__x); \ + else \ + __asm__ ("%1 = %0 >> 8 (V);" \ + "%0 = %0 << 8 (V);" \ + "%0 = %0 | %1;" \ + "%1 = PACK(%0.L, %0.H);" \ + : "+d"(__x), "=&d"(__v)); \ + __v; })) +#else +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __bswap_constant_32 (__bsx); +} +#endif + +#if defined __GNUC__ && __GNUC__ >= 2 +/* Swap bytes in 64 bit value. */ +# define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56)) + +# define __bswap_64(x) \ + (__extension__ \ + ({ union { __extension__ unsigned long long int __ll; \ + unsigned int __l[2]; } __w, __r; \ + if (__builtin_constant_p (x)) \ + __r.__ll = __bswap_constant_64 (x); \ + else \ + { \ + __w.__ll = (x); \ + __r.__l[0] = __bswap_32 (__w.__l[1]); \ + __r.__l[1] = __bswap_32 (__w.__l[0]); \ + } \ + __r.__ll; })) +#endif + +#endif /* _BITS_BYTESWAP_H */ diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h index 544e2145b..cb86c8a90 100644 --- a/libc/sysdeps/linux/bfin/bits/fcntl.h +++ b/libc/sysdeps/linux/bfin/bits/fcntl.h @@ -96,6 +96,8 @@ # define F_SETLEASE 1024 /* Set a lease. */ # define F_GETLEASE 1025 /* Enquire what lease is active. */ # define F_NOTIFY 1026 /* Request notfications on a directory. */ +# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with + close-on-exit set on new fd. */ #endif /* For F_[GET|SET]FL. */ @@ -182,7 +184,10 @@ struct flock64 # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + #ifdef __USE_GNU +#if 0 +/* Flags for SYNC_FILE_RANGE. */ # define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages in the range before performing the write. */ @@ -194,6 +199,15 @@ struct flock64 write. */ #endif +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +#endif + __BEGIN_DECLS #ifdef __USE_GNU @@ -207,21 +221,21 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) /* Selective file content synch'ing. */ extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, unsigned int __flags); - +#endif /* Splice address range into a pipe. */ -extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count, - unsigned int __flags); +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); /* Splice two files together. */ -extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags) - __THROW; +extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, + unsigned int __flags); /* In-kernel implementation of tee for pipe buffers. */ -extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags) - __THROW; -#endif +extern ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); #endif - __END_DECLS + diff --git a/libc/sysdeps/linux/bfin/bits/kernel_types.h b/libc/sysdeps/linux/bfin/bits/kernel_types.h index 702a5f03a..d69a875d4 100644 --- a/libc/sysdeps/linux/bfin/bits/kernel_types.h +++ b/libc/sysdeps/linux/bfin/bits/kernel_types.h @@ -13,9 +13,9 @@ typedef unsigned short __kernel_mode_t; typedef unsigned short __kernel_nlink_t; typedef long __kernel_off_t; typedef int __kernel_pid_t; -typedef unsigned short __kernel_ipc_pid_t; -typedef unsigned short __kernel_uid_t; -typedef unsigned short __kernel_gid_t; +typedef unsigned int __kernel_ipc_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index d1d904c1c..0833a1fc1 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -39,12 +39,10 @@ do { \ type name(void) { \ long __res; \ __asm__ __volatile__ ( \ - "p0 = %1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name) \ - : "memory","CC","R0","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -52,14 +50,11 @@ type name(void) { \ type name(type1 arg1) { \ long __res; \ __asm__ __volatile__ ( \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)) \ - : "memory","CC","R0","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -67,16 +62,13 @@ type name(type1 arg1) { \ type name(type1 arg1,type2 arg2) { \ long __res; \ __asm__ __volatile__ ( \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)) \ - : "memory","CC","R0","R1","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -84,18 +76,13 @@ type name(type1 arg1,type2 arg2) { \ type name(type1 arg1,type2 arg2,type3 arg3) { \ long __res; \ __asm__ __volatile__ ( \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)) \ - : "memory","CC","R0","R1","R2","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -103,20 +90,14 @@ type name(type1 arg1,type2 arg2,type3 arg3) { \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ long __res; \ __asm__ __volatile__ ( \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)) \ - : "memory","CC","R0","R1","R2","R3","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)), \ + "q3" ((long)(arg4)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -124,22 +105,15 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ long __res; \ __asm__ __volatile__ ( \ - "r4=%6;\n\t" \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "P0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)), \ - "rm" ((long)(arg5)) \ - : "memory","CC","R0","R1","R2","R3","R4","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)), \ + "q3" ((long)(arg4)), \ + "q4" ((long)(arg5)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } @@ -147,24 +121,16 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ long __res; \ __asm__ __volatile__ ( \ - "r5=%7;\n\t" \ - "r4=%6;\n\t" \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "P0=%1;\n\t" \ "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)), \ - "rm" ((long)(arg5)), \ - "rm" ((long)(arg6)) \ - : "memory","CC","R0","R1","R2","R3","R4","R5","P0"); \ + : "=q0" (__res) \ + : "qA" (__NR_##name), \ + "q0" ((long)(arg1)), \ + "q1" ((long)(arg2)), \ + "q2" ((long)(arg3)), \ + "q3" ((long)(arg4)), \ + "q4" ((long)(arg5)), \ + "q5" ((long)(arg6)) \ + : "memory","CC"); \ __syscall_return(type,__res); \ } diff --git a/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h index a9140ee7e..39e71c918 100644 --- a/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h @@ -18,9 +18,6 @@ /* does your target have a broken create_module() ? */ #undef __UCLIBC_BROKEN_CREATE_MODULE__ -/* does your target prefix all symbols with an _ ? */ -#undef __UCLIBC_NO_UNDERSCORES__ - /* does your target have an asm .set ? */ #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ diff --git a/libc/sysdeps/linux/bfin/brk.c b/libc/sysdeps/linux/bfin/brk.c index 620c0b683..64480453e 100644 --- a/libc/sysdeps/linux/bfin/brk.c +++ b/libc/sysdeps/linux/bfin/brk.c @@ -19,11 +19,9 @@ int brk (void *addr) __asm__ __volatile__( "P0 = %2;\n\t" - "R0 = %1;\n\t" "excpt 0;\n\t" - "%0 = R0;\n\t" - : "=r"(newbrk) - : "r"(addr), "i" (__NR_brk): "P0" ); + : "=q0" (newbrk) + : "q0" (addr), "i" (__NR_brk): "P0" ); __curbrk = newbrk; diff --git a/libc/sysdeps/linux/bfin/bsd-_setjmp.S b/libc/sysdeps/linux/bfin/bsd-_setjmp.S index e2338d6cc..8ca2bbec9 100644 --- a/libc/sysdeps/linux/bfin/bsd-_setjmp.S +++ b/libc/sysdeps/linux/bfin/bsd-_setjmp.S @@ -90,7 +90,8 @@ __setjmp: R0 = RETS; [P0 + 0x9C] = R0; - R0 = 0; + R0 = [P0 + 0x20]; + R1 = 0; + JUMP.L ___sigjmp_save; - RTS; .size __setjmp,.-__setjmp diff --git a/libc/sysdeps/linux/bfin/clone.c b/libc/sysdeps/linux/bfin/clone.c index 0ba1d5a4a..899738e2d 100644 --- a/libc/sysdeps/linux/bfin/clone.c +++ b/libc/sysdeps/linux/bfin/clone.c @@ -19,11 +19,7 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) #ifdef __BFIN_FDPIC__ __asm__ __volatile__ ( - "r1 = %2;" - "r0 = %3;" - "P0 = %1;" "excpt 0;" /*Call sys_clone*/ - "%0 = r0;" "cc = r0 == 0;" "if !cc jump .Lxxx;" /* if (rval != 0) skip to parent */ "r0 = %4;" @@ -35,16 +31,12 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) "p0 = %6;" "excpt 0;" /* Call sys_exit */ ".Lxxx: nop;" - : "=d" (rval) - : "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) - : "CC", "R0", "R1", "P0"); + : "=q0" (rval) + : "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) + : "CC"); #else __asm__ __volatile__ ( - "r1 = %2;" - "r0 = %3;" - "P0 = %1;" "excpt 0;" /*Call sys_clone*/ - "%0 = r0;" "cc = r0 == 0;" "if !cc jump .Lxxx;" /* if (rval != 0) skip to parent */ "r0 = %4;" @@ -54,9 +46,9 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) "p0 = %6;" "excpt 0;" /* Call sys_exit */ ".Lxxx: nop;" - : "=d" (rval) - : "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) - : "CC", "R0", "R1", "P0"); + : "=q0" (rval) + : "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit) + : "CC"); #endif } else { diff --git a/libc/sysdeps/linux/bfin/crt1.S b/libc/sysdeps/linux/bfin/crt1.S index 156654437..38e68c9ac 100644 --- a/libc/sysdeps/linux/bfin/crt1.S +++ b/libc/sysdeps/linux/bfin/crt1.S @@ -34,7 +34,12 @@ Cambridge, MA 02139, USA. */ #include <features.h> -#ifndef L_Scrt1 +#undef USE_GOT +#if defined (__UCLIBC_FORMAT_SHARED_FLAT__) || defined (__UCLIBC_FORMAT_FLAT_SEP_DATA__) +#define USE_GOT +#endif + +#if !(defined L_Scrt1 && defined __UCLIBC_FORMAT_SHARED_FLAT__) .text .align 2 @@ -53,7 +58,7 @@ Cambridge, MA 02139, USA. */ __start: -#if defined(__BFIN_FDPIC__) && !defined(__pie__) +#if defined(__BFIN_FDPIC__) && !defined(L_Scrt1) /* P0 contains a pointer to the program's load map. */ call .Lcall; .Lcall: @@ -108,7 +113,7 @@ __start: #ifdef __BFIN_FDPIC__ R3 = [P3 + __init@FUNCDESC_GOT17M4]; -#elif defined __ID_SHARED_LIB__ +#elif defined USE_GOT P5 = [P5 + _current_shared_library_p5_offset_]; R3 = [P5 + ___shared_flat_init@GOT]; #else @@ -120,7 +125,7 @@ __start: #ifdef __BFIN_FDPIC__ R3 = [P3 + __fini@FUNCDESC_GOT17M4]; -#elif defined __ID_SHARED_LIB__ +#elif defined USE_GOT R3 = [P5 + ___shared_flat_fini@GOT]; #else R3.H = __fini; @@ -135,13 +140,13 @@ __start: #ifdef __BFIN_FDPIC__ R0 = [P3 + _main@FUNCDESC_GOT17M4]; -#elif defined __ID_SHARED_LIB__ +#elif defined USE_GOT R0 = [P5 + _main@GOT]; #else R0.H = _main; R0.L = _main; #endif -#ifdef __ID_SHARED_LIB__ +#ifdef USE_GOT P0 = [P5 + ___uClibc_main@GOT]; jump (P0) #else diff --git a/libc/sysdeps/linux/bfin/crtreloc.c b/libc/sysdeps/linux/bfin/crtreloc.c index afc9504ce..4c09f904f 100644 --- a/libc/sysdeps/linux/bfin/crtreloc.c +++ b/libc/sysdeps/linux/bfin/crtreloc.c @@ -47,32 +47,35 @@ reloc_range_indirect (void ***p, void ***e, { while (p < e) { - void *ptr = __reloc_pointer (*p, map); - if (ptr) + if (*p != (void **)-1) { - void *pt; - if ((long)ptr & 3) + void *ptr = __reloc_pointer (*p, map); + if (ptr != (void *)-1) { - unsigned char *c = ptr; - int i; - unsigned long v = 0; - for (i = 0; i < 4; i++) - v |= c[i] << 8 * i; - pt = (void *)v; + void *pt; + if ((long)ptr & 3) + { + unsigned char *c = ptr; + int i; + unsigned long v = 0; + for (i = 0; i < 4; i++) + v |= c[i] << 8 * i; + pt = (void *)v; + } + else + pt = *(void**)ptr; + pt = __reloc_pointer (pt, map); + if ((long)ptr & 3) + { + unsigned char *c = ptr; + int i; + unsigned long v = (unsigned long)pt; + for (i = 0; i < 4; i++, v >>= 8) + c[i] = v; + } + else + *(void**)ptr = pt; } - else - pt = *(void**)ptr; - pt = __reloc_pointer (pt, map); - if ((long)ptr & 3) - { - unsigned char *c = ptr; - int i; - unsigned long v = (unsigned long)pt; - for (i = 0; i < 4; i++, v >>= 8) - c[i] = v; - } - else - *(void**)ptr = pt; } p++; } diff --git a/libc/sysdeps/linux/bfin/dma-memcpy.c b/libc/sysdeps/linux/bfin/dma-memcpy.c new file mode 100644 index 000000000..6d7a5b855 --- /dev/null +++ b/libc/sysdeps/linux/bfin/dma-memcpy.c @@ -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 index 000000000..f0e8bce65 --- /dev/null +++ b/libc/sysdeps/linux/bfin/sram-alloc.c @@ -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 index 000000000..02bf5d52e --- /dev/null +++ b/libc/sysdeps/linux/bfin/sram-free.c @@ -0,0 +1,6 @@ +#include <unistd.h> +#include <errno.h> +#include <sys/syscall.h> + +_syscall1 (__ptr_t, sram_free, __ptr_t, addr); + diff --git a/libc/sysdeps/linux/bfin/sys/procfs.h b/libc/sysdeps/linux/bfin/sys/procfs.h index a656d86b2..45a65f391 100644 --- a/libc/sysdeps/linux/bfin/sys/procfs.h +++ b/libc/sysdeps/linux/bfin/sys/procfs.h @@ -45,8 +45,8 @@ typedef unsigned long elf_greg_t; #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -/* Register set for the floating-point registers. */ -typedef struct user_bfinfp_struct elf_fpregset_t; +/* Register set for the floating-point registers. Empty on the Blackfin. */ +typedef struct { } elf_fpregset_t; /* Signal info. */ struct elf_siginfo diff --git a/libc/sysdeps/linux/bfin/sys/ucontext.h b/libc/sysdeps/linux/bfin/sys/ucontext.h index 0e16788c5..ac2ef94e2 100644 --- a/libc/sysdeps/linux/bfin/sys/ucontext.h +++ b/libc/sysdeps/linux/bfin/sys/ucontext.h @@ -109,7 +109,7 @@ enum REG_L3 = 35, #define REG_L3 REG_L3 REG_B_0 = 36, -#define REG_B_0 REG_B_0 +#define REG_B0 REG_B0 REG_B1 = 37, #define REG_B1 REG_B1 REG_B2 = 38, @@ -135,7 +135,6 @@ enum /* Context to describe whole processor state. */ typedef struct { - int version; gregset_t gregs; } mcontext_t; diff --git a/libc/sysdeps/linux/bfin/sysdep.h b/libc/sysdeps/linux/bfin/sysdep.h new file mode 100644 index 000000000..4080c22a4 --- /dev/null +++ b/libc/sysdeps/linux/bfin/sysdep.h @@ -0,0 +1,20 @@ +/* + * libc/sysdeps/linux/bfin/sysdep.h + * + * Copyright (C) 2007 Analog Devices Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#ifndef __BFIN_SYSDEP_H__ +#define __BFIN_SYSDEP_H__ + +#include <features.h> + +#ifdef __ASSEMBLER__ + +#define ENTRY(sym) .global sym; .type sym, STT_FUNC; sym: + +#endif + +#endif |