This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Update m68k sysdeps files


This patch brings m68k sysdeps files up to date in line for those for
other GNU/Linux targets, in preparation for the work on implementing
NPTL for m68k/ColdFire.  (I have not yet exhaustively checked for
everything that should be in kernel-features.h; it has those m68k
definitions that were in the libc copy before definitions for ports
platforms were removed, and a few definitions for more recent
features.)  This is of course untested, as it won't be possible to
build glibc for m68k until the NPTL work is complete, but I think it
brings the port much closer to the right basis for the NPTL work.

2008-08-08  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/m68k/bits/byteswap.h: Allow inclusion from <endian.h>.
	(__bswap_constant_16): Define.
	(__bswap_16): Allow arguments with side effects.
	(__bswap_constant_32): Ensure result is unsigned.
	(__bswap_32): Define as inline function in fallback case.
	(__bswap_constant_64): Define.
	(__bswap_64): Use it for constant arguments.
	* sysdeps/m68k/bits/setjmp.h (__jmp_buf): Give name to structure
	type.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Only allow inclusion
	from <math.h>.  Do not use extern inline directly.
	* sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Include <bits/uio.h>.
	(O_CLOEXEC, SYNC_FILE_RANGE_WAIT_BEFORE, SYNC_FILE_RANGE_WRITE,
	SYNC_FILE_RANGE_WAIT_AFTER, SPLICE_F_MOVE, SPLICE_F_NONBLOCK,
	SPLICE_F_MORE, SPLICE_F_GIFT): Define.
	(sync_file_range, vmsplice, splice, tee): Declare.
	* sysdeps/unix/sysv/linux/m68k/bits/mman.h (MADV_REMOVE): Define.
	* sysdeps/unix/sysv/linux/m68k/bits/poll.h (POLLMSG, POLLREMOVE,
	POLLRDHUP): Define.
	* sysdeps/unix/sysv/linux/m68k/bits/stat.h (UTIME_NOW,
	UTIME_OMIT): Define.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h: New.
	* sysdeps/unix/sysv/linux/m68k/sys/user.h: New.

diff -ruN ports.orig/sysdeps/m68k/bits/byteswap.h ports/sysdeps/m68k/bits/byteswap.h
--- ports.orig/sysdeps/m68k/bits/byteswap.h	2006-10-03 14:47:35.000000000 +0000
+++ ports/sysdeps/m68k/bits/byteswap.h	2008-08-08 20:34:58.000000000 +0000
@@ -1,5 +1,5 @@
 /* Macros to swap the order of bytes in integer values.  m68k version.
-   Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2002, 2008 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
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
 # error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
 #endif
 
@@ -27,13 +27,25 @@
 /* Swap bytes in 16 bit value.  We don't provide an assembler version
    because GCC is smart enough to generate optimal assembler output, and
    this allows for better cse.  */
-#define __bswap_16(x) \
-  ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+#define __bswap_constant_16(x) \
+     ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))
+
+#ifdef __GNUC__
+# define __bswap_16(x) \
+    (__extension__							      \
+     ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); }))
+#else
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+  return __bswap_constant_16 (__bsx);
+}
+#endif
 
 /* Swap bytes in 32 bit value.  */
 #define __bswap_constant_32(x) \
-  ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \
-   (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
+     ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >>  8) |	      \
+      (((x) & 0x0000ff00u) <<  8) | (((x) & 0x000000ffu) << 24))
 
 #if defined __GNUC__ && __GNUC__ >= 2 && !defined(__mcoldfire__)
 # define __bswap_32(x) \
@@ -49,18 +61,38 @@
 			     : "0" ((unsigned int) (x)));	\
      __bswap_32_v; })
 #else
