summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/avr32
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/avr32')
-rw-r--r--libc/sysdeps/linux/avr32/Makefile3
-rw-r--r--libc/sysdeps/linux/avr32/Makefile.arch6
-rw-r--r--libc/sysdeps/linux/avr32/bits/atomic.h1
-rw-r--r--libc/sysdeps/linux/avr32/bits/byteswap.h70
-rw-r--r--libc/sysdeps/linux/avr32/bits/fcntl.h7
-rw-r--r--libc/sysdeps/linux/avr32/bits/kernel_stat.h26
-rw-r--r--libc/sysdeps/linux/avr32/bits/kernel_types.h2
-rw-r--r--libc/sysdeps/linux/avr32/bits/mman.h103
-rw-r--r--libc/sysdeps/linux/avr32/bits/setjmp.h9
-rw-r--r--libc/sysdeps/linux/avr32/bits/stackinfo.h5
-rw-r--r--libc/sysdeps/linux/avr32/bits/syscalls.h128
-rw-r--r--libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h14
-rw-r--r--libc/sysdeps/linux/avr32/brk.c1
-rw-r--r--libc/sysdeps/linux/avr32/clone.c3
-rw-r--r--libc/sysdeps/linux/avr32/crtn.S2
-rw-r--r--libc/sysdeps/linux/avr32/jmpbuf-offsets.h9
-rw-r--r--libc/sysdeps/linux/avr32/jmpbuf-unwind.h14
-rw-r--r--libc/sysdeps/linux/avr32/mmap.c7
-rw-r--r--libc/sysdeps/linux/avr32/prctl.c36
-rw-r--r--libc/sysdeps/linux/avr32/setjmp.S3
-rw-r--r--libc/sysdeps/linux/avr32/sigaction.c45
-rw-r--r--libc/sysdeps/linux/avr32/sys/elf.h5
-rw-r--r--libc/sysdeps/linux/avr32/sys/procfs.h5
-rw-r--r--libc/sysdeps/linux/avr32/sys/ucontext.h5
-rw-r--r--libc/sysdeps/linux/avr32/vfork.S4
25 files changed, 135 insertions, 378 deletions
diff --git a/libc/sysdeps/linux/avr32/Makefile b/libc/sysdeps/linux/avr32/Makefile
index 338abc086..4fa4bb107 100644
--- a/libc/sysdeps/linux/avr32/Makefile
+++ b/libc/sysdeps/linux/avr32/Makefile
@@ -13,8 +13,7 @@
# details.
#
# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
top_srcdir=../../../../
top_builddir=../../../../
diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch
index 44fc01ebf..9bc6a64d6 100644
--- a/libc/sysdeps/linux/avr32/Makefile.arch
+++ b/libc/sysdeps/linux/avr32/Makefile.arch
@@ -5,9 +5,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := brk.c clone.c mmap.c sigaction.c
+CSRC-y := brk.c clone.c mmap.c prctl.c sigaction.c
-SSRC := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
sigrestorer.S syscall.S vfork.S
-
-include $(top_srcdir)/libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/avr32/bits/atomic.h b/libc/sysdeps/linux/avr32/bits/atomic.h
index e6be41f01..3bc2aeefc 100644
--- a/libc/sysdeps/linux/avr32/bits/atomic.h
+++ b/libc/sysdeps/linux/avr32/bits/atomic.h
@@ -28,6 +28,7 @@ typedef uintmax_t uatomic_max_t;
#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
({ \
+ __uint32_t __result; \
__typeof__(*(mem)) __prev; \
__asm__ __volatile__( \
"/* __arch_compare_and_exchange_val_32_acq */\n" \
diff --git a/libc/sysdeps/linux/avr32/bits/byteswap.h b/libc/sysdeps/linux/avr32/bits/byteswap.h
deleted file mode 100644
index f0bea4cea..000000000
--- a/libc/sysdeps/linux/avr32/bits/byteswap.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2005 Atmel Corporation
- *
- * This file is subject to the terms and conditions of the GNU Lesser General
- * Public License. See the file "COPYING.LIB" in the main directory of this
- * archive for more details.
- */
-
-#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. */
-#if defined __GNUC__
-# define __bswap_16(x) (__extension__ __builtin_bswap_16(x))
-#else
-/* This is better than nothing. */
-static __inline__ unsigned short int
-__bswap_16 (unsigned short int __bsx)
-{
- return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
-}
-#endif
-
-/* Swap bytes in 32 bit value. */
-#if defined __GNUC__
-# define __bswap_32(x) (__extension__ __builtin_bswap_32(x))
-#else
-static __inline__ unsigned int
-__bswap_32 (unsigned int __bsx)
-{
- return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
- (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
-}
-#endif
-
-#if defined __GNUC__
-/* 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/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
index 6dcb61ba7..5e325122d 100644
--- a/libc/sysdeps/linux/avr32/bits/fcntl.h
+++ b/libc/sysdeps/linux/avr32/bits/fcntl.h
@@ -30,6 +30,8 @@
# define O_DIRECTORY 00200000 /* direct disk access */
# define O_NOFOLLOW 00400000 /* don't follow links */
# define O_NOATIME 01000000 /* don't set atime */
+# define O_CLOEXEC 02000000 /* set close_on_exec */
+# define O_PATH 010000000 /* Resolve pathname but do not open file. */
#endif
#ifdef __USE_LARGEFILE64
@@ -167,8 +169,8 @@ struct flock64 {
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
-#ifdef __USE_GNU
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing
@@ -190,6 +192,9 @@ struct flock64 {
__BEGIN_DECLS
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW;
+
/* Selective file content synch'ing */
extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
unsigned int __flags);
diff --git a/libc/sysdeps/linux/avr32/bits/kernel_stat.h b/libc/sysdeps/linux/avr32/bits/kernel_stat.h
index f97d23bc5..d98c6cfef 100644
--- a/libc/sysdeps/linux/avr32/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/avr32/bits/kernel_stat.h
@@ -1,10 +1,6 @@
#ifndef _BITS_STAT_STRUCT_H
#define _BITS_STAT_STRUCT_H
-#ifndef _LIBC
-#error bits/kernel_stat.h is for internal uClibc use only!
-#endif
-
/*
* This file provides struct stat, taken from kernel 2.6.4. Verified
* to match kernel 2.6.22.
@@ -21,18 +17,13 @@ struct kernel_stat {
unsigned long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
- unsigned long st_atime;
- unsigned long st_atime_nsec;
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
unsigned long __unused4;
unsigned long __unused5;
};
-#define STAT_HAVE_NSEC 1
-
struct kernel_stat64 {
unsigned long long st_dev;
@@ -51,14 +42,9 @@ struct kernel_stat64 {
unsigned long long st_blocks;
- unsigned long st_atime;
- unsigned long st_atime_nsec;
-
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
-
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
unsigned long __unused1;
unsigned long __unused2;
diff --git a/libc/sysdeps/linux/avr32/bits/kernel_types.h b/libc/sysdeps/linux/avr32/bits/kernel_types.h
index f7d8b5298..c551d5785 100644
--- a/libc/sysdeps/linux/avr32/bits/kernel_types.h
+++ b/libc/sysdeps/linux/avr32/bits/kernel_types.h
@@ -39,6 +39,8 @@ typedef unsigned int __kernel_gid32_t;
typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;
typedef unsigned short __kernel_old_dev_t;
+typedef long __kernel_long_t;
+typedef unsigned long __kernel_ulong_t;
#ifdef __GNUC__
typedef long long __kernel_loff_t;
diff --git a/libc/sysdeps/linux/avr32/bits/mman.h b/libc/sysdeps/linux/avr32/bits/mman.h
deleted file mode 100644
index 5f6e3c37a..000000000
--- a/libc/sysdeps/linux/avr32/bits/mman.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Definitions for POSIX memory map interface. Linux/AVR32 version.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _SYS_MMAN_H
-# error "Never include this file directly. Use <sys/mman.h> instead"
-#endif
-
-/* The following definitions basically come from the kernel headers.
- But the kernel header is not namespace clean. */
-
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific. */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
-# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
-# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
-# define MAP_LOCKED 0x2000 /* Lock the mapping. */
-# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
-# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
-# define MAP_NONBLOCK 0x10000 /* do not block on IO */
-#endif
-
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
-#endif
-
-/* Advise to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
-#endif
-
-/* The POSIX people had to invent similar names for the same things. */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
diff --git a/libc/sysdeps/linux/avr32/bits/setjmp.h b/libc/sysdeps/linux/avr32/bits/setjmp.h
index 78348a329..3f8f14f2d 100644
--- a/libc/sysdeps/linux/avr32/bits/setjmp.h
+++ b/libc/sysdeps/linux/avr32/bits/setjmp.h
@@ -12,19 +12,10 @@
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
-#ifndef _ASM
/*
* The jump buffer contains r0-r7, sr, sp and lr. Other registers are
* not saved.
*/
typedef int __jmp_buf[11];
-#endif
-
-#define __JMP_BUF_SP 4
-
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
- variable at ADDRESS. */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
- ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
#endif /* _BITS_SETJMP_H */
diff --git a/libc/sysdeps/linux/avr32/bits/stackinfo.h b/libc/sysdeps/linux/avr32/bits/stackinfo.h
index 2c17d30a7..9e912452e 100644
--- a/libc/sysdeps/linux/avr32/bits/stackinfo.h
+++ b/libc/sysdeps/linux/avr32/bits/stackinfo.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* This file contains a bit of information about the stack allocation
of the processor. */
diff --git a/libc/sysdeps/linux/avr32/bits/syscalls.h b/libc/sysdeps/linux/avr32/bits/syscalls.h
index ff5d1a7be..70dc1d958 100644
--- a/libc/sysdeps/linux/avr32/bits/syscalls.h
+++ b/libc/sysdeps/linux/avr32/bits/syscalls.h
@@ -4,140 +4,52 @@
# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
#endif
-/*
- * This includes the `__NR_<name>' syscall numbers taken from the
- * Linux kernel header files. It also defines the traditional
- * `SYS_<name>' macros for older programs.
- */
-#include <bits/sysnum.h>
-
#ifndef __ASSEMBLER__
#include <errno.h>
-#define SYS_ify(syscall_name) (__NR_##syscall_name)
-
-#undef _syscall0
-#define _syscall0(type,name) \
- type name(void) \
- { \
- return (type)(INLINE_SYSCALL(name, 0)); \
- }
-
-#undef _syscall1
-#define _syscall1(type,name,type1,arg1) \
- type name(type1 arg1) \
- { \
- return (type)(INLINE_SYSCALL(name, 1, arg1)); \
- }
-
-#undef _syscall2
-#define _syscall2(type,name,type1,arg1,type2,arg2) \
- type name(type1 arg1, type2 arg2) \
- { \
- return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
- }
-
-#undef _syscall3
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
- type name(type1 arg1, type2 arg2, type3 arg3) \
- { \
- return (type)(INLINE_SYSCALL(name, 3, arg1, \
- arg2, arg3)); \
- }
-
-#undef _syscall4
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
- type4,arg4) \
- type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
- { \
- return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
- arg3, arg4)); \
- }
-
-#undef _syscall5
-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
- type4,arg4,type5,arg5) \
- type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
- type5 arg5) \
- { \
- return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
- arg3, arg4, arg5)); \
- }
-
-#undef _syscall6
-#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
- type4,arg4,type5,arg5,type6,arg6) \
- type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
- type5 arg5, type6 arg6) \
- { \
- return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
- arg4, arg5, arg6)); \
- }
-
-#undef unlikely
-#define unlikely(x) __builtin_expect((x), 0)
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
- unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
- if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
- __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
- _sys_result = (unsigned int) -1; \
- } \
- (int) _sys_result; \
- })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- ({ \
- register int _a1 __asm__("r12"); \
- register int _scno __asm__("r8") = SYS_ify(name); \
+ register int __a1 __asm__("r12"); \
+ register int _scno __asm__("r8") = name; \
LOAD_ARGS_##nr (args); \
__asm__ __volatile__("scall /* syscall " #name " */" \
- : "=r" (_a1) \
+ : "=r" (__a1) \
: "r"(_scno) ASM_ARGS_##nr \
: "cc", "memory"); \
- _a1; \
- })
-
-#undef INTERNAL_SYSCALL_ERROR_P
+ __a1; \
+ }) \
+)
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int)(val) >= 0xfffff001U)
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
-
#define LOAD_ARGS_0() do { } while(0)
#define ASM_ARGS_0
#define LOAD_ARGS_1(a1) \
- _a1 = (int) (a1); \
+ __a1 = (int) (a1); \
LOAD_ARGS_0()
-#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
+#define ASM_ARGS_1 ASM_ARGS_0, "r"(__a1)
#define LOAD_ARGS_2(a1, a2) \
- register int _a2 __asm__("r11") = (int)(a2); \
+ register int __a2 __asm__("r11") = (int)(a2); \
LOAD_ARGS_1(a1)
-#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
+#define ASM_ARGS_2 ASM_ARGS_1, "r"(__a2)
#define LOAD_ARGS_3(a1, a2, a3) \
- register int _a3 __asm__("r10") = (int)(a3); \
+ register int __a3 __asm__("r10") = (int)(a3); \
LOAD_ARGS_2(a1, a2)
-#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
+#define ASM_ARGS_3 ASM_ARGS_2, "r"(__a3)
#define LOAD_ARGS_4(a1, a2, a3, a4) \
- register int _a4 __asm__("r9") = (int)(a4); \
+ register int __a4 __asm__("r9") = (int)(a4); \
LOAD_ARGS_3(a1, a2, a3)
-#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
+#define ASM_ARGS_4 ASM_ARGS_3, "r"(__a4)
#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
- register int _a5 __asm__("r5") = (int)(a5); \
+ register int __a5 __asm__("r5") = (int)(a5); \
LOAD_ARGS_4(a1, a2, a3, a4)
-#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
+#define ASM_ARGS_5 ASM_ARGS_4, "r"(__a5)
#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
- register int _a6 __asm__("r3") = (int)(a6); \
+ register int __a6 __asm__("r3") = (int)(a6); \
LOAD_ARGS_5(a1, a2, a3, a4, a5)
-#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
+#define ASM_ARGS_6 ASM_ARGS_5, "r"(__a6)
#endif /* __ASSEMBLER__ */
#endif /* _BITS_SYSCALLS_H */
diff --git a/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h b/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h
index 679be3038..cb0eae804 100644
--- a/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h
@@ -12,8 +12,8 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use syscall4() for truncate64 ? (32bit arches only) */
-#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
+/* does your target align 64bit values in register pairs ? (32bit arches only) */
+#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
@@ -24,19 +24,19 @@
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
-/* define if target doesn't like .global */
-#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
-
/* define if target supports .weak */
#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
/* define if target supports .weakext */
#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
-/* needed probably only for ppc64 */
-#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
+/* define if target supports CFI pseudo ops */
+#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__
/* define if target supports IEEE signed zero floats */
#define __UCLIBC_HAVE_SIGNED_ZERO__
+/* only weird assemblers generally need this */
+#undef __UCLIBC_ASM_LINE_SEP__
+
#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/avr32/brk.c b/libc/sysdeps/linux/avr32/brk.c
index a54b49a61..58f04f95d 100644
--- a/libc/sysdeps/linux/avr32/brk.c
+++ b/libc/sysdeps/linux/avr32/brk.c
@@ -9,7 +9,6 @@
#include <unistd.h>
#include <sys/syscall.h>
-libc_hidden_proto(brk)
void *__curbrk attribute_hidden = 0;
diff --git a/libc/sysdeps/linux/avr32/clone.c b/libc/sysdeps/linux/avr32/clone.c
index e43b0f3bf..06e3388b8 100644
--- a/libc/sysdeps/linux/avr32/clone.c
+++ b/libc/sysdeps/linux/avr32/clone.c
@@ -5,6 +5,7 @@
* Public License. See the file "COPYING.LIB" in the main directory of this
* archive for more details.
*/
+#include <sched.h>
#include <errno.h>
#include <sys/syscall.h>
#include <unistd.h>
@@ -14,7 +15,7 @@
* parameters are preserved when returning as the child. If the
* compiler stores them in registers (r0-r7), they should be.
*/
-int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg)
+int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
{
register int (*_fn)(void *arg) = fn;
register void *_arg = arg;
diff --git a/libc/sysdeps/linux/avr32/crtn.S b/libc/sysdeps/linux/avr32/crtn.S
index f7d104070..c37f7d201 100644
--- a/libc/sysdeps/linux/avr32/crtn.S
+++ b/libc/sysdeps/linux/avr32/crtn.S
@@ -4,11 +4,9 @@
.global _init
.type _init, @function
ldm sp++, r6, pc
- .size _init, . - _init
.section .fini
.align 2
.global _fini
.type _fini, @function
ldm sp++, r6, pc
- .size _fini, . - _fini
diff --git a/libc/sysdeps/linux/avr32/jmpbuf-offsets.h b/libc/sysdeps/linux/avr32/jmpbuf-offsets.h
new file mode 100644
index 000000000..70b8113e3
--- /dev/null
+++ b/libc/sysdeps/linux/avr32/jmpbuf-offsets.h
@@ -0,0 +1,9 @@
+/* Private macros for accessing __jmp_buf contents. avr32 version.
+ * Copyright (C) 2004-2005 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#define __JMP_BUF_SP 4
diff --git a/libc/sysdeps/linux/avr32/jmpbuf-unwind.h b/libc/sysdeps/linux/avr32/jmpbuf-unwind.h
new file mode 100644
index 000000000..5caa2ee44
--- /dev/null
+++ b/libc/sysdeps/linux/avr32/jmpbuf-unwind.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2004-2005 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+ variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+ ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
diff --git a/libc/sysdeps/linux/avr32/mmap.c b/libc/sysdeps/linux/avr32/mmap.c
index 2ee025a26..cd3315810 100644
--- a/libc/sysdeps/linux/avr32/mmap.c
+++ b/libc/sysdeps/linux/avr32/mmap.c
@@ -11,12 +11,11 @@
#include <sys/mman.h>
#include <sys/syscall.h>
-libc_hidden_proto(mmap)
-static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot,
- int, flags, int, fd, __off_t, pgoff);
+static __inline__ _syscall6(void *, mmap2, void *, addr, size_t, len, int, prot,
+ int, flags, int, fd, __off_t, pgoff)
-__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
+void *mmap(void *addr, size_t len, int prot, int flags, int fd, __off_t offset)
{
unsigned long page_size = sysconf(_SC_PAGESIZE);
unsigned long pgoff;
diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c
new file mode 100644
index 000000000..4e146e35e
--- /dev/null
+++ b/libc/sysdeps/linux/avr32/prctl.c
@@ -0,0 +1,36 @@
+/*
+ * prctl syscall for AVR32 Linux.
+ *
+ * Copyright (C) 2010 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <sys/syscall.h>
+#include <sys/prctl.h>
+#include <stdarg.h>
+
+#ifdef __NR_prctl
+#define __NR___syscall_prctl __NR_prctl
+static inline _syscall5(int, __syscall_prctl, int, option, long, arg2,
+ long, arg3, long, arg4, long, arg5);
+
+int prctl(int __option, ...)
+{
+ long arg2;
+ long arg3;
+ long arg4;
+ long arg5;
+ va_list ap;
+
+ va_start(ap, __option);
+ arg2 = va_arg(ap, long);
+ arg3 = va_arg(ap, long);
+ arg4 = va_arg(ap, long);
+ arg5 = va_arg(ap, long);
+ va_end(ap);
+
+ return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5);
+}
+#endif
diff --git a/libc/sysdeps/linux/avr32/setjmp.S b/libc/sysdeps/linux/avr32/setjmp.S
index 7d0354be9..f6e619b90 100644
--- a/libc/sysdeps/linux/avr32/setjmp.S
+++ b/libc/sysdeps/linux/avr32/setjmp.S
@@ -5,9 +5,6 @@
* Public License. See the file "COPYING.LIB" in the main directory of this
* archive for more details.
*/
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
.text
diff --git a/libc/sysdeps/linux/avr32/sigaction.c b/libc/sysdeps/linux/avr32/sigaction.c
index 6b6b3466c..f82d109df 100644
--- a/libc/sysdeps/linux/avr32/sigaction.c
+++ b/libc/sysdeps/linux/avr32/sigaction.c
@@ -14,46 +14,33 @@
#define SA_RESTORER 0x04000000
extern void __default_rt_sa_restorer(void);
-/* Experimentally off - libc_hidden_proto(memcpy) */
-
/*
* If act is not NULL, change the action for sig to *act.
* If oact is not NULL, put the old action for sig in *oact.
*/
-int __libc_sigaction(int signum, const struct sigaction *act,
- struct sigaction *oldact)
+int __libc_sigaction(int sig, const struct sigaction *act,
+ struct sigaction *oact)
{
- struct kernel_sigaction kact, koact;
- int result;
+ struct sigaction kact;
- if (act) {
- kact.k_sa_handler = act->sa_handler;
- memcpy(&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
- kact.sa_flags = act->sa_flags;
- if (kact.sa_flags & SA_RESTORER)
- kact.sa_restorer = act->sa_restorer;
- else
- kact.sa_restorer = __default_rt_sa_restorer;
+ if (act && !(act->sa_flags & SA_RESTORER)) {
+ memcpy(&kact, act, sizeof(kact));
+ kact.sa_restorer = __default_rt_sa_restorer;
kact.sa_flags |= SA_RESTORER;
+ act = &kact;
}
- result = __syscall_rt_sigaction(signum, act ? __ptrvalue(&kact) : NULL,
- oldact ? __ptrvalue(&koact) : NULL,
- _NSIG / 8);
-
- if (oldact && result >= 0) {
- oldact->sa_handler = koact.k_sa_handler;
- memcpy(&oldact->sa_mask, &koact.sa_mask,
- sizeof(oldact->sa_mask));
- oldact->sa_flags = koact.sa_flags;
- oldact->sa_restorer = koact.sa_restorer;
- }
-
- return result;
+ /* NB: kernel (as of 2.6.25) will return EINVAL
+ * if sizeof(act->sa_mask) does not match kernel's sizeof(sigset_t) */
+ return __syscall_rt_sigaction(sig, act, oact, sizeof(act->sa_mask));
}
#ifndef LIBC_SIGACTION
-libc_hidden_proto(sigaction)
-weak_alias(__libc_sigaction, sigaction)
+# ifndef __UCLIBC_HAS_THREADS__
+strong_alias(__libc_sigaction,sigaction)
+libc_hidden_def(sigaction)
+# else
+weak_alias(__libc_sigaction,sigaction)
libc_hidden_weak(sigaction)
+# endif
#endif
diff --git a/libc/sysdeps/linux/avr32/sys/elf.h b/libc/sysdeps/linux/avr32/sys/elf.h
index faa731068..4c06715da 100644
--- a/libc/sysdeps/linux/avr32/sys/elf.h
+++ b/libc/sysdeps/linux/avr32/sys/elf.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_ELF_H
#define _SYS_ELF_H 1
diff --git a/libc/sysdeps/linux/avr32/sys/procfs.h b/libc/sysdeps/linux/avr32/sys/procfs.h
index 3b3736324..14f233a63 100644
--- a/libc/sysdeps/linux/avr32/sys/procfs.h
+++ b/libc/sysdeps/linux/avr32/sys/procfs.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_PROCFS_H
#define _SYS_PROCFS_H 1
diff --git a/libc/sysdeps/linux/avr32/sys/ucontext.h b/libc/sysdeps/linux/avr32/sys/ucontext.h
index 82c7fe24a..66c846198 100644
--- a/libc/sysdeps/linux/avr32/sys/ucontext.h
+++ b/libc/sysdeps/linux/avr32/sys/ucontext.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Linux/AVR32 ABI compliant context switching support. */
diff --git a/libc/sysdeps/linux/avr32/vfork.S b/libc/sysdeps/linux/avr32/vfork.S
index 03ca99f65..b2c5ceb55 100644
--- a/libc/sysdeps/linux/avr32/vfork.S
+++ b/libc/sysdeps/linux/avr32/vfork.S
@@ -17,10 +17,10 @@
* Fortunately, the Linux kernel preserves LR across system calls.
*/
-#include <features.h>
#include <sys/syscall.h>
.global __vfork
+ .hidden __vfork
.type __vfork,@function
.align 1
__vfork:
@@ -55,4 +55,4 @@ __vfork:
.size __vfork, . - __vfork
weak_alias(__vfork,vfork)
-libc_hidden_weak(vfork)
+libc_hidden_def(vfork)