[Glibc-bsd-commits] r1685 - in trunk: . glibc-ports
glibc-ports/kfreebsd glibc-ports/kfreebsd/i386
glibc-ports/kfreebsd/i386/i486
glibc-ports/kfreebsd/i386/i486/linuxthreads
glibc-ports/kfreebsd/i386/i586
glibc-ports/kfreebsd/i386/i586/linuxthreads
glibc-ports/kfreebsd/i386/i686
glibc-ports/kfreebsd/i386/i686/linuxthreads
glibc-ports/kfreebsd/i386/linuxthreads
glibc-ports/kfreebsd/linuxthreads glibc-ports/kfreebsd/x86_64
Petr Salinger
ps-guest at costa.debian.org
Mon Oct 16 08:50:05 UTC 2006
Author: ps-guest
Date: 2006-10-16 08:50:05 +0000 (Mon, 16 Oct 2006)
New Revision: 1685
Added:
trunk/glibc-ports/
trunk/glibc-ports/kfreebsd/
trunk/glibc-ports/kfreebsd/i386/i486/
trunk/glibc-ports/kfreebsd/i386/i486/linuxthreads/
trunk/glibc-ports/kfreebsd/i386/i486/linuxthreads/pt-machine.h
trunk/glibc-ports/kfreebsd/i386/i586/
trunk/glibc-ports/kfreebsd/i386/i586/linuxthreads/
trunk/glibc-ports/kfreebsd/i386/i586/linuxthreads/pt-machine.h
trunk/glibc-ports/kfreebsd/i386/i686/
trunk/glibc-ports/kfreebsd/i386/i686/linuxthreads/
trunk/glibc-ports/kfreebsd/i386/i686/linuxthreads/pt-machine.h
trunk/glibc-ports/kfreebsd/i386/linuxthreads/
trunk/glibc-ports/kfreebsd/i386/linuxthreads/pt-machine.h
trunk/glibc-ports/kfreebsd/i386/linuxthreads/sysdep-cancel.h
trunk/glibc-ports/kfreebsd/i386/linuxthreads/tls.h
trunk/glibc-ports/kfreebsd/linuxthreads/
trunk/glibc-ports/kfreebsd/x86_64/linuxthreads/
Removed:
trunk/glibc-ports/kfreebsd/linuxthreads/i386/
trunk/glibc-ports/kfreebsd/linuxthreads/x86_64/
Log:
* add glibc-ports sysdeps for glibc 2.5
Copied: trunk/glibc-ports/kfreebsd (from rev 1684, trunk/glibc-2.3-head/sysdeps/kfreebsd)
Copied: trunk/glibc-ports/kfreebsd/i386/i486/linuxthreads/pt-machine.h (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/i486/pt-machine.h)
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/i486/linuxthreads/pt-machine.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/i386/i486/linuxthreads/pt-machine.h 2006-10-16 08:50:05 UTC (rev 1685)
@@ -0,0 +1,8 @@
+
+/* i486+ is almost same as plain i386 version */
+#include_next <pt-machine.h>
+
+/* but compare-and-swap is always available */
+
+#undef TEST_FOR_COMPARE_AND_SWAP
+
Copied: trunk/glibc-ports/kfreebsd/i386/i586/linuxthreads/pt-machine.h (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/i586/pt-machine.h)
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/i586/linuxthreads/pt-machine.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/i386/i586/linuxthreads/pt-machine.h 2006-10-16 08:50:05 UTC (rev 1685)
@@ -0,0 +1,8 @@
+
+/* i486+ is almost same as plain i386 version */
+#include_next <pt-machine.h>
+
+/* but compare-and-swap is always available */
+
+#undef TEST_FOR_COMPARE_AND_SWAP
+
Copied: trunk/glibc-ports/kfreebsd/i386/i686/linuxthreads/pt-machine.h (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/i686/pt-machine.h)
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/i686/linuxthreads/pt-machine.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/i386/i686/linuxthreads/pt-machine.h 2006-10-16 08:50:05 UTC (rev 1685)
@@ -0,0 +1,8 @@
+
+/* i486+ is almost same as plain i386 version */
+#include_next <pt-machine.h>
+
+/* but compare-and-swap is always available */
+
+#undef TEST_FOR_COMPARE_AND_SWAP
+
Copied: trunk/glibc-ports/kfreebsd/i386/linuxthreads/pt-machine.h (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/pt-machine.h)
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/linuxthreads/pt-machine.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/i386/linuxthreads/pt-machine.h 2006-10-16 08:50:05 UTC (rev 1685)
@@ -0,0 +1,76 @@
+/* Machine-dependent pthreads configuration and inline functions.
+ ix86 version for FreeBSD.
+ Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Petr Salinger, 2005.
+
+ 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; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _FREEBSD_PT_MACHINE_H
+#define _FREEBSD_PT_MACHINE_H 1
+
+/*
+ some parts are common with linux/i386 version
+
+ linux specific parts should be in
+ linuxthreads/sysdeps/unix/sysv/linux/i386/
+ but they are included directly in
+ linuxthreads/sysdeps/i386/
+
+ so include them
+
+ */
+
+#include <linuxthreads/sysdeps/i386/pt-machine.h>
+#include <linuxthreads/sysdeps/i386/useldt.h>
+
+/* hack them */
+
+#ifndef __ASSEMBLER__
+
+#undef INIT_THREAD_SELF
+#undef FREE_THREAD
+
+/* The P4 and above really want some help to prevent overheating. */
+#define BUSY_WAIT_NOP __asm__ ("rep; nop")
+
+/* and add few FreeBSD specifics */
+
+#include <sysarch.h>
+
+/* Initialize the thread-unique value. */
+
+#define INIT_THREAD_SELF(descr, nr) \
+{ \
+ long tmp; \
+ tmp = (long) descr; \
+ if (sysarch(I386_SET_GSBASE, &tmp) != 0) \
+ { \
+ abort(); \
+ } \
+}
+
+#define FREE_THREAD(descr, nr) do { } while (0)
+
+#endif /* __ASSEMBLER__ */
+
+/* We want the OS to assign stack addresses. */
+#define FLOATING_STACKS 1
+
+/* Maximum size of the stack if the rlimit is unlimited. */
+#define ARCH_STACK_MAX_SIZE 8*1024*1024
+
+#endif /* _FREEBSD_PT_MACHINE_H */
Copied: trunk/glibc-ports/kfreebsd/i386/linuxthreads/sysdep-cancel.h (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/sysdep-cancel.h)
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/linuxthreads/sysdep-cancel.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/i386/linuxthreads/sysdep-cancel.h 2006-10-16 08:50:05 UTC (rev 1685)
@@ -0,0 +1,149 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub at redhat.com>, 2002.
+ Modification for FreeBSD by Petr Salinger, 2005.
+
+ 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. */
+
+#include <sysdep.h>
+#include <tls.h>
+#include <pt-machine.h>
+#ifndef __ASSEMBLER__
+# include <linuxthreads/internals.h>
+#endif
+
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
+# undef PSEUDO
+# define PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ SINGLE_THREAD_P; \
+ jne L(pseudo_cancel); \
+ DO_CALL (syscall_name, args); \
+ jb SYSCALL_ERROR_LABEL; \
+ ret; \
+ L(pseudo_cancel): \
+ CENABLE \
+ movl %eax, %ecx; \
+ movl $SYS_ify (syscall_name), %eax; \
+ int $0x80; \
+ PUSHRESULT; \
+ movl %ecx, %eax; \
+ CDISABLE; \
+ POPRESULT; \
+ jb SYSCALL_ERROR_LABEL; \
+ L(pseudo_end):
+
+/*
+ on FreeBSD some syscalls return result in pair edx+eax,
+ therefore proper way would be
+
+# define PUSHRESULT pushl %edx; pushl %eax; pushfl
+# define POPRESULT popfl; popl %eax; popl %edx
+
+ for FreeBSD 5.4 affected syscalls are
+
+ lseek()
+ fork()
+ vfork()
+ rfork()
+
+ none of them is cancelable, therefore
+*/
+
+# define PUSHRESULT pushl %eax; pushfl
+# define POPRESULT popfl; popl %eax
+
+# ifdef IS_IN_libpthread
+# define CENABLE call __pthread_enable_asynccancel;
+# define CDISABLE call __pthread_disable_asynccancel
+# elif defined IS_IN_librt
+# ifdef PIC
+# define CENABLE pushl %ebx; \
+ call __i686.get_pc_thunk.bx; \
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx; \
+ call __librt_enable_asynccancel at PLT; \
+ popl %ebx;
+# define CDISABLE pushl %ebx; \
+ call __i686.get_pc_thunk.bx; \
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx; \
+ call __librt_disable_asynccancel at PLT; \
+ popl %ebx;
+# else
+# define CENABLE call __librt_enable_asynccancel;
+# define CDISABLE call __librt_disable_asynccancel
+# endif
+# else
+# define CENABLE call __libc_enable_asynccancel;
+# define CDISABLE call __libc_disable_asynccancel
+# endif
+
+#if !defined NOT_IN_libc
+# define __local_multiple_threads __libc_multiple_threads
+#elif defined IS_IN_libpthread
+# define __local_multiple_threads __pthread_multiple_threads
+#else
+# define __local_multiple_threads __librt_multiple_threads
+#endif
+
+# ifndef __ASSEMBLER__
+# if defined FLOATING_STACKS && USE___THREAD && defined PIC
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ p_header.data.multiple_threads) == 0, 1)
+# else
+extern int __local_multiple_threads
+# if !defined NOT_IN_libc || defined IS_IN_libpthread
+ attribute_hidden;
+# else
+ ;
+# endif
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
+# endif
+# else
+# if !defined PIC
+# define SINGLE_THREAD_P cmpl $0, __local_multiple_threads
+# elif defined FLOATING_STACKS && USE___THREAD
+# define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
+# else
+# if !defined NOT_IN_libc || defined IS_IN_libpthread
+# define __SINGLE_THREAD_CMP cmpl $0, __local_multiple_threads at GOTOFF(%ecx)
+# else
+# define __SINGLE_THREAD_CMP \
+ movl __local_multiple_threads at GOT(%ecx), %ecx;\
+ cmpl $0, (%ecx)
+# endif
+# if !defined HAVE_HIDDEN || !USE___THREAD
+# define SINGLE_THREAD_P \
+ SETUP_PIC_REG (cx); \
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
+ __SINGLE_THREAD_CMP
+# else
+# define SINGLE_THREAD_P \
+ call __i686.get_pc_thunk.cx; \
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
+ __SINGLE_THREAD_CMP
+# endif
+# endif
+# endif
+
+#elif !defined __ASSEMBLER__
+
+/* This code should never be used but we define it anyhow. */
+# define SINGLE_THREAD_P (1)
+
+#endif
Copied: trunk/glibc-ports/kfreebsd/i386/linuxthreads/tls.h (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/tls.h)
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/linuxthreads/tls.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/i386/linuxthreads/tls.h 2006-10-16 08:50:05 UTC (rev 1685)
@@ -0,0 +1,93 @@
+/* Definition for thread-local data handling. linuxthreads/i386 version.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Modification for FreeBSD by Petr Salinger, 2005.
+
+ 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 _FREEBSD_TLS_H
+#define _FREEBSD_TLS_H
+
+#include <linuxthreads/sysdeps/i386/tls.h>
+
+/* We can support TLS only if the floating-stack support is available.
+ To avoid bothering with the TLS support code at all,
+ use configure --without-tls.
+
+ We need USE_TLS to be consistently defined, for ldsodefs.h conditionals.
+ But some of the code below can cause problems in building libpthread
+*/
+
+#if defined HAVE_TLS_SUPPORT \
+ && (defined FLOATING_STACKS || !defined IS_IN_libpthread)
+
+# ifndef __ASSEMBLER__
+
+#undef TLS_INIT_TP
+#undef TLS_SETUP_GS_SEGMENT
+
+#include <sysarch.h>
+#include <sys/syscall.h>
+
+
+/* Code to initially initialize the thread pointer. This might need
+ special attention since 'errno' is not yet available and if the
+ operation can cause a failure 'errno' must not be touched. */
+
+# define TLS_DO_SET_GSBASE(descr) \
+({ \
+ long base = (long) descr; \
+ int result; \
+ asm volatile ( \
+ "pushl %3\n\t" \
+ "pushl %2\n\t" \
+ "pushl %1\n\t" \
+ "int $0x80\n\t" \
+ "popl %3\n\t" \
+ "popl %3\n\t" \
+ "popl %3\n\t" \
+ : "=a" (result) \
+ : "0" (SYS_sysarch), \
+ "i" (I386_SET_GSBASE), \
+ "d" (&base) \
+ : "memory", "cc" ); \
+ result; \
+})
+
+# define TLS_SETUP_GS_SEGMENT(descr, secondcall) \
+ (TLS_DO_SET_GSBASE(descr) \
+ ? "set_thread_area failed when setting up thread-local storage\n" : NULL)
+
+/* The value of this macro is null if successful, or an error string. */
+
+# define TLS_INIT_TP(descr, secondcall) \
+ ({ \
+ void *_descr = (descr); \
+ tcbhead_t *head = _descr; \
+ \
+ head->tcb = _descr; \
+ /* For now the thread descriptor is at the same address. */ \
+ head->self = _descr; \
+ \
+ INIT_SYSINFO; \
+ TLS_SETUP_GS_SEGMENT (_descr, secondcall); \
+ })
+
+# endif /* __ASSEMBLER__ */
+
+#endif /* HAVE_TLS_SUPPORT && (FLOATING_STACKS || !IS_IN_libpthread) */
+
+#endif /* _FREEBSD_TLS_H */
Copied: trunk/glibc-ports/kfreebsd/linuxthreads (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd)
Copied: trunk/glibc-ports/kfreebsd/x86_64/linuxthreads (from rev 1684, trunk/glibc-2.3-head/linuxthreads/kfreebsd/x86_64)
More information about the Glibc-bsd-commits
mailing list