-# define __bswap_32(x) __bswap_constant_32 (x)
+static __inline unsigned int
+__bswap_32 (unsigned int __bsx)
+{
+  return __bswap_constant_32 (__bsx);
+}
 #endif
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Swap bytes in 64 bit value.  */
+# define __bswap_constant_64(x) \
+     ((((x) & 0xff00000000000000ull) >> 56)				      \
+      | (((x) & 0x00ff000000000000ull) >> 40)				      \
+      | (((x) & 0x0000ff0000000000ull) >> 24)				      \
+      | (((x) & 0x000000ff00000000ull) >> 8)				      \
+      | (((x) & 0x00000000ff000000ull) << 8)				      \
+      | (((x) & 0x0000000000ff0000ull) << 24)				      \
+      | (((x) & 0x000000000000ff00ull) << 40)				      \
+      | (((x) & 0x00000000000000ffull) << 56))
+
+/* Swap bytes in 64 bit value.  */
 # define __bswap_64(x) \
   __extension__								\
   ({ union { unsigned long long int __ll;				\
 	     unsigned long int __l[2]; } __bswap_64_v, __bswap_64_r;	\
-     __bswap_64_v.__ll = (x);						\
-     __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]);		\
-     __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]);		\
+     if (__builtin_constant_p (x))					\
+       __bswap_64_r.__ll = __bswap_constant_64 (x);			\
+     else								\
+       {								\
+	 __bswap_64_v.__ll = (x);					\
+	 __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]);	\
+	 __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]);	\
+       }								\
      __bswap_64_r.__ll; })
 #endif
 
diff -ruN ports.orig/sysdeps/m68k/bits/setjmp.h ports/sysdeps/m68k/bits/setjmp.h
--- ports.orig/sysdeps/m68k/bits/setjmp.h	2006-10-03 14:47:35.000000000 +0000
+++ ports/sysdeps/m68k/bits/setjmp.h	2008-08-08 20:25:52.000000000 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2005,2006,2008 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
@@ -24,7 +24,7 @@
 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
 #endif
 
