diff -Naur glibc-2.7.org/elf/dl-support.c glibc-2.7/elf/dl-support.c --- glibc-2.7.org/elf/dl-support.c 2007-06-20 12:18:16.000000000 +0900 +++ glibc-2.7/elf/dl-support.c 2008-08-04 01:24:19.000000000 +0900 @@ -156,9 +156,9 @@ __rtld_lock_define_initialized_recursive (, _dl_load_lock) -#ifdef HAVE_AUX_VECTOR int _dl_clktck; +#ifdef HAVE_AUX_VECTOR void internal_function _dl_aux_init (ElfW(auxv_t) *av) diff -Naur glibc-2.7.org/include/libc-symbols.h glibc-2.7/include/libc-symbols.h --- glibc-2.7.org/include/libc-symbols.h 2006-11-10 00:57:12.000000000 +0900 +++ glibc-2.7/include/libc-symbols.h 2008-07-26 16:19:15.000000000 +0900 @@ -253,7 +253,7 @@ __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \ = msg; # define libc_freeres_ptr(decl) \ - __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \ + __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", @nobits") \ decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment))) # define __libc_freeres_fn_section \ __attribute__ ((section ("__libc_freeres_fn"))) diff -Naur glibc-2.7.org/malloc/malloc.c glibc-2.7/malloc/malloc.c --- glibc-2.7.org/malloc/malloc.c 2007-10-02 12:52:03.000000000 +0900 +++ glibc-2.7/malloc/malloc.c 2008-08-03 16:48:37.000000000 +0900 @@ -727,7 +727,11 @@ sbrk(). */ #ifndef USE_ARENAS -#define USE_ARENAS HAVE_MMAP +//#define USE_ARENAS HAVE_MMAP +#define heap_for_ptr(ptr) NULL +#define heap_trim(heap, pad) 0 +#define grow_heap(h, ldiff) 0 +#define new_heap(size, top_pad) NULL #endif diff -Naur glibc-2.7.org/nptl/sysdeps/mmix/pthread_spin_lock.c glibc-2.7/nptl/sysdeps/mmix/pthread_spin_lock.c --- glibc-2.7.org/nptl/sysdeps/mmix/pthread_spin_lock.c 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/mmix/pthread_spin_lock.c 2008-08-25 23:10:16.000000000 +0900 @@ -0,0 +1,40 @@ +/* + * nptl/sysdeps/mmix/pthread_spin_lock.c + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +#include "pthreadP.h" + +int +pthread_spin_lock (lock) + pthread_spinlock_t *lock; +{ + unsigned int __tmp; + + asm volatile ( + "1: ldo %0,%1,0\n" + " bnz %0,1b\n" + " put rP,%0\n" + " set %0,1\n" + " cswap %0,%1,0\n" + " bz %0,1b\n" + : "=&r" (__tmp) + : "r" (lock) + : "memory"); + return 0; +} diff -Naur glibc-2.7.org/nptl/sysdeps/mmix/pthread_spin_trylock.c glibc-2.7/nptl/sysdeps/mmix/pthread_spin_trylock.c --- glibc-2.7.org/nptl/sysdeps/mmix/pthread_spin_trylock.c 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/mmix/pthread_spin_trylock.c 2008-08-25 23:11:43.000000000 +0900 @@ -0,0 +1,44 @@ +/* + * nptl/sysdeps/mmix/pthread_spin_trylock.c + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +#include +#include "pthreadP.h" + +int +pthread_spin_trylock (lock) + pthread_spinlock_t *lock; +{ + unsigned int old; + int err = EBUSY; + + asm ("1: ldo %0,%2,0\n" + " bnz %0,2f\n" + " put rP,%0\n" + " set %0,1\n" + " cswap %0,%2,0\n" + " bz %0,1b\n" + " set %1,0\n" + "2: " + : "=&r" (old), "=&r" (err) + : "r" (lock), "1" (err) + : "memory"); + + return err; +} diff -Naur glibc-2.7.org/nptl/sysdeps/mmix/pthreaddef.h glibc-2.7/nptl/sysdeps/mmix/pthreaddef.h --- glibc-2.7.org/nptl/sysdeps/mmix/pthreaddef.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/mmix/pthreaddef.h 2008-07-25 16:07:33.000000000 +0900 @@ -0,0 +1,41 @@ +/* Copyright (C) 2003 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. */ + +/* Default stack size. */ +#define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024) + +/* Required stack pointer alignment at beginning. The ABI requires 16 + bytes (for both 32-bit and 64-bit PowerPC). */ +#define STACK_ALIGN 16 + +/* Minimal stack size after allocating thread descriptor and guard size. */ +#define MINIMAL_REST_STACK 4096 + +/* Alignment requirement for TCB. */ +#define TCB_ALIGNMENT 16 + + +/* Location of current stack frame. */ +#define CURRENT_STACK_FRAME __builtin_frame_address (0) + + +/* XXX Until we have a better place keep the definitions here. */ + +/* While there is no such syscall. */ +#define __exit_thread_inline(val) \ + INLINE_SYSCALL (exit, 1, (val)) diff -Naur glibc-2.7.org/nptl/sysdeps/mmix/tls.h glibc-2.7/nptl/sysdeps/mmix/tls.h --- glibc-2.7.org/nptl/sysdeps/mmix/tls.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/mmix/tls.h 2008-07-30 15:22:37.000000000 +0900 @@ -0,0 +1,212 @@ +/* Definition for thread-local data handling. NPTL/PowerPC version. + Copyright (C) 2003, 2005, 2006, 2007 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 _TLS_H +#define _TLS_H 1 + +# include + +#ifndef __ASSEMBLER__ +# include +# include +# include + +/* Type for the dtv. */ +typedef union dtv +{ + size_t counter; + struct + { + void *val; + bool is_static; + } pointer; +} dtv_t; + +#else /* __ASSEMBLER__ */ +# include +#endif /* __ASSEMBLER__ */ + + +/* We require TLS support in the tools. */ +#ifndef HAVE_TLS_SUPPORT +# error "TLS support is required." +#endif + +#ifndef __ASSEMBLER__ + +/* Get system call information. */ +# include + +/* The TP points to the start of the thread blocks. */ +# define TLS_DTV_AT_TP 1 + +/* We use the multiple_threads field in the pthread struct */ +#define TLS_MULTIPLE_THREADS_IN_TCB 1 + +/* Get the thread descriptor definition. */ +# include + +/* The stack_guard is accessed directly by GCC -fstack-protector code, + so it is a part of public ABI. The dtv and pointer_guard fields + are private. */ +typedef struct +{ + uintptr_t pointer_guard; + uintptr_t stack_guard; + dtv_t *dtv; +} tcbhead_t; + +/* This is the size of the initial TCB. */ +# define TLS_INIT_TCB_SIZE 0 + +/* Alignment requirements for the initial TCB. */ +# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread) + +/* This is the size of the TCB. */ +# define TLS_TCB_SIZE 0 + +/* Alignment requirements for the TCB. */ +# define TLS_TCB_ALIGN __alignof__ (struct pthread) + +/* This is the size we need before TCB. */ +# define TLS_PRE_TCB_SIZE \ + (sizeof (struct pthread) \ + + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1))) + +# ifdef __MMIX_ABI_GNU__ +/* Register 230 (tp) is reserved by the ABI as "thread pointer". */ +register void *__thread_register __asm__ ("$230"); +# define PT_THREAD_POINTER PT_R2 +# else +/* Register 246 (tp) is reserved by the ABI as "thread pointer". */ +register void *__thread_register __asm__ ("$246"); +# define PT_THREAD_POINTER PT_R13 +# endif + +/* The following assumes that TP (R2 or R13) points to the end of the + TCB + 0x7000 (per the ABI). This implies that TCB address is + TP - 0x7000. As we define TLS_DTV_AT_TP we can + assume that the pthread struct is allocated immediately ahead of the + TCB. This implies that the pthread_descr address is + TP - (TLS_PRE_TCB_SIZE + 0x7000). */ +# define TLS_TCB_OFFSET 0x7000 + +/* Install the dtv pointer. The pointer passed is to the element with + index -1 which contain the length. */ +# define INSTALL_DTV(tcbp, dtvp) \ + ((tcbhead_t *) (tcbp))[-1].dtv = dtvp + 1 + +/* Install new dtv for current thread. */ +# define INSTALL_NEW_DTV(dtv) (THREAD_DTV() = (dtv)) + +/* Return dtv of given thread descriptor. */ +# define GET_DTV(tcbp) (((tcbhead_t *) (tcbp))[-1].dtv) + +/* 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_INIT_TP(tcbp, secondcall) \ + (__thread_register = (void *) (tcbp) + TLS_TCB_OFFSET, NULL) + +/* Return the address of the dtv for the current thread. */ +# define THREAD_DTV() \ + (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET))[-1].dtv) + +/* Return the thread descriptor for the current thread. */ +# define THREAD_SELF \ + ((struct pthread *) (__thread_register \ + - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)) + +#if 0 +/* Magic for libthread_db to know how to do THREAD_SELF. */ +# define DB_THREAD_SELF \ + REGISTER (32, 32, PT_THREAD_POINTER * 4, \ + - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) \ + REGISTER (64, 64, PT_THREAD_POINTER * 8, \ + - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) +#endif + +/* Read member of the thread descriptor directly. */ +# define THREAD_GETMEM(descr, member) ((void)(descr), (THREAD_SELF)->member) + +/* Same as THREAD_GETMEM, but the member offset can be non-constant. */ +# define THREAD_GETMEM_NC(descr, member, idx) \ + ((void)(descr), (THREAD_SELF)->member[idx]) + +/* Set member of the thread descriptor directly. */ +# define THREAD_SETMEM(descr, member, value) \ + ((void)(descr), (THREAD_SELF)->member = (value)) + +/* Same as THREAD_SETMEM, but the member offset can be non-constant. */ +# define THREAD_SETMEM_NC(descr, member, idx, value) \ + ((void)(descr), (THREAD_SELF)->member[idx] = (value)) + +#if 0 +/* Set the stack guard field in TCB head. */ +# define THREAD_SET_STACK_GUARD(value) \ + (((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].stack_guard = (value)) +#endif +# define THREAD_COPY_STACK_GUARD(descr) \ + (((tcbhead_t *) ((char *) (descr) \ + + TLS_PRE_TCB_SIZE))[-1].stack_guard \ + = ((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].stack_guard) + +/* Set the stack guard field in TCB head. */ +# define THREAD_GET_POINTER_GUARD() \ + (((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].pointer_guard) +# define THREAD_SET_POINTER_GUARD(value) \ + (THREAD_GET_POINTER_GUARD () = (value)) +# define THREAD_COPY_POINTER_GUARD(descr) \ + (((tcbhead_t *) ((char *) (descr) \ + + TLS_PRE_TCB_SIZE))[-1].pointer_guard \ + = THREAD_GET_POINTER_GUARD()) + +/* l_tls_offset == 0 is perfectly valid on PPC, so we have to use some + different value to mean unset l_tls_offset. */ +# define NO_TLS_OFFSET -1 + +/* Get and set the global scope generation counter in struct pthread. */ +#define THREAD_GSCOPE_FLAG_UNUSED 0 +#define THREAD_GSCOPE_FLAG_USED 1 +#define THREAD_GSCOPE_FLAG_WAIT 2 +#define THREAD_GSCOPE_RESET_FLAG() \ + do \ + { int __res \ + = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \ + THREAD_GSCOPE_FLAG_UNUSED); \ + if (__res == THREAD_GSCOPE_FLAG_WAIT) \ + lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \ + } \ + while (0) +#define THREAD_GSCOPE_SET_FLAG() \ + do \ + { \ + THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \ + atomic_write_barrier (); \ + } \ + while (0) +#define THREAD_GSCOPE_WAIT() \ + GL(dl_wait_lookup_done) () + +#endif /* __ASSEMBLER__ */ + +#endif /* tls.h */ diff -Naur glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/bits/pthreadtypes.h glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/bits/pthreadtypes.h --- glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/bits/pthreadtypes.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/bits/pthreadtypes.h 2008-07-25 15:18:09.000000000 +0900 @@ -0,0 +1,172 @@ +/* Machine-specific pthread type layouts. PowerPC version. + Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Paul Mackerras , 2003. + + 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 _BITS_PTHREADTYPES_H +#define _BITS_PTHREADTYPES_H 1 + +#include + +# define __SIZEOF_PTHREAD_ATTR_T 56 +# define __SIZEOF_PTHREAD_MUTEX_T 40 +# define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +# define __SIZEOF_PTHREAD_COND_T 48 +# define __SIZEOF_PTHREAD_CONDATTR_T 4 +# define __SIZEOF_PTHREAD_RWLOCK_T 56 +# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +# define __SIZEOF_PTHREAD_BARRIER_T 32 +# define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + + +/* Thread identifiers. The structure of the attribute type is + deliberately not exposed. */ +typedef unsigned long int pthread_t; + + +typedef union +{ + char __size[__SIZEOF_PTHREAD_ATTR_T]; + long int __align; +} pthread_attr_t; + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; + + +/* Data structures for mutex handling. The structure of the attribute + type is deliberately not exposed. */ +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + unsigned int __nusers; + /* KIND must stay at this position in the structure to maintain + binary compatibility. */ + int __kind; + int __spins; + __pthread_list_t __list; +# define __PTHREAD_MUTEX_HAVE_PREV 1 + } __data; + char __size[__SIZEOF_PTHREAD_MUTEX_T]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; + int __align; +} pthread_mutexattr_t; + + +/* Data structure for conditional variable handling. The structure of + the attribute type is deliberately not exposed. */ +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_CONDATTR_T]; + int __align; +} pthread_condattr_t; + + +/* Keys for thread-specific data */ +typedef unsigned int pthread_key_t; + + +/* Once-only execution */ +typedef int pthread_once_t; + + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +/* Data structure for read-write lock variable handling. The + structure of the attribute type is deliberately not exposed. */ +typedef union +{ + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + unsigned long int __pad1; + unsigned long int __pad2; + /* FLAGS must stay at this position in the structure to maintain + binary compatibility. */ + unsigned int __flags; + } __data; + char __size[__SIZEOF_PTHREAD_RWLOCK_T]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; + long int __align; +} pthread_rwlockattr_t; +#endif + + +#ifdef __USE_XOPEN2K +/* POSIX spinlock data type. */ +typedef volatile int pthread_spinlock_t; + + +/* POSIX barriers data type. The structure of the type is + deliberately not exposed. */ +typedef union +{ + char __size[__SIZEOF_PTHREAD_BARRIER_T]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; + int __align; +} pthread_barrierattr_t; +#endif + + +#endif /* bits/pthreadtypes.h */ diff -Naur glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/bits/semaphore.h glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/bits/semaphore.h --- glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/bits/semaphore.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/bits/semaphore.h 2008-07-30 14:21:41.000000000 +0900 @@ -0,0 +1,35 @@ +/* Machine-specific POSIX semaphore type layouts. PowerPC version. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Paul Mackerras , 2003. + + 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 _SEMAPHORE_H +# error "Never use directly; include instead." +#endif + +# define __SIZEOF_SEM_T 32 + +/* Value returned if `sem_open' failed. */ +#define SEM_FAILED ((sem_t *) 0) + + +typedef union +{ + char __size[__SIZEOF_SEM_T]; + long int __align; +} sem_t; diff -Naur glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/fork.c glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/fork.c --- glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/fork.c 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/fork.c 2008-07-27 01:20:09.000000000 +0900 @@ -0,0 +1 @@ +#include "../i386/fork.c" diff -Naur glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/lowlevellock.h glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/lowlevellock.h --- glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/lowlevellock.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/lowlevellock.h 2008-08-25 23:17:00.000000000 +0900 @@ -0,0 +1,312 @@ +/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Paul Mackerras , 2003. + + 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. */ + +/* Modifyed by Eiji Yoshiya , 2008. */ + +#ifndef _LOWLEVELLOCK_H +#define _LOWLEVELLOCK_H 1 + +#include +#include +#include +#include +#include + +#ifndef __NR_futex +# define __NR_futex 221 +#endif +#define FUTEX_WAIT 0 +#define FUTEX_WAKE 1 +#define FUTEX_REQUEUE 3 +#define FUTEX_CMP_REQUEUE 4 +#define FUTEX_WAKE_OP 5 +#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1) +#define FUTEX_LOCK_PI 6 +#define FUTEX_UNLOCK_PI 7 +#define FUTEX_TRYLOCK_PI 8 +#define FUTEX_PRIVATE_FLAG 128 + +/* Values for 'private' parameter of locking macros. Yes, the + definition seems to be backwards. But it is not. The bit will be + reversed before passing to the system call. */ +#define LLL_PRIVATE 0 +#define LLL_SHARED FUTEX_PRIVATE_FLAG + +#if !defined NOT_IN_libc || defined IS_IN_rtld +/* In libc.so or ld.so all futexes are private. */ +# ifdef __ASSUME_PRIVATE_FUTEX +# define __lll_private_flag(fl, private) \ + ((fl) | FUTEX_PRIVATE_FLAG) +# else +# define __lll_private_flag(fl, private) \ + ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex)) +# endif +#else +# ifdef __ASSUME_PRIVATE_FUTEX +# define __lll_private_flag(fl, private) \ + (((fl) | FUTEX_PRIVATE_FLAG) ^ (private)) +# else +# define __lll_private_flag(fl, private) \ + (__builtin_constant_p (private) \ + ? ((private) == 0 \ + ? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex)) \ + : (fl)) \ + : ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG) \ + & THREAD_GETMEM (THREAD_SELF, header.private_futex)))) +# endif +#endif + +#define lll_futex_wait(futexp, val, private) \ + lll_futex_timed_wait (futexp, val, NULL, private) + +#define lll_futex_timed_wait(futexp, val, timespec, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + \ + __ret = INTERNAL_SYSCALL (futex, __err, 4, (futexp), \ + __lll_private_flag (FUTEX_WAIT, private), \ + (val), (timespec)); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ + }) + +#define lll_futex_wake(futexp, nr, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + \ + __ret = INTERNAL_SYSCALL (futex, __err, 4, (futexp), \ + __lll_private_flag (FUTEX_WAKE, private), \ + (nr), 0); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ + }) + +#define lll_robust_dead(futexv, private) \ + do \ + { \ + INTERNAL_SYSCALL_DECL (__err); \ + int *__futexp = &(futexv); \ + \ + atomic_or (__futexp, FUTEX_OWNER_DIED); \ + INTERNAL_SYSCALL (futex, __err, 4, __futexp, \ + __lll_private_flag (FUTEX_WAKE, private), 1, 0); \ + } \ + while (0) + +/* Returns non-zero if error happened, zero if success. */ +#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (FUTEX_CMP_REQUEUE, private),\ + (nr_wake), (nr_move), (mutex), (val)); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ + }) + +/* Returns non-zero if error happened, zero if success. */ +#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (FUTEX_WAKE_OP, private), \ + (nr_wake), (nr_wake2), (futexp2), \ + FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ + }) + + +#ifdef UP +# define __lll_acq_instr "" +# define __lll_rel_instr "" +#else +# define __lll_acq_instr "isync" +# ifdef _ARCH_PWR4 +/* + * Newer powerpc64 processors support the new "light weight" sync (lwsync) + * So if the build is using -mcpu=[power4,power5,power5+,970] we can + * safely use lwsync. + */ +# define __lll_rel_instr "lwsync" +# else +/* + * Older powerpc32 processors don't support the new "light weight" + * sync (lwsync). So the only safe option is to use normal sync + * for all powerpc32 applications. + */ +# define __lll_rel_instr "sync" +# endif +#endif + +/* Set *futex to ID if it is 0, atomically. Returns the old value */ +#define __lll_robust_trylock(futex, id) \ + ({ int __val; \ + __asm __volatile ("1: ldo %0,%2,0\n" \ + " bnz %0,2f\n" \ + " put rP,%0\n" \ + " set $255,%3\n" \ + " cswap $255,%2,0\n" \ + " bz $255,1b\n" \ + "2:" \ + : "=&r" (__val), "=m" (*futex) \ + : "r" (futex), "r" (id), "m" (*futex) \ + : "$255", "memory"); \ + __val; \ + }) + +#define lll_robust_trylock(lock, id) __lll_robust_trylock (&(lock), id) + +/* Set *futex to 1 if it is 0, atomically. Returns the old value */ +#define __lll_trylock(futex) __lll_robust_trylock (futex, 1) + +#define lll_trylock(lock) __lll_trylock (&(lock)) + +/* Set *futex to 2 if it is 0, atomically. Returns the old value */ +#define __lll_cond_trylock(futex) __lll_robust_trylock (futex, 2) + +#define lll_cond_trylock(lock) __lll_cond_trylock (&(lock)) + + +extern void __lll_lock_wait_private (int *futex) attribute_hidden; +extern void __lll_lock_wait (int *futex, int private) attribute_hidden; +extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; + +#define lll_lock(lock, private) \ + (void) ({ \ + int *__futex = &(lock); \ + if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex, 1, 0),\ + 0) != 0) \ + { \ + if (__builtin_constant_p (private) && (private) == LLL_PRIVATE) \ + __lll_lock_wait_private (__futex); \ + else \ + __lll_lock_wait (__futex, private); \ + } \ + }) + +#define lll_robust_lock(lock, id, private) \ + ({ \ + int *__futex = &(lock); \ + int __val = 0; \ + if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, id, \ + 0), 0)) \ + __val = __lll_robust_lock_wait (__futex, private); \ + __val; \ + }) + +#define lll_cond_lock(lock, private) \ + (void) ({ \ + int *__futex = &(lock); \ + if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex, 2, 0),\ + 0) != 0) \ + __lll_lock_wait (__futex, private); \ + }) + +#define lll_robust_cond_lock(lock, id, private) \ + ({ \ + int *__futex = &(lock); \ + int __val = 0; \ + int __id = id | FUTEX_WAITERS; \ + if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, __id,\ + 0), 0)) \ + __val = __lll_robust_lock_wait (__futex, private); \ + __val; \ + }) + + +extern int __lll_timedlock_wait + (int *futex, const struct timespec *, int private) attribute_hidden; +extern int __lll_robust_timedlock_wait + (int *futex, const struct timespec *, int private) attribute_hidden; + +#define lll_timedlock(lock, abstime, private) \ + ({ \ + int *__futex = &(lock); \ + int __val = 0; \ + if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex, 1, 0),\ + 0) != 0) \ + __val = __lll_timedlock_wait (__futex, abstime, private); \ + __val; \ + }) + +#define lll_robust_timedlock(lock, abstime, id, private) \ + ({ \ + int *__futex = &(lock); \ + int __val = 0; \ + if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, id, \ + 0), 0)) \ + __val = __lll_robust_timedlock_wait (__futex, abstime, private); \ + __val; \ + }) + +#define lll_unlock(lock, private) \ + ((void) ({ \ + int *__futex = &(lock); \ + int __val = atomic_exchange_rel (__futex, 0); \ + if (__builtin_expect (__val > 1, 0)) \ + lll_futex_wake (__futex, 1, private); \ + })) + +#define lll_robust_unlock(lock, private) \ + ((void) ({ \ + int *__futex = &(lock); \ + int __val = atomic_exchange_rel (__futex, 0); \ + if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \ + lll_futex_wake (__futex, 1, private); \ + })) + +#define lll_islocked(futex) \ + (futex != 0) + + +/* Initializers for lock. */ +#define LLL_LOCK_INITIALIZER (0) +#define LLL_LOCK_INITIALIZER_LOCKED (1) + +/* The states of a lock are: + 0 - untaken + 1 - taken by one user + >1 - taken by more users */ + +/* The kernel notifies a process which uses CLONE_CLEARTID via futex + wakeup when the clone terminates. The memory location contains the + thread ID while the clone is running and is reset to zero + afterwards. */ +#define lll_wait_tid(tid) \ + do { \ + __typeof (tid) __tid; \ + while ((__tid = (tid)) != 0) \ + lll_futex_wait (&(tid), __tid, LLL_SHARED); \ + } while (0) + +extern int __lll_timedwait_tid (int *, const struct timespec *) + attribute_hidden; + +#define lll_timedwait_tid(tid, abstime) \ + ({ \ + int __res = 0; \ + if ((tid) != 0) \ + __res = __lll_timedwait_tid (&(tid), (abstime)); \ + __res; \ + }) + +#endif /* lowlevellock.h */ diff -Naur glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/pt-vfork.S glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/pt-vfork.S --- glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/pt-vfork.S 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/pt-vfork.S 2008-08-25 23:17:51.000000000 +0900 @@ -0,0 +1,55 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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. */ + +/* Modifyed by Eiji Yoshiya , 2008. */ + +#include +#define _ERRNO_H 1 +#include +#include +#include + +/* Clone the calling process, but without copying the whole address space. + The calling process is suspended until the new process exits or is + replaced by a call to `execve'. Return -1 for errors, 0 to the new process, + and the process ID of the new process to the old process. */ + +ENTRY (__vfork) +#if 0 + lwz 0,PID(13) + neg 0,0 + stw 0,PID(13) + + DO_CALL (SYS_ify (vfork)) + + cmpwi 1,3,0 + beqlr- 1 + + lwz 0,PID(13) + neg 0,0 + stw 0,PID(13) + + PSEUDO_RET +#else + jmp __syscall_error +#endif + +PSEUDO_END (__vfork) + +weak_alias (__vfork, vfork) diff -Naur glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/pthread_once.c glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/pthread_once.c --- glibc-2.7.org/nptl/sysdeps/unix/sysv/linux/mmix/pthread_once.c 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/nptl/sysdeps/unix/sysv/linux/mmix/pthread_once.c 2008-08-25 23:18:05.000000000 +0900 @@ -0,0 +1,104 @@ +/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Paul Mackerras , 2003. + + 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. */ + +/* Modifyed by Eiji Yoshiya , 2008. */ + +#include "pthreadP.h" +#include + + +unsigned long int __fork_generation attribute_hidden; + + +#if 0 +static void +clear_once_control (void *arg) +{ + pthread_once_t *once_control = (pthread_once_t *) arg; + + *once_control = 0; + lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE); +} + + +int +__pthread_once (pthread_once_t *once_control, void (*init_routine) (void)) +{ + for (;;) + { + int oldval; + int newval; + int tmp; + + /* Pseudo code: + newval = __fork_generation | 1; + oldval = *once_control; + if ((oldval & 2) == 0) + *once_control = newval; + Do this atomically. + */ + newval = __fork_generation | 1; + __asm __volatile ("1: lwarx %0,0,%3\n" + " andi. %1,%0,2\n" + " bne 2f\n" + " stwcx. %4,0,%3\n" + " bne 1b\n" + "2: isync" + : "=&r" (oldval), "=&r" (tmp), "=m" (*once_control) + : "r" (once_control), "r" (newval), "m" (*once_control) + : "cr0"); + + /* Check if the initializer has already been done. */ + if ((oldval & 2) != 0) + return 0; + + /* Check if another thread already runs the initializer. */ + if ((oldval & 1) == 0) + break; + + /* Check whether the initializer execution was interrupted by a fork. */ + if (oldval != newval) + break; + + /* Same generation, some other thread was faster. Wait. */ + lll_futex_wait (once_control, oldval, LLL_PRIVATE); + } + + + /* This thread is the first here. Do the initialization. + Register a cleanup handler so that in case the thread gets + interrupted the initialization can be restarted. */ + pthread_cleanup_push (clear_once_control, once_control); + + init_routine (); + + pthread_cleanup_pop (0); + + + /* Add one to *once_control to take the bottom 2 bits from 01 to 10. */ + atomic_increment (once_control); + + /* Wake up all other threads. */ + lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE); + + return 0; +} +weak_alias (__pthread_once, pthread_once) +strong_alias (__pthread_once, __pthread_once_internal) +#endif diff -Naur glibc-2.7.org/nscd/Makefile glibc-2.7/nscd/Makefile --- glibc-2.7.org/nscd/Makefile 2007-08-22 12:13:16.000000000 +0900 +++ glibc-2.7/nscd/Makefile 2008-07-30 18:08:25.000000000 +0900 @@ -35,7 +35,8 @@ getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm2_r \ getsrvbynm_r getsrvbypt_r servicescache \ dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \ - xmalloc xstrdup aicache initgrcache gai res_hconf + xmalloc xstrdup aicache initgrcache gai +# xmalloc xstrdup aicache initgrcache gai res_hconf ifeq ($(have-thread-library),yes) diff -Naur glibc-2.7.org/scripts/config.sub glibc-2.7/scripts/config.sub --- glibc-2.7.org/scripts/config.sub 2006-02-28 16:54:05.000000000 +0900 +++ glibc-2.7/scripts/config.sub 2008-07-25 17:09:48.000000000 +0900 @@ -1432,7 +1432,8 @@ os=-aix ;; *-knuth) - os=-mmixware +# os=-mmixware + os=-linux-gnu ;; *-wec) os=-proelf diff -Naur glibc-2.7.org/sysdeps/mmix/Implies glibc-2.7/sysdeps/mmix/Implies --- glibc-2.7.org/sysdeps/mmix/Implies 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/Implies 2008-07-26 16:23:43.000000000 +0900 @@ -0,0 +1,4 @@ +wordsize-64 +ieee754/ldbl-96 +ieee754/dbl-64 +ieee754/flt-32 diff -Naur glibc-2.7.org/sysdeps/mmix/Makefile glibc-2.7/sysdeps/mmix/Makefile --- glibc-2.7.org/sysdeps/mmix/Makefile 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/Makefile 2008-07-29 16:21:48.000000000 +0900 @@ -0,0 +1,2 @@ +#sysdep-CFLAGS += -mno-base-addresses +sysdep-LDFLAGS += -m elf64mmix diff -Naur glibc-2.7.org/sysdeps/mmix/bits/endian.h glibc-2.7/sysdeps/mmix/bits/endian.h --- glibc-2.7.org/sysdeps/mmix/bits/endian.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/bits/endian.h 2008-08-25 23:25:02.000000000 +0900 @@ -0,0 +1,27 @@ +/* + * sysdeps/mmix/bits/endian.h + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +/* mmix is big-endian. */ + +#ifndef _ENDIAN_H +# error "Never use directly; include instead." +#endif + +#define __BYTE_ORDER __BIG_ENDIAN diff -Naur glibc-2.7.org/sysdeps/mmix/bits/link.h glibc-2.7/sysdeps/mmix/bits/link.h --- glibc-2.7.org/sysdeps/mmix/bits/link.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/bits/link.h 2008-08-25 23:25:19.000000000 +0900 @@ -0,0 +1,66 @@ +/* Machine-specific declarations for dynamic linker interface. MMIX version + Copyright (C) 2004, 2005 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 _LINK_H +# error "Never include directly; use instead." +#endif + + +/* Registers for entry into PLT on PPC64. */ +typedef struct La_mmix_regs +{ + uint64_t lr_reg[8]; + double lr_fp[13]; + uint32_t __padding; + uint32_t lr_vrsave; + uint32_t lr_vreg[12][4]; + uint64_t lr_r1; + uint64_t lr_lr; +} La_mmix_regs; + +/* Return values for calls from PLT on PPC64. */ +typedef struct La_mmix_retval +{ + uint64_t lrv_r3; + uint64_t lrv_r4; + double lrv_fp[4]; /* f1-f4, float - complex long double. */ + uint32_t lrv_v2[4]; /* v2. */ +} La_mmix_retval; + + +__BEGIN_DECLS + +extern Elf64_Addr la_mmix_gnu_pltenter (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_mmix_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_mmix_gnu_pltexit (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_mmix_regs *__inregs, + La_mmix_retval *__outregs, + const char *symname); + +__END_DECLS + diff -Naur glibc-2.7.org/sysdeps/mmix/bits/setjmp.h glibc-2.7/sysdeps/mmix/bits/setjmp.h --- glibc-2.7.org/sysdeps/mmix/bits/setjmp.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/bits/setjmp.h 2008-07-25 15:12:30.000000000 +0900 @@ -0,0 +1,32 @@ +/* Copyright (C) 1997,1998,2000,2001,2003,2005,2006 + 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. */ + +/* Define the machine-dependent type `jmp_buf'. MMIX version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + +#ifndef _ASM +typedef int __jmp_buf[5]; +#endif + +#endif /* bits/setjmp.h */ diff -Naur glibc-2.7.org/sysdeps/mmix/dl-machine.h glibc-2.7/sysdeps/mmix/dl-machine.h --- glibc-2.7.org/sysdeps/mmix/dl-machine.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/dl-machine.h 2008-08-25 23:20:59.000000000 +0900 @@ -0,0 +1,80 @@ +/* + * sysdeps/mmix/dl-machine.h + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +#ifndef dl_machine_h +#define dl_machine_h + +#include +#include +#include +#include + +/* Return nonzero iff ELF header is compatible with the running host. */ +static inline int __attribute__ ((unused)) +elf_machine_matches_host (const Elf32_Ehdr *ehdr) +{ + return ehdr->e_machine == EM_MMIX; +} + +static inline int __attribute__ ((unused, always_inline)) +elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +{ + return lazy; +} + +#define ELF_MACHINE_JMP_SLOT 0 /* R_MMIX_JMP_SLOT */ + +#endif /* dl_machine_h */ + +#ifdef RESOLVE_MAP + +auto inline void __attribute__((always_inline)) +elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, + const ElfW(Sym) *sym, const struct r_found_version *version, + void *const reloc_addr) +{ +} + +auto inline void __attribute__((always_inline)) +elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc, + void *const reloc_addr) +{ +} + +auto inline void __attribute__((always_inline)) +elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, + const ElfW(Sym) *sym, const struct r_found_version *version, + void *const reloc_addr) +{ +} + +auto inline void __attribute__((always_inline)) +elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, + void *const reloc_addr) +{ +} + +auto inline void __attribute__((always_inline)) +elf_machine_lazy_rel (struct link_map *map, + ElfW(Addr) l_addr, const ElfW(Rela) *reloc) +{ +} + +#endif /* RESOLVE_MAP */ diff -Naur glibc-2.7.org/sysdeps/mmix/dl-tls.h glibc-2.7/sysdeps/mmix/dl-tls.h --- glibc-2.7.org/sysdeps/mmix/dl-tls.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/dl-tls.h 2008-08-25 23:22:05.000000000 +0900 @@ -0,0 +1,29 @@ +/* Thread-local storage handling in the ELF dynamic linker. MMIX version. + Copyright (C) 2002 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. */ + + +/* Type used for the representation of TLS information in the GOT. */ +typedef struct +{ + unsigned long int ti_module; + unsigned long int ti_offset; +} tls_index; + + +extern void *__tls_get_addr (tls_index *ti); diff -Naur glibc-2.7.org/sysdeps/mmix/elf/configure glibc-2.7/sysdeps/mmix/elf/configure --- glibc-2.7.org/sysdeps/mmix/elf/configure 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/elf/configure 2008-07-25 16:06:16.000000000 +0900 @@ -0,0 +1,10 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/mmix/elf. + +if test "$usetls" != no; then +libc_cv_mmix_tls=yes + cat >>confdefs.h <<\_ACEOF +#define HAVE_TLS_SUPPORT 1 +_ACEOF +fi + diff -Naur glibc-2.7.org/sysdeps/mmix/elf/configure.in glibc-2.7/sysdeps/mmix/elf/configure.in --- glibc-2.7.org/sysdeps/mmix/elf/configure.in 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/elf/configure.in 2008-07-25 16:05:55.000000000 +0900 @@ -0,0 +1,8 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/mmix/elf. + +if test "$usetls" != no; then +libc_cv_mmix_tls=yes +AC_DEFINE(HAVE_TLS_SUPPORT) +fi + diff -Naur glibc-2.7.org/sysdeps/mmix/elf/start.S glibc-2.7/sysdeps/mmix/elf/start.S --- glibc-2.7.org/sysdeps/mmix/elf/start.S 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/elf/start.S 2008-08-02 23:54:16.000000000 +0900 @@ -0,0 +1,75 @@ +/* Startup code for programs linked with GNU libc. MMIX version. + Copyright (C) 1998,1999,2000,2001,2002,2003 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. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 +#include "bp-sym.h" + + /* These are the various addresses we require. */ +#ifdef PIC + .section ".data.rel.ro.local","aw" +#else + .section ".rodata" +#endif + .align 3 +start_addresses: + octa BP_SYM(main) + octa __libc_csu_init + octa __libc_csu_fini + octa BP_SYM(__libc_start_main) + + ASM_SIZE_DIRECTIVE(start_addresses) + + .section ".text" +ENTRY(_start) + geta $255,start_addresses + ldo $1,$255,0 /* main */ + ldo $2,$254,0 /* argc */ + lda $3,$254,8 /* argv */ + ldo $4,$255,8 /* __libc_csu_init */ + ldo $5,$255,16 /* __libc_csu_fini */ + set $6,0 /* shared library termination function */ + set $7,$254 /* highest stack address */ + ldo $255,$255,24 /* __libc_stat_main */ + pushgo $0,$255,0 + jmp @ + +END(_start) + +/* Define a symbol for the first piece of initialized data. */ + .section ".data" + .globl __data_start +__data_start: +weak_alias (__data_start, data_start) diff -Naur glibc-2.7.org/sysdeps/mmix/jmpbuf-offsets.h glibc-2.7/sysdeps/mmix/jmpbuf-offsets.h --- glibc-2.7.org/sysdeps/mmix/jmpbuf-offsets.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/jmpbuf-offsets.h 2008-08-25 23:22:21.000000000 +0900 @@ -0,0 +1,25 @@ +/* Private macros for accessing __jmp_buf contents. MMIX version. + Copyright (C) 2006 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. */ + +#define JB_FP 0 +#define JB_RJ 1 +#define JB_SP 2 +#define JB_RO 3 +#define JB_TMP 4 +#define JB_SIZE 5 diff -Naur glibc-2.7.org/sysdeps/mmix/jmpbuf-unwind.h glibc-2.7/sysdeps/mmix/jmpbuf-unwind.h --- glibc-2.7.org/sysdeps/mmix/jmpbuf-unwind.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/jmpbuf-unwind.h 2008-07-30 14:51:31.000000000 +0900 @@ -0,0 +1,48 @@ +/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 +#include +#include +#include +#include + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP])) + +#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ + _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) + +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_SP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) + +/* We use the normal longjmp for unwinding. */ +#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff -Naur glibc-2.7.org/sysdeps/mmix/setjmp.S glibc-2.7/sysdeps/mmix/setjmp.S --- glibc-2.7.org/sysdeps/mmix/setjmp.S 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/setjmp.S 2008-08-25 23:23:02.000000000 +0900 @@ -0,0 +1,27 @@ +/* + * sysdeps/mmix/setjmp.S + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +#include +#include "bp-sym.h" + + .section ".text" +ENTRY(BP_SYM(__sigsetjmp)) + set $0,0 + pop 1,0 diff -Naur glibc-2.7.org/sysdeps/mmix/stackinfo.h glibc-2.7/sysdeps/mmix/stackinfo.h --- glibc-2.7.org/sysdeps/mmix/stackinfo.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/stackinfo.h 2008-07-27 15:20:44.000000000 +0900 @@ -0,0 +1,28 @@ +/* Copyright (C) 1999 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. */ + +/* This file contains a bit of information about the stack allocation + of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +/* On MMIX the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +#endif /* stackinfo.h */ diff -Naur glibc-2.7.org/sysdeps/mmix/sysdep.h glibc-2.7/sysdeps/mmix/sysdep.h --- glibc-2.7.org/sysdeps/mmix/sysdep.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/mmix/sysdep.h 2008-08-25 23:24:00.000000000 +0900 @@ -0,0 +1,28 @@ +/* + * syseps/mmix/sysdep.h + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +#ifdef __ASSEMBLER__ +#ifdef HAVE_ELF + +#define ASM_SIZE_DIRECTIVE(name) .size name,.-name + +#endif /* HAVE_ELF */ +#endif /* __ASSEMBLER__ */ + diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/Implies glibc-2.7/sysdeps/unix/sysv/linux/mmix/Implies --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/Implies 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/Implies 2008-08-04 16:22:11.000000000 +0900 @@ -0,0 +1 @@ +unix/sysv/linux/wordsize-64 diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/fcntl.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/fcntl.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/fcntl.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/fcntl.h 2008-07-25 14:57:32.000000000 +0900 @@ -0,0 +1,240 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007 + 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 _FCNTL_H +# error "Never use directly; include instead." +#endif + +#include +#ifdef __USE_GNU +# include +#endif + + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 + +#ifdef __USE_GNU +# define O_DIRECT 040000 /* Direct disk access. */ +# define O_DIRECTORY 0200000 /* Must be a directory. */ +# define O_NOFOLLOW 0400000 /* Do not follow links. */ +# define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0100000 +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 5 /* Get record locking info. */ +# define F_SETLK 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#endif +#define F_GETLK64 12 /* Get record locking info. */ +#define F_SETLK64 13 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 14 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_UNIX98 +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# 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. */ +#endif + +/* For F_[GET|SET]FD. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* For old implementation of bsd flock(). */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation. */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + + +#ifdef __USE_GNU +/* 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. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* 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 + +/* 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); + + +/* Splice address range into a pipe. */ +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); + +/* Splice two files together. */ +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 ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); + +#endif + +__END_DECLS diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/ioctl-types.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/ioctl-types.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/ioctl-types.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/ioctl-types.h 2008-08-04 17:59:21.000000000 +0900 @@ -0,0 +1,5 @@ +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +#include diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/mman.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/mman.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/mman.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/mman.h 2008-07-27 15:23:11.000000000 +0900 @@ -0,0 +1,104 @@ +/* Definitions for POSIX memory map interface. Linux/PowerPC version. + Copyright (C) 1997, 2000, 2003, 2005, 2006 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 use directly; iclude 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 0x001 /* Share changes. */ +#define MAP_PRIVATE 0x002 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x00f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x010 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0x000 +# define MAP_ANONYMOUS 0x020 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x00080 /* Lock the mapping. */ +# define MAP_NORESERVE 0x00040 /* Don't check for reservations. */ +# define MAP_POPULATE 0x08000 /* 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 0x2000 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 0x4000 /* Lock all additions to address + space. */ + + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 +#endif + +/* Advice 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 -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/stat.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/stat.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/stat.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/stat.h 2008-08-05 09:03:03.000000000 +0900 @@ -0,0 +1,171 @@ +/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + 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_STAT_H +# error "Never include directly; use instead." +#endif + +#include + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +# define _STAT_VER _STAT_VER_KERNEL + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ + + +struct stat + { + __dev_t st_dev; /* Device. */ +# ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +# else + __ino64_t st_ino; /* File serial number. */ +# endif + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + int __pad2; + __dev_t st_rdev; /* Device number, if device. */ +# ifndef __USE_FILE_OFFSET64 + __off_t st_size; /* Size of file, in bytes. */ +# else + __off64_t st_size; /* Size of file, in bytes. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + +# ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +# else + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# endif +#ifdef __USE_MISC + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + unsigned long int __unused4; + unsigned long int __unused5; + unsigned long int __unused6; + }; + +# ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + int __pad2; + __dev_t st_rdev; /* Device number, if device. */ + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#ifdef __USE_MISC + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + unsigned long int __unused4; + unsigned long int __unused5; + unsigned long int __unused6; + }; +# endif /* __USE_LARGEFILE64 */ + + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +/* Nanosecond resolution time values are supported. */ +#define _STATBUF_ST_NSEC + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. Note that these macros always evaluate to zero. But + they do it by enforcing the correct use of the macros. */ +#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ + +#if defined __USE_ATFILE || defined __USE_GNU +/* XXX This will change to the macro for the next 2008 POSIX revision. */ +# define UTIME_NOW ((1l << 30) - 1l) +# define UTIME_OMIT ((1l << 30) - 2l) +#endif diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/termios.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/termios.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/bits/termios.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/bits/termios.h 2008-08-04 17:55:37.000000000 +0900 @@ -0,0 +1,319 @@ +/* Copyright (C) 1997,1999,2001,2003,2004,2005 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 _TERMIOS_H +# error "Never include directly; use instead." +#endif + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +/* + * termios type and macro definitions. Be careful about adding stuff + * to this file since it's used in GNU libc and there are strict rules + * concerning namespace pollution. + */ + +#define NCCS 32 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline (== c_cc[19]) */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VMIN 5 +#define VEOL 6 +#define VTIME 7 +#define VEOL2 8 +#define VSWTC 9 + +#define VWERASE 10 +#define VREPRINT 11 +#define VSUSP 12 +#define VSTART 13 +#define VSTOP 14 +#define VLNEXT 15 +#define VDISCARD 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IXON 0001000 +#define IXOFF 0002000 +#define IXANY 0004000 +#define IUCLC 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define ONLCR 0000002 +#define OLCUC 0000004 + +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 + +#define OFILL 00000100 +#define OFDEL 00000200 +#if defined __USE_MISC || defined __USE_XOPEN +# define NLDLY 00001400 +# define NL0 00000000 +# define NL1 00000400 +# define NL2 00001000 +# define NL3 00001400 +# define TABDLY 00006000 +# define TAB0 00000000 +# define TAB1 00002000 +# define TAB2 00004000 +# define TAB3 00006000 +# define CRDLY 00030000 +# define CR0 00000000 +# define CR1 00010000 +# define CR2 00020000 +# define CR3 00030000 +# define FFDLY 00040000 +# define FF0 00000000 +# define FF1 00040000 +# define BSDLY 00100000 +# define BS0 00000000 +# define BS1 00100000 +#endif +#define VTDLY 00200000 +#define VT0 00000000 +#define VT1 00200000 + +#ifdef __USE_MISC +# define XTABS 00006000 +#endif + +/* c_cflag bit meaning */ +#ifdef __USE_MISC +# define CBAUD 0000377 +#endif +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +# define CBAUDEX 0000020 +#endif +#define B57600 00020 +#define B115200 00021 +#define B230400 00022 +#define B460800 00023 +#define B500000 00024 +#define B576000 00025 +#define B921600 00026 +#define B1000000 00027 +#define B1152000 00030 +#define B1500000 00031 +#define B2000000 00032 +#define B2500000 00033 +#define B3000000 00034 +#define B3500000 00035 +#define B4000000 00036 +#define __MAX_BAUD B4000000 + +#define CSIZE 00001400 +#define CS5 00000000 +#define CS6 00000400 +#define CS7 00001000 +#define CS8 00001400 + +#define CSTOPB 00002000 +#define CREAD 00004000 +#define PARENB 00010000 +#define PARODD 00020000 +#define HUPCL 00040000 + +#define CLOCAL 00100000 +#ifdef __USE_MISC +# define CMSPAR 010000000000 /* mark or space (stick) parity */ +# define CRTSCTS 020000000000 /* flow control */ +#endif + +/* c_lflag bits */ +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#if defined __USE_MISC || defined __USE_XOPEN +# define XCASE 0x00004000 +#endif +#define ECHO 0x00000008 +#define ECHOE 0x00000002 +#define ECHOK 0x00000004 +#define ECHONL 0x00000010 +#define NOFLSH 0x80000000 +#define TOSTOP 0x00400000 +#ifdef __USE_MISC +# define ECHOCTL 0x00000040 +# define ECHOPRT 0x00000020 +# define ECHOKE 0x00000001 +# define FLUSHO 0x00800000 +# define PENDIN 0x20000000 +#endif +#define IEXTEN 0x00000400 + +/* Values for the ACTION argument to `tcflow'. */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +struct sgttyb { + char sg_ispeed; + char sg_ospeed; + char sg_erase; + char sg_kill; + short sg_flags; +}; + +struct tchars { + char t_intrc; + char t_quitc; + char t_startc; + char t_stopc; + char t_eofc; + char t_brkc; +}; + +struct ltchars { + char t_suspc; + char t_dsuspc; + char t_rprntc; + char t_flushc; + char t_werasc; + char t_lnextc; +}; + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 10 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* c_cc characters */ +#define _VINTR 0 +#define _VQUIT 1 +#define _VERASE 2 +#define _VKILL 3 +#define _VEOF 4 +#define _VMIN 5 +#define _VEOL 6 +#define _VTIME 7 +#define _VEOL2 8 +#define _VSWTC 9 + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Mobitex module */ +#define N_R3964 9 /* Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Profibus */ +#define N_IRDA 11 /* Linux IR */ +#define N_SMSBLOCK 12 /* SMS block mode */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/brk.c glibc-2.7/sysdeps/unix/sysv/linux/mmix/brk.c --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/brk.c 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/brk.c 2008-08-25 23:26:44.000000000 +0900 @@ -0,0 +1,53 @@ +/* brk system call for Linux/MMIX. + Copyright (C) 1995, 1996, 2000, 2002, 2003 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. */ + +#include +#include +#include + +#include + +/* This must be initialized data because commons can't have aliases. */ +void *__curbrk = 0; + +/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt + to work around different old braindamage in the old Linux ELF dynamic + linker. */ +weak_alias (__curbrk, ___brk_addr) + +int +__brk (void *addr) +{ + void *__unbounded newbrk; + + INTERNAL_SYSCALL_DECL (err); + newbrk = (void *__unbounded) INTERNAL_SYSCALL (brk, err, 1, + __ptrvalue (addr)); + + __curbrk = newbrk; + + if (newbrk < addr) + { + __set_errno (ENOMEM); + return -1; + } + + return 0; +} +weak_alias (__brk, brk) diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/clone.S glibc-2.7/sysdeps/unix/sysv/linux/mmix/clone.S --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/clone.S 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/clone.S 2008-08-25 23:27:50.000000000 +0900 @@ -0,0 +1,31 @@ +/* + * sysdeps/unix/sysv/linux/mmix/clone.S + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +#include +#define _ERRNO_H 1 +#include +#include + +ENTRY (BP_SYM (__clone)) + jmp __syscall_error + +END (BP_SYM (__clone)) + +weak_alias (BP_SYM (__clone), BP_SYM (clone)) diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/kernel_stat.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/kernel_stat.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/kernel_stat.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/kernel_stat.h 2008-08-04 16:16:23.000000000 +0900 @@ -0,0 +1,21 @@ +/* Definition of `struct stat' used in the kernel. + Copyright (C) 2002 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. */ + +#define STAT_IS_KERNEL_STAT 1 +#define XSTAT_IS_XSTAT64 1 diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/kernel_termios.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/kernel_termios.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/kernel_termios.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/kernel_termios.h 2008-08-04 10:22:18.000000000 +0900 @@ -0,0 +1,54 @@ +/* Copyright (C) 1997 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 _KERNEL_TERMIOS_H +#define _KERNEL_TERMIOS_H 1 + +/* We need the definition of tcflag_t, cc_t, and speed_t. */ +#include + +#define __KERNEL_NCCS 19 + +struct __kernel_termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[__KERNEL_NCCS]; /* control characters */ + cc_t c_line; /* line discipline */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + }; + +#define _HAVE_C_ISPEED 1 +#define _HAVE_C_OSPEED 1 + +/* We have the kernel termios structure, so we can presume this code knows + what it's doing... */ + +#undef TCGETS +#undef TCSETS +#undef TCSETSW +#undef TCSETSF +#define TCGETS _IOR ('t', 19, struct __kernel_termios) +#define TCSETS _IOW ('t', 20, struct __kernel_termios) +#define TCSETSW _IOW ('t', 21, struct __kernel_termios) +#define TCSETSF _IOW ('t', 22, struct __kernel_termios) + +#endif /* kernel_termios.h */ diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/ldsodefs.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/ldsodefs.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/ldsodefs.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/ldsodefs.h 2008-08-25 23:28:19.000000000 +0900 @@ -0,0 +1,27 @@ +/* Run-time dynamic linker data structures for loaded ELF shared objects. MMIX. + Copyright (C) 2001 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 _LDSODEFS_H + +/* Get the real definitions. */ +#include_next + +#undef HAVE_AUX_VECTOR + +#endif /* ldsodefs.h */ diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/profil-counter.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/profil-counter.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/profil-counter.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/profil-counter.h 2008-07-27 10:16:21.000000000 +0900 @@ -0,0 +1,2 @@ +/* We can use the ix86 version. */ +#include diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/socket.S glibc-2.7/sysdeps/unix/sysv/linux/mmix/socket.S --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/socket.S 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/socket.S 2008-07-30 15:05:20.000000000 +0900 @@ -0,0 +1,50 @@ +/* Copyright (C) 1995-1998,2002,2003,2005 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. */ + +#include +#include +#include + +#define P(a, b) P2(a, b) +#define P2(a, b) a##b + + .text +/* The socket-oriented system calls are handled unusally in Linux. + They are all gated through the single `socketcall' system call number. + `socketcall' takes two arguments: the first is the subcode, specifying + which socket function is being called; and the second is a pointer to + the arguments to the specific function. + + The .S files for the other calls just #define socket and #include this. */ + +#ifndef __socket +# ifndef NO_WEAK_ALIAS +# define __socket P(__,socket) +# else +# define __socket socket +# endif +#endif + +.globl __socket +ENTRY (__socket) + jmp __syscall_error +PSEUDO_END (__socket) + +#ifndef NO_WEAK_ALIAS +weak_alias (__socket, socket) +#endif diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/sys/procfs.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/sys/procfs.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/sys/procfs.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/sys/procfs.h 2008-07-25 16:25:59.000000000 +0900 @@ -0,0 +1,140 @@ +/* Copyright (C) 1996, 1997, 1999, 2002, 2006 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_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somehow modelled after the file of the same name on SysVr4 + systems. It provides a definition of the core file format for ELF + used on Linux. */ + +#include +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +/* These definitions are normally provided by ucontext.h via + asm/sigcontext.h, asm/ptrace.h, and asm/elf.h. Otherwise we define + them here. */ +#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H +#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ +#define ELF_NFPREG 33 /* includes fpscr */ +#if __WORDSIZE == 32 +# define ELF_NVRREG 33 /* includes vscr */ +#else +# define ELF_NVRREG 34 /* includes vscr */ +#endif + +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +/* Altivec registers */ +typedef struct { + unsigned int u[4]; +} __attribute__ ((aligned (16))) elf_vrreg_t; +typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; +#endif + +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + gdb doesn't really use excluded. Fields present but not used are + marked with "XXX". */ +struct elf_prstatus + { +#if 0 + long int pr_flags; /* XXX Process flags. */ + short int pr_why; /* XXX Reason for process halt. */ + short int pr_what; /* XXX More detailed reason. */ +#endif + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ +#if 0 + struct sigaltstack pr_altstack; /* Alternate stack info. */ + struct sigaction pr_action; /* Signal action for current sig. */ +#endif + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ +#if 0 + long int pr_instr; /* Current instruction. */ +#endif + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + __uid_t pr_uid; + __gid_t pr_gid; + __pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore habe only ine PID type. */ +typedef __pid_t lwpid_t; + + +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/syscall.S glibc-2.7/sysdeps/unix/sysv/linux/mmix/syscall.S --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/syscall.S 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/syscall.S 2008-08-25 23:29:51.000000000 +0900 @@ -0,0 +1,36 @@ +/* + * sysdeps/unix/sysv/linux/mmix/syscall.S + * + * Copyright (C) 2008 Eiji Yoshiya (eiji-y@pb3.so-net.ne.jp) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 + */ + +#include + +ENTRY (syscall) + subu $254,$254,56 + stou $0,$254,0 + stou $1,$254,8 + stou $2,$254,16 + stou $3,$254,24 + stou $4,$254,32 + stou $5,$254,40 + stou $6,$254,48 + set $255,$254 + trap 1,255,255 + addu $254,$254,56 + ret +PSEUDO_END (syscall) diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/sysdep.c glibc-2.7/sysdeps/unix/sysv/linux/mmix/sysdep.c --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/sysdep.c 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/sysdep.c 2008-07-29 15:53:20.000000000 +0900 @@ -0,0 +1,29 @@ +/* Copyright (C) 1997, 1998 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. */ + +#include +#include + +/* This routine is jumped to by all the syscall handlers, to stash + an error number into errno. */ +int +__syscall_error (int err_no) +{ + __set_errno (err_no); + return -1; +} diff -Naur glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/sysdep.h glibc-2.7/sysdeps/unix/sysv/linux/mmix/sysdep.h --- glibc-2.7.org/sysdeps/unix/sysv/linux/mmix/sysdep.h 1970-01-01 09:00:00.000000000 +0900 +++ glibc-2.7/sysdeps/unix/sysv/linux/mmix/sysdep.h 2008-08-25 23:31:23.000000000 +0900 @@ -0,0 +1,420 @@ +/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006 + 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. */ + +/* Modified by Eiji Yoshiya , 2008. */ + +#ifndef _LINUX_MMIX_SYSDEP_H +#define _LINUX_MMIX_SYSDEP_H 1 + +#include +#include +#include + +#if 0 +/* Define __set_errno() for INLINE_SYSCALL macro below. */ +#ifndef __ASSEMBLER__ +#include +#endif + +/* Some systen calls got renamed over time, but retained the same semantics. + Handle them here so they can be catched by both C and assembler stubs in + glibc. */ + +#ifdef __NR_pread64 +# ifdef __NR_pread +# error "__NR_pread and __NR_pread64 both defined???" +# endif +# define __NR_pread __NR_pread64 +#endif + +#ifdef __NR_pwrite64 +# ifdef __NR_pwrite +# error "__NR_pwrite and __NR_pwrite64 both defined???" +# endif +# define __NR_pwrite __NR_pwrite64 +#endif +#endif //0 + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#ifdef __STDC__ +# define SYS_ify(syscall_name) __NR_##syscall_name +#else +# define SYS_ify(syscall_name) __NR_/**/syscall_name +#endif + +#ifdef __ASSEMBLER__ + +#if 0 +/* This seems to always be the case on PPC. */ +# define ALIGNARG(log2) log2 +/* For ELF we need the `.type' directive to make shared libs work right. */ +# define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; +# define ASM_SIZE_DIRECTIVE(name) .size name,.-name +#endif + +#define ENTRY(name) \ + .global name;\ +name: + +#define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY(name) \ + DO_CALL(syscall_name, args) + +#define ret \ + bn $0,0f; \ + pop 1,0; \ +0:jmp __syscall_error; + +#define PSEUD_END(name) \ + END(name) + +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .text; \ + ENTRY(name) \ + DO_CALL(syscall_name, args) + +#define ret_NOERRNO \ + pop 1,0; + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(name) \ + END(name) + +#define DO_CALL(syscall_name, args) \ + PUSHARGS_##args \ + set $255,$254; \ + trap 1,SYS_ify(syscall_name); \ + set $0,$255; \ + POPARGS_##args + +#define PUSHARGS_0 +#define POPARGS_0 + +#define PUSHARGS_1 \ + subu $254,$254,8; \ + stou $0,$254,0; +#define POPARGS_1 \ + addu $254,$254,8; + +#define PUSHARGS_2 \ + subu $254,$254,16; \ + stou $0,$254,0; \ + stou $1,$254,8; +#define POPARGS_2 \ + addu $254,$254,16; + +#define PUSHARGS_3 \ + subu $254,$254,24; \ + stou $0,$254,0; \ + stou $1,$254,8; \ + stou $2,$254,16; +#define POPARGS_3 \ + addu $254,$254,24; + +#define PUSHARGS_4 \ + subu $254,$254,32; \ + stou $0,$254,0; \ + stou $1,$254,8; \ + stou $2,$254,16; \ + stou $3,$254,24; +#define POPARGS_4 \ + addu $254,$254,32; + +#define PUSHARGS_5 \ + subu $254,$254,40; \ + stou $0,$254,0; \ + stou $1,$254,8; \ + stou $2,$254,16; \ + stou $3,$254,24; \ + stou $4,$254,32; +#define POPARGS_5 \ + addu $254,$254,40; + +#define PUSHARGS_6 \ + subu $254,$254,48; \ + stou $0,$254,0; \ + stou $1,$254,8; \ + stou $2,$254,16; \ + stou $3,$254,24; \ + stou $4,$254,32; \ + stou $5,$254,40; +#define POPARGS_6 \ + addu $254,$254,48; + +#endif /* __ASSEMBLER__ */ + +#if 0 +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. + It falls back to the syscall in the case that the vDSO doesn't + exist or fails for ENOSYS */ +#ifdef SHARED +# define INLINE_VSYSCALL(name, nr, args...) \ + ({ \ + __label__ out; \ + __label__ iserr; \ + INTERNAL_SYSCALL_DECL (sc_err); \ + long int sc_ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + goto out; \ + if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ + goto iserr; \ + } \ + \ + sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \ + if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + { \ + iserr: \ + __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ + sc_ret = -1L; \ + } \ + out: \ + sc_ret; \ + }) +#else +# define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) +#endif + +#ifdef SHARED +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + ({ \ + __label__ out; \ + long int v_ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ + || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ + goto out; \ + } \ + v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \ + out: \ + v_ret; \ + }) +#else +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL (name, err, nr, ##args) +#endif + +/* This version is for internal uses when there is no desire + to set errno */ +#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \ + ({ \ + long int sc_ret = ENOSYS; \ + \ + if (__vdso_##name != NULL) \ + sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + else \ + err = 1 << 28; \ + sc_ret; \ + }) + +/* List of system calls which are supported as vsyscalls. */ +#define HAVE_CLOCK_GETRES_VSYSCALL 1 +#define HAVE_CLOCK_GETTIME_VSYSCALL 1 + +/* Define a macro which expands inline into the wrapper code for a system + call. This use is for internal calls that do not need to handle errors + normally. It will never touch errno. This returns just what the kernel + gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) + the negation of the return value in the kernel gets reverted. */ + +#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \ + ({ \ + register void *r0 __asm__ ("r0"); \ + register long int r3 __asm__ ("r3"); \ + register long int r4 __asm__ ("r4"); \ + register long int r5 __asm__ ("r5"); \ + register long int r6 __asm__ ("r6"); \ + register long int r7 __asm__ ("r7"); \ + register long int r8 __asm__ ("r8"); \ + LOADARGS_##nr (funcptr, args); \ + __asm__ __volatile__ \ + ("mtctr %0\n\t" \ + "bctrl\n\t" \ + "mfcr %0\n\t" \ + "0:" \ + : "=&r" (r0), \ + "=&r" (r3), "=&r" (r4), "=&r" (r5), \ + "=&r" (r6), "=&r" (r7), "=&r" (r8) \ + : ASM_INPUT_##nr \ + : "r9", "r10", "r11", "r12", \ + "cr0", "ctr", "lr", "memory"); \ + err = (long int) r0; \ + (int) r3; \ + }) +#endif // 0 + +#undef INLINE_SYSCALL + +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. */ +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + INTERNAL_SYSCALL_DECL (sc_err); \ + long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ + if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ + sc_ret = -1L; \ + } \ + sc_ret; \ + }) + +/* Define a macro which expands inline into the wrapper code for a system + call. This use is for internal calls that do not need to handle errors + normally. It will never touch errno. This returns just what the kernel + gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) + the negation of the return value in the kernel gets reverted. */ + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ + ({ \ + unsigned long __sc_ret; \ + unsigned long __sc_args[nr+1]; \ + __sc_args[0] = name; \ + LOADARGS_##nr (__sc_args+1, ##args); \ + err = 0; \ + __asm__ __volatile__( \ + " set $255,%1\n" \ + " trap 1,255,255\n" \ + " set %0,$255\n" \ + : "=&r" (__sc_ret) \ + : "r"(__sc_args) \ + : "$255", "memory"); \ + (long int) __sc_ret; \ + }) + +#define INTERNAL_SYSCALL_1(name, err, nr, args...) \ + ({ \ + unsigned long __sc_ret; \ + unsigned long __sc_args[nr]; \ + LOADARGS_##nr (__sc_args, ##args); \ + err = 0; \ + __asm__ __volatile__( \ + " set $255,%1\n" \ + " trap 1,%2\n" \ + " set %0,$255\n" \ + : "=&r" (__sc_ret) \ + : "r"(__sc_args),"i"(name) \ + : "$255", "memory"); \ + (long int) __sc_ret; \ + }) +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL_1 (__NR_##name, err, nr, args) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) long int err + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= -515L) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) + +#define LOADARGS_0(args, dummy) +#define LOADARGS_1(args, __arg1) \ + long int arg1 = (long int) (__arg1); \ + extern void __illegally_sized_syscall_arg1 (void); \ + if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 8) \ + __illegally_sized_syscall_arg1 (); \ + (args)[0] = arg1 +#define LOADARGS_2(args, __arg1, __arg2) \ + long int arg2 = (long int) (__arg2); \ + LOADARGS_1(args, __arg1); \ + extern void __illegally_sized_syscall_arg2 (void); \ + if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 8) \ + __illegally_sized_syscall_arg2 (); \ + (args)[1] = arg2 +#define LOADARGS_3(args, __arg1, __arg2, __arg3) \ + long int arg3 = (long int) (__arg3); \ + LOADARGS_2(args, __arg1, __arg2); \ + extern void __illegally_sized_syscall_arg3 (void); \ + if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \ + __illegally_sized_syscall_arg3 (); \ + (args)[2] = arg3 +#define LOADARGS_4(args, __arg1, __arg2, __arg3, __arg4) \ + long int arg4 = (long int) (__arg4); \ + LOADARGS_3(args, __arg1, __arg2, __arg3); \ + extern void __illegally_sized_syscall_arg4 (void); \ + if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 8) \ + __illegally_sized_syscall_arg4 (); \ + (args)[3] = arg4 +#define LOADARGS_5(args, __arg1, __arg2, __arg3, __arg4, __arg5) \ + long int arg5 = (long int) (__arg5); \ + LOADARGS_4(args, __arg1, __arg2, __arg3, __arg4); \ + extern void __illegally_sized_syscall_arg5 (void); \ + if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 8) \ + __illegally_sized_syscall_arg5 (); \ + (args)[4] = arg5 +#define LOADARGS_6(args, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ + long int arg6 = (long int) (__arg6); \ + LOADARGS_5(args, __arg1, __arg2, __arg3, __arg4, __arg5); \ + extern void __illegally_sized_syscall_arg6 (void); \ + if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 8) \ + __illegally_sized_syscall_arg6 (); \ + (args)[5] = arg6 + +#if 0 +#define ASM_INPUT_0 "0" (r0) +#define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) +#define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) +#define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) +#define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) +#define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) +#define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) +#endif + + +/* Pointer mangling support. */ +#if defined NOT_IN_libc && defined IS_IN_rtld +/* We cannot use the thread descriptor because in ld.so we use setjmp + earlier than the descriptor is initialized. */ +#else +# ifdef __ASSEMBLER__ +#ifdef __MIX_ABI_GNU__ +# define PTR_MANGLE(reg, tmpreg) \ + ldo tmpreg,$230,POINTER_GUARD; \ + xor reg,tmpreg,reg +#else +# define PTR_MANGLE(reg, tmpreg) \ + ldo tmpreg,$246,POINTER_GUARD; \ + xor reg,tmpreg,reg +#endif +# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) +# else +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + +#endif /* linux/powerpc/powerpc64/sysdep.h */