Commit c1b3b6ca authored by Peter Korsgaard's avatar Peter Korsgaard
Browse files

toolchain/uclibc: xtensa patches



New files missing from 58050c28.

Signed-off-by: default avatarMaxim Grigoriev <maxim2405@gmail.com>
Signed-off-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
parent f91315e1
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
--- uClibc-0.9.29-orig/libc/sysdeps/linux/xtensa/sys/procfs.h	2007-11-16 23:21:00.000000000 -0800
+++ uClibc-0.9.29/libc/sysdeps/linux/xtensa/sys/procfs.h	2007-11-16 23:26:59.000000000 -0800
@@ -32,19 +32,11 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/user.h>
+#include <asm/elf.h>
 
 __BEGIN_DECLS
 
-/* Type for a general-purpose register.  */
-typedef unsigned long elf_greg_t;
-
-#define ELF_NGREG 128
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-/* Register set for the floating-point registers.  */
-#define ELF_NFPREG 18
-typedef unsigned long elf_fpreg_t;
-typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+/* Note: we get elf_gregset_t and elf_fpregset_t from <asm/elf.h>.  */
 
 /* Signal info.  */
 struct elf_siginfo
+45 −0
Original line number Diff line number Diff line
diff -u /dev/null uClibc-0.9.30/libc/sysdeps/linux/xtensa/bits/sigcontext.h
--- /dev/null
+++ uClibc-0.9.30/libc/sysdeps/linux/xtensa/bits/sigcontext.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2006, 2007, 2008, 2009 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., 51 Franklin Street - Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+#ifndef _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
+struct sigcontext
+{
+  unsigned long sc_pc;
+  unsigned long sc_ps;
+  unsigned long sc_lbeg;
+  unsigned long sc_lend;
+  unsigned long sc_lcount;
+  unsigned long sc_sar;
+  unsigned long sc_acclo;
+  unsigned long sc_acchi;
+  void *sc_xtregs;
+  unsigned long sc_a[16];
+};
+
+#endif /* _BITS_SIGCONTEXT_H */
+
+59 −0
Original line number Diff line number Diff line
--- uClibc-0.9.29/libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h.orig	2008-09-12 09:51:50.000000000 -0700
+++ uClibc-0.9.29/libpthread/linuxthreads.old/sysdeps/xtensa/pt-machine.h	2008-10-04 12:14:57.000000000 -0700
@@ -26,19 +26,51 @@
 #include <asm/unistd.h>
 
 #ifndef PT_EI
-# define PT_EI __extern_always_inline
+# define PT_EI extern inline __attribute__ ((gnu_inline))
 #endif
 
-/* Memory barrier.  */
 #define MEMORY_BARRIER() __asm__ ("memw" : : : "memory")
+#define HAS_COMPARE_AND_SWAP
+
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
 
 /* Spinlock implementation; required.  */
 PT_EI long int
 testandset (int *spinlock)
 {
-  int unused = 0;
-  return INTERNAL_SYSCALL (xtensa, , 4, SYS_XTENSA_ATOMIC_SET,
-			   spinlock, 1, unused);
+	unsigned long tmp;
+	__asm__ volatile (
+"	movi	%0, 0			\n"
+"	wsr	%0, SCOMPARE1		\n"
+"	movi	%0, 1			\n"
+"	s32c1i	%0, %1, 0		\n"
+	: "=&a" (tmp)
+	: "a" (spinlock)
+	: "memory"
+	);
+	return tmp;
+}
+
+PT_EI int
+__compare_and_swap (long int *p, long int oldval, long int newval)
+{
+        unsigned long tmp;
+        unsigned long value;
+        __asm__ volatile (
+"1:     l32i    %0, %2, 0            \n"
+"       bne     %0, %4, 2f           \n"
+"       wsr     %0, SCOMPARE1        \n"
+"       mov     %1, %0               \n"
+"       mov     %0, %3               \n"
+"       s32c1i  %0, %2, 0            \n"
+"       bne     %1, %0, 1b           \n"
+"2:                                  \n"
+          : "=&a" (tmp), "=&a" (value)
+          : "a" (p), "a" (newval), "a" (oldval)
+          : "memory" );
+
+        return tmp == oldval;
 }
 
 /* Get some notion of the current stack.  Need not be exactly the top
+11 −0
Original line number Diff line number Diff line
--- a/libc/sysdeps/linux/xtensa/sigaction.c	2008-09-23 21:11:02.000000000 -0700
+++ b/libc/sysdeps/linux/xtensa/sigaction.c	2008-09-23 21:12:31.000000000 -0700
@@ -17,6 +17,8 @@
 
 #define SA_RESTORER	0x04000000	
 
+extern __typeof(sigaction) __libc_sigaction;
+
 extern void __default_sa_restorer (void);
 
 libc_hidden_proto(memcpy)
+19 −0
Original line number Diff line number Diff line
--- a/libc/sysdeps/linux/xtensa/sysdep.h	2008-09-23 21:17:42.000000000 -0700
+++ b/libc/sysdeps/linux/xtensa/sysdep.h	2008-09-23 21:17:59.000000000 -0700
@@ -114,15 +114,7 @@
 
 #define ret_ERRVAL retw
 
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						      \
-0:	movi	a4, rtld_errno;						      \
-	neg	a2, a2;							      \
-	s32i	a2, a4, 0;						      \
-	movi	a2, -1;							      \
-	j	.Lpseudo_end;
-
-#elif defined _LIBC_REENTRANT
+#if defined _LIBC_REENTRANT
 
 # if USE___THREAD
 #  ifndef NOT_IN_libc
Loading