-typedef struct
+typedef struct __jmp_buf_internal_tag
   {
     /* There are eight 4-byte data registers, but D0 is not saved.  */
     long int __dregs[7];
diff -ruN ports.orig/sysdeps/m68k/m680x0/fpu/bits/mathinline.h ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
--- ports.orig/sysdeps/m68k/m680x0/fpu/bits/mathinline.h	2006-10-03 14:44:26.000000000 +0000
+++ ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h	2008-08-08 20:57:12.000000000 +0000
@@ -1,5 +1,5 @@
 /* Definitions of inline math functions implemented by the m68881/2.
-   Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004
+   Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004, 2008
      Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,6 +18,16 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#ifndef _MATH_H
+# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+#endif
+
+#ifndef __extern_inline
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE __extern_inline
+#endif
+
 #ifdef	__GNUC__
 
 #ifdef __USE_ISOC99
@@ -89,11 +99,7 @@
 # define __m81_inline		static __inline
 #else
 # define __m81_u(x)		x
-# ifdef __cplusplus
-#  define __m81_inline		__inline
-# else
-#  define __m81_inline		extern __inline
-# endif
+# define __m81_inline __MATH_INLINE
 # define __M81_MATH_INLINES	1
 #endif
 
@@ -351,14 +357,14 @@
 /* Note that there must be no whitespace before the argument passed for
    NAME, to make token pasting work correctly with -traditional.  */
 # define __inline_forward_c(rettype, name, args1, args2)	\
-extern __inline rettype __attribute__((__const__))		\
+__MATH_INLINE rettype __attribute__((__const__))		\
   name args1							\
 {								\
   return __CONCAT(__,name) args2;				\
 }
 
 # define __inline_forward(rettype, name, args1, args2)	\
-extern __inline rettype name args1			\
+__MATH_INLINE rettype name args1			\
 {							\
   return __CONCAT(__,name) args2;			\
 }
diff -ruN ports.orig/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
--- ports.orig/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h	2007-10-22 13:51:12.000000000 +0000
+++ ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h	2008-08-08 21:04:37.000000000 +0000
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2004, 2008 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
@@ -21,8 +21,11 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -46,6 +49,7 @@
 # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
 # define O_DIRECT	0200000	/* Direct disk access.	*/
 # 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.
@@ -181,10 +185,55 @@
 # 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 -ruN ports.orig/sysdeps/unix/sysv/linux/m68k/bits/mman.h ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h
--- ports.orig/sysdeps/unix/sysv/linux/m68k/bits/mman.h	2006-02-16 00:15:09.000000000 +0000
+++ ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h	2008-08-08 21:07:07.000000000 +0000
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/m68k version.
-   Copyright (C) 1997, 2000, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2003, 2005, 2008 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
@@ -88,6 +88,7 @@
 # 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
diff -ruN ports.orig/sysdeps/unix/sysv/linux/m68k/bits/poll.h ports/sysdeps/unix/sysv/linux/m68k/bits/poll.h
--- ports.orig/sysdeps/unix/sysv/linux/m68k/bits/poll.h	2001-07-31 07:46:06.000000000 +0000
+++ ports/sysdeps/unix/sysv/linux/m68k/bits/poll.h	2008-08-08 21:09:20.000000000 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2008 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
@@ -35,6 +35,13 @@
 # define POLLWRBAND	0x100		/* Priority data may be written.  */
 #endif
 
+#ifdef __USE_GNU
+/* These are extensions for Linux.  */
+# define POLLMSG	0x400
+# define POLLREMOVE	0x1000
+# define POLLRDHUP	0x2000
+#endif
+
 /* Event types always implicitly polled for.  These bits need not be set in
    `events', but they will appear in `revents' to indicate the status of
    the file descriptor.  */
diff -ruN ports.orig/sysdeps/unix/sysv/linux/m68k/bits/stat.h ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
--- ports.orig/sysdeps/unix/sysv/linux/m68k/bits/stat.h	2003-06-26 17:00:37.000000000 +0000
+++ ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h	2008-08-08 21:13:30.000000000 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002,2008
      Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -162,3 +162,9 @@
 #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 -ruN ports.orig/sysdeps/unix/sysv/linux/m68k/kernel-features.h ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
--- ports.orig/sysdeps/unix/sysv/linux/m68k/kernel-features.h	1970-01-01 00:00:00.000000000 +0000
+++ ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h	2008-08-08 21:50:09.000000000 +0000
@@ -0,0 +1,41 @@
+/* Set flags signalling availability of kernel features based on given
+   kernel version number.
+   Copyright (C) 2008 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.  */
+
+/* These features were surely available with 2.4.12.  */
+#if __LINUX_KERNEL_VERSION >= 132108
+# define __ASSUME_MMAP2_SYSCALL		1
+# define __ASSUME_TRUNCATE64_SYSCALL	1
+# define __ASSUME_STAT64_SYSCALL	1
+# define __ASSUME_FCNTL64		1
+# define __ASSUME_VFORK_SYSCALL		1
+#endif
+
+/* Many syscalls were added in 2.6.10 for m68k.  */
+#if __LINUX_KERNEL_VERSION >= 132618
+# define __ASSUME_TGKILL	1
+# define __ASSUME_UTIMES	1
+# define __ASSUME_FADVISE64_64_SYSCALL	1
+#endif
+
+#include_next <kernel-features.h>
+
+/* These syscalls are not implemented yet for m68k.  */
+#undef __ASSUME_PSELECT
+#undef __ASSUME_PPOLL
diff -ruN ports.orig/sysdeps/unix/sysv/linux/m68k/sys/user.h ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
--- ports.orig/sysdeps/unix/sysv/linux/m68k/sys/user.h	1970-01-01 00:00:00.000000000 +0000
+++ ports/sysdeps/unix/sysv/linux/m68k/sys/user.h	2008-08-08 20:47:20.000000000 +0000
@@ -0,0 +1,61 @@
+/* Copyright (C) 2008 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_USER_H
+#define _SYS_USER_H	1
+
+/* The whole purpose of this file is for GDB and GDB only.  Don't read
+   too much into it.  Don't use it for anything other than GDB unless
+   you know what you are doing.  */
+
+struct user_m68kfp_struct {
+	unsigned long fpregs[8*3];
+	unsigned long fpcntl[3];
+};
+
+struct user_regs_struct {
+	long d1, d2, d3, d4, d5, d6, d7;
+	long a0, a1, a2, a3, a4, a5, a6;
+	long d0;
+	long usp;
+	long orig_d0;
+	short stkadj;
+	short sr;
+	long pc;
+	short fmtvec;
+	short __fill;
+};
+
+struct user {
+	struct user_regs_struct regs;
+	int u_fpvalid;
+	struct user_m68kfp_struct m68kfp;
+	unsigned long int u_tsize;
+	unsigned long int u_dsize;
+	unsigned long int u_ssize;
+	unsigned long start_code;
+	unsigned long start_stack;
+	long int signal;
+	int reserved;
+	unsigned long u_ar0;
+	struct user_m68kfp_struct *u_fpstate;
+	unsigned long magic;
+	char u_comm[32];
+};
+
+#endif

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]