diff options
Diffstat (limited to 'libc/sysdeps/linux/m68k')
35 files changed, 341 insertions, 573 deletions
diff --git a/libc/sysdeps/linux/m68k/Makefile.arch b/libc/sysdeps/linux/m68k/Makefile.arch index 14ce2e30a..88caa116f 100644 --- a/libc/sysdeps/linux/m68k/Makefile.arch +++ b/libc/sysdeps/linux/m68k/Makefile.arch @@ -5,8 +5,6 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := brk.c __syscall_error.c syscall.c +CSRC-y := brk.c __syscall_error.c -SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S - -include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch +SSRC-y := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S diff --git a/libc/sysdeps/linux/m68k/README.m68k b/libc/sysdeps/linux/m68k/README.m68k index a6bb17e4c..c1c1b4b5d 100644 --- a/libc/sysdeps/linux/m68k/README.m68k +++ b/libc/sysdeps/linux/m68k/README.m68k @@ -16,9 +16,9 @@ Configuration: Read and edit the Config file, carefully. TARGET_ARCH=m68k - CROSS = m68k-pic-coff- - CC = $(CROSS)gcc - STRIPTOOL = $(CROSS)strip + CROSS_COMPILE = m68k-pic-coff- + CC = $(CROSS_COMPILE)gcc + STRIPTOOL = $(CROSS_COMPILE)strip KERNEL_SOURCE=/opt/uClinux/linux HAS_MMU = false HAS_FLOATS = false diff --git a/libc/sysdeps/linux/m68k/__longjmp.S b/libc/sysdeps/linux/m68k/__longjmp.S index 5db9e4362..a93d92bff 100644 --- a/libc/sysdeps/linux/m68k/__longjmp.S +++ b/libc/sysdeps/linux/m68k/__longjmp.S @@ -2,10 +2,8 @@ /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ /* This file is released under the LGPL, any version you like */ -#define _ASM -#define _SETJMP_H #include <features.h> -#include <bits/setjmp.h> +#include <jmpbuf-offsets.h> .globl __longjmp .type __longjmp,@function @@ -17,7 +15,9 @@ __longjmp: movel #1, %d0 1: moveml %a0@(JB_REGS), %d2-%d7/%a2-%a7 -#if defined(__HAVE_68881__) || defined(__HAVE_FPU__) +#if defined __mcffpu__ && defined __UCLIBC_HAS_FPU__ + fmovem %a0@(JB_FPREGS), %fp2-%fp7 +#elif defined __HAVE_68881__ || defined __UCLIBC_HAS_FPU__ fmovemx %a0@(JB_FPREGS), %fp2-%fp7 #endif movel %a0@(JB_PC), %sp@ diff --git a/libc/sysdeps/linux/m68k/bits/byteswap.h b/libc/sysdeps/linux/m68k/bits/byteswap.h index f5ec91682..840a8cae6 100644 --- a/libc/sysdeps/linux/m68k/bits/byteswap.h +++ b/libc/sysdeps/linux/m68k/bits/byteswap.h @@ -13,55 +13,24 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ -#if !defined _BYTESWAP_H && !defined _NETINET_IN_H -# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." -#endif - -#ifndef _BITS_BYTESWAP_H -#define _BITS_BYTESWAP_H 1 - -/* Swap bytes in 16 bit value. 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)) - -/* Swap bytes in 32 bit value. */ -#define __bswap_constant_32(x) \ - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) +#ifndef _ASM_BITS_BYTESWAP_H +#define _ASM_BITS_BYTESWAP_H 1 -#if defined __GNUC__ && __GNUC__ >= 2 && !defined __mcoldfire__ -# define __bswap_32(x) \ +#if !defined __mcoldfire__ +# define __bswap_non_constant_32(x) \ __extension__ \ ({ unsigned int __bswap_32_v; \ - if (__builtin_constant_p (x)) \ - __bswap_32_v = __bswap_constant_32 (x); \ - else \ - __asm__ __volatile__ ("ror%.w %#8, %0;" \ - "swap %0;" \ - "ror%.w %#8, %0" \ - : "=d" (__bswap_32_v) \ - : "0" ((unsigned int) (x))); \ + __asm__ __volatile__ ("ror%.w %#8, %0;" \ + "swap %0;" \ + "ror%.w %#8, %0" \ + : "=d" (__bswap_32_v) \ + : "0" ((unsigned int) (x))); \ __bswap_32_v; }) -#else -# define __bswap_32(x) __bswap_constant_32 (x) #endif -#if defined __GNUC__ && __GNUC__ >= 2 -/* 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]); \ - __bswap_64_r.__ll; }) #endif -#endif /* _BITS_BYTESWAP_H */ +#include <bits/byteswap-common.h> diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h index 37e99f9e0..636934d5f 100644 --- a/libc/sysdeps/linux/m68k/bits/fcntl.h +++ b/libc/sysdeps/linux/m68k/bits/fcntl.h @@ -13,9 +13,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." @@ -49,6 +48,8 @@ # 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 */ +# define O_PATH 010000000 /* Resolve pathname but do not open file. */ #endif /* For now Linux has synchronisity options for data and read operations. @@ -98,6 +99,8 @@ # define F_NOTIFY 1026 /* Request notfications on a directory. */ # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with close-on-exit set on new fd. */ +# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ +# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */ #endif /* For F_[GET|SET]FL. */ @@ -185,7 +188,7 @@ struct flock64 #endif -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ /* Flags for SYNC_FILE_RANGE. */ # define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages in the range before performing the @@ -208,7 +211,7 @@ struct flock64 __BEGIN_DECLS -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) diff --git a/libc/sysdeps/linux/m68k/bits/fenv.h b/libc/sysdeps/linux/m68k/bits/fenv.h index 7c0bcb669..b07f0ab51 100644 --- a/libc/sysdeps/linux/m68k/bits/fenv.h +++ b/libc/sysdeps/linux/m68k/bits/fenv.h @@ -12,9 +12,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _FENV_H # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." @@ -71,9 +70,9 @@ typedef struct fenv_t; /* If the default argument is used we use this value. */ -#define FE_DFL_ENV ((__const fenv_t *) -1) +#define FE_DFL_ENV ((const fenv_t *) -1) #ifdef __USE_GNU /* Floating-point environment where none of the exceptions are masked. */ -# define FE_NOMASK_ENV ((__const fenv_t *) -2) +# define FE_NOMASK_ENV ((const fenv_t *) -2) #endif diff --git a/libc/sysdeps/linux/m68k/bits/huge_vall.h b/libc/sysdeps/linux/m68k/bits/huge_vall.h new file mode 100644 index 000000000..674b46d25 --- /dev/null +++ b/libc/sysdeps/linux/m68k/bits/huge_vall.h @@ -0,0 +1,42 @@ +/* `HUGE_VALL' constant for m68k (where it is infinity). + Used by <stdlib.h> and <math.h> functions for overflow. + Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004 + 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _MATH_H +# error "Never use <bits/huge_val.h> directly; include <math.h> instead." +#endif + +#if __GNUC_PREREQ(3,3) +# define HUGE_VALL (__builtin_huge_vall ()) +#elif __GNUC_PREREQ(2,96) +# define HUGE_VALL (__extension__ 0x1.0p32767L) +#elif defined __GNUC__ + +# define HUGE_VALL \ + (__extension__ \ + ((union { unsigned long __l[3]; long double __ld; }) \ + { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld) + +#else /* not GCC */ + +static union { unsigned char __c[12]; long double __ld; } __huge_vall = + { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } }; +# define HUGE_VALL (__huge_vall.__ld) + +#endif /* GCC 2.95. */ diff --git a/libc/sysdeps/linux/m68k/bits/kernel_stat.h b/libc/sysdeps/linux/m68k/bits/kernel_stat.h index e60362b54..3911c9bbf 100644 --- a/libc/sysdeps/linux/m68k/bits/kernel_stat.h +++ b/libc/sysdeps/linux/m68k/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ @@ -22,12 +18,9 @@ struct kernel_stat { unsigned long st_size; unsigned long st_blksize; unsigned long st_blocks; - unsigned long st_atime; - unsigned long __unused1; - unsigned long st_mtime; - unsigned long __unused2; - unsigned long st_ctime; - unsigned long __unused3; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; unsigned long __unused4; unsigned long __unused5; }; @@ -49,12 +42,9 @@ struct kernel_stat64 { unsigned long st_blksize; unsigned long __pad4; /* future possible st_blocks high bits */ unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long st_atime; - unsigned long __pad5; - unsigned long st_mtime; - unsigned long __pad6; - unsigned long st_ctime; - unsigned long __pad7; /* will be high 32 bits of ctime someday */ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; unsigned long long st_ino; }; diff --git a/libc/sysdeps/linux/m68k/bits/kernel_types.h b/libc/sysdeps/linux/m68k/bits/kernel_types.h index 0a77a8f46..176b96853 100644 --- a/libc/sysdeps/linux/m68k/bits/kernel_types.h +++ b/libc/sysdeps/linux/m68k/bits/kernel_types.h @@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; typedef long long __kernel_loff_t; typedef __kernel_dev_t __kernel_old_dev_t; +typedef long __kernel_long_t; +typedef unsigned long __kernel_ulong_t; typedef struct { #ifdef __USE_ALL diff --git a/libc/sysdeps/linux/m68k/bits/mathdef.h b/libc/sysdeps/linux/m68k/bits/mathdef.h index a69e93089..b2d2d31e4 100644 --- a/libc/sysdeps/linux/m68k/bits/mathdef.h +++ b/libc/sysdeps/linux/m68k/bits/mathdef.h @@ -12,9 +12,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !defined _MATH_H && !defined _COMPLEX_H # error "Never use <bits/mathdef.h> directly; include <math.h> instead" diff --git a/libc/sysdeps/linux/m68k/bits/mathinline.h b/libc/sysdeps/linux/m68k/bits/mathinline.h index f3166000d..0a5c802a7 100644 --- a/libc/sysdeps/linux/m68k/bits/mathinline.h +++ b/libc/sysdeps/linux/m68k/bits/mathinline.h @@ -14,9 +14,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifdef __GNUC__ @@ -92,7 +91,7 @@ # ifdef __cplusplus # define __m81_inline __inline # else -# define __m81_inline extern __inline +# define __m81_inline __extern_inline # endif # define __M81_MATH_INLINES 1 #endif @@ -351,14 +350,14 @@ __inline_functions (long double,l) /* 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__)) \ +__extern_inline rettype __attribute__((__const__)) \ name args1 \ { \ return __CONCAT(__,name) args2; \ } # define __inline_forward(rettype, name, args1, args2) \ -extern __inline rettype name args1 \ +__extern_inline rettype name args1 \ { \ return __CONCAT(__,name) args2; \ } diff --git a/libc/sysdeps/linux/m68k/bits/mman.h b/libc/sysdeps/linux/m68k/bits/mman.h deleted file mode 100644 index fbec1a03f..000000000 --- a/libc/sysdeps/linux/m68k/bits/mman.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Definitions for POSIX memory map interface. Linux/m68k version. - Copyright (C) 1997, 2000, 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. */ - -#ifndef _SYS_MMAN_H -# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." -#endif - -/* The following definitions basically come from the kernel headers. - But the kernel header is not namespace clean. */ - - -/* Protections are chosen from these bits, OR'd together. The - implementation does not necessarily support PROT_EXEC or PROT_WRITE - without PROT_READ. The only guarantees are that no writing will be - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ - -#define PROT_READ 0x1 /* Page can be read. */ -#define PROT_WRITE 0x2 /* Page can be written. */ -#define PROT_EXEC 0x4 /* Page can be executed. */ -#define PROT_NONE 0x0 /* Page can not be accessed. */ -#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of - growsdown vma (mprotect only). */ -#define PROT_GROWSUP 0x02000000 /* Extend change to start of - growsup vma (mprotect only). */ - -/* Sharing types (must choose one and only one of these). */ -#define MAP_SHARED 0x01 /* Share changes. */ -#define MAP_PRIVATE 0x02 /* Changes are private. */ -#ifdef __USE_MISC -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ -#endif - -/* Other flags. */ -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ -#ifdef __USE_MISC -# define MAP_FILE 0 -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ -# define MAP_ANON MAP_ANONYMOUS -#endif - -/* These are Linux-specific. */ -#ifdef __USE_MISC -# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ -# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ -# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ -# define MAP_LOCKED 0x02000 /* Lock the mapping. */ -# define MAP_NORESERVE 0x04000 /* 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 1 /* Lock all currently mapped pages. */ -#define MCL_FUTURE 2 /* Lock all additions to address - space. */ - -/* Flags for `mremap'. */ -#ifdef __USE_GNU -# define MREMAP_MAYMOVE 1 -# define MREMAP_FIXED 2 -#endif - -/* 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_DONTFORK 10 /* Do not inherit across fork. */ -# define MADV_DOFORK 11 /* Do inherit across fork. */ -#endif - -/* The POSIX people had to invent similar names for the same things. */ -#ifdef __USE_XOPEN2K -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ -#endif diff --git a/libc/sysdeps/linux/m68k/bits/poll.h b/libc/sysdeps/linux/m68k/bits/poll.h index f7a739315..1d845ebd2 100644 --- a/libc/sysdeps/linux/m68k/bits/poll.h +++ b/libc/sysdeps/linux/m68k/bits/poll.h @@ -12,9 +12,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." diff --git a/libc/sysdeps/linux/m68k/bits/setjmp.h b/libc/sysdeps/linux/m68k/bits/setjmp.h index a6b0ed0f1..94853f7e5 100644 --- a/libc/sysdeps/linux/m68k/bits/setjmp.h +++ b/libc/sysdeps/linux/m68k/bits/setjmp.h @@ -13,9 +13,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* Define the machine-dependent type `jmp_buf'. m68k version. */ #ifndef _BITS_SETJMP_H @@ -25,7 +24,7 @@ # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif -#ifndef _ASM +#include <features.h> typedef struct { @@ -37,7 +36,7 @@ typedef struct int *__fp; int *__sp; -#if defined __HAVE_68881__ || defined __HAVE_FPU__ +#if defined __HAVE_68881__ || defined __UCLIBC_HAS_FPU__ /* There are eight floating point registers which are saved in IEEE 96-bit extended format. */ char __fpregs[8 * (96 / 8)]; @@ -45,24 +44,4 @@ typedef struct } __jmp_buf[1]; -#endif - -#define JB_REGS 0 -#define JB_DREGS 0 -#define JB_AREGS 24 -#define JB_PC 48 -#define JB_FPREGS 52 - -#if defined __HAVE_68881__ || defined __HAVE_FPU__ -# define JB_SIZE 76 -#else -# define JB_SIZE 52 -#endif - - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)->__aregs[5]) - #endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/m68k/bits/sigcontextinfo.h b/libc/sysdeps/linux/m68k/bits/sigcontextinfo.h index b7e08cfc9..851c21d04 100644 --- a/libc/sysdeps/linux/m68k/bits/sigcontextinfo.h +++ b/libc/sysdeps/linux/m68k/bits/sigcontextinfo.h @@ -13,9 +13,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define SIGCONTEXT int _code, struct sigcontext * #define SIGCONTEXT_EXTRA_ARGS _code, diff --git a/libc/sysdeps/linux/m68k/bits/stackinfo.h b/libc/sysdeps/linux/m68k/bits/stackinfo.h index 66e5a17fb..5a31c610c 100644 --- a/libc/sysdeps/linux/m68k/bits/stackinfo.h +++ b/libc/sysdeps/linux/m68k/bits/stackinfo.h @@ -12,9 +12,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* This file contains a bit of information about the stack allocation of the processor. */ diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h index a0fefbe2b..d71670db8 100644 --- a/libc/sysdeps/linux/m68k/bits/stat.h +++ b/libc/sysdeps/linux/m68k/bits/stat.h @@ -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,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,9 +13,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_STAT_H # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." @@ -61,7 +60,7 @@ struct stat #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif -#if 0 /*def __USE_MISC*/ +#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 @@ -107,7 +106,7 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#if 0 /*def __USE_MISC*/ +#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 @@ -162,3 +161,8 @@ struct stat64 #define __S_IREAD 0400 /* Read by owner. */ #define __S_IWRITE 0200 /* Write by owner. */ #define __S_IEXEC 0100 /* Execute by owner. */ + +#ifdef __USE_ATFILE +# define UTIME_NOW ((1l << 30) - 1l) +# define UTIME_OMIT ((1l << 30) - 2l) +#endif diff --git a/libc/sysdeps/linux/m68k/bits/syscalls.h b/libc/sysdeps/linux/m68k/bits/syscalls.h index d1ade8036..17966ed06 100644 --- a/libc/sysdeps/linux/m68k/bits/syscalls.h +++ b/libc/sysdeps/linux/m68k/bits/syscalls.h @@ -13,8 +13,6 @@ #ifndef __ASSEMBLER__ -#include <errno.h> - /* Linux takes system call arguments in registers: syscall number %d0 call-clobbered @@ -23,9 +21,11 @@ arg 3 %d3 call-saved arg 4 %d4 call-saved arg 5 %d5 call-saved + arg 6 %a0 call-clobbered The stack layout upon entering the function is: + 24(%sp) Arg# 6 20(%sp) Arg# 5 16(%sp) Arg# 4 12(%sp) Arg# 3 @@ -40,160 +40,74 @@ speed is more important, we don't use movem. Since %a0 and %a1 are scratch registers, we can use them for saving as well. */ -#define __syscall_return(type, res) \ -do { \ - if ((unsigned long)(res) >= (unsigned long)(-125)) { \ - /* avoid using res which is declared to be in register d0; \ - errno might expand to a function call and clobber it. */ \ - int __err = -(res); \ - __set_errno(__err); \ - res = -1; \ - } \ - return (type) (res); \ -} while (0) - -#define _syscall0(type, name) \ -type name(void) \ -{ \ - long __res; \ - __asm__ __volatile__ ( \ - "movel %1, %%d0\n\t" \ - "trap #0\n\t" \ - "movel %%d0, %0" \ - : "=g" (__res) \ - : "i" (__NR_##name) \ - : "memory", "cc", "%d0"); \ - __syscall_return(type, __res); \ -} - -#define _syscall1(type, name, atype, a) \ -type name(atype a) \ -{ \ - long __res; \ - __asm__ __volatile__ ( \ - "movel %2, %%d1\n\t" \ - "movel %1, %%d0\n\t" \ - "trap #0\n\t" \ - "movel %%d0, %0" \ - : "=g" (__res) \ - : "i" (__NR_##name), \ - "g" ((long)a) \ - : "memory", "cc", "%d0", "%d1"); \ - __syscall_return(type, __res); \ -} - -#define _syscall2(type, name, atype, a, btype, b) \ -type name(atype a, btype b) \ -{ \ - long __res; \ - __asm__ __volatile__ ( \ - "movel %3, %%d2\n\t" \ - "movel %2, %%d1\n\t" \ - "movel %1, %%d0\n\t" \ - "trap #0\n\t" \ - "movel %%d0, %0" \ - : "=g" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)a), \ - "g" ((long)b) \ - : "memory", "cc", "%d0", "%d1", "%d2"); \ - __syscall_return(type, __res); \ -} - -#define _syscall3(type, name, atype, a, btype, b, ctype, c) \ -type name(atype a, btype b, ctype c) \ -{ \ - long __res; \ - __asm__ __volatile__ ( \ - "movel %4, %%d3\n\t" \ - "movel %3, %%d2\n\t" \ - "movel %2, %%d1\n\t" \ - "movel %1, %%d0\n\t" \ - "trap #0\n\t" \ - "movel %%d0, %0" \ - : "=g" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)a), \ - "a" ((long)b), \ - "g" ((long)c) \ - : "memory", "cc", "%d0", "%d1", "%d2", "%d3"); \ - __syscall_return(type, __res); \ -} - -#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \ -type name(atype a, btype b, ctype c, dtype d) \ -{ \ - long __res; \ - __asm__ __volatile__ ( \ - "movel %5, %%d4\n\t" \ - "movel %4, %%d3\n\t" \ - "movel %3, %%d2\n\t" \ - "movel %2, %%d1\n\t" \ - "movel %1, %%d0\n\t" \ - "trap #0\n\t" \ - "movel %%d0, %0" \ - : "=g" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)a), \ - "a" ((long)b), \ - "a" ((long)c), \ - "g" ((long)d) \ - : "memory", "cc", "%d0", "%d1", "%d2", "%d3", \ - "%d4"); \ - __syscall_return(type, __res); \ -} - -#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e) \ -type name(atype a, btype b, ctype c, dtype d, etype e) \ -{ \ - long __res; \ - __asm__ __volatile__ ( \ - "movel %6, %%d5\n\t" \ - "movel %5, %%d4\n\t" \ - "movel %4, %%d3\n\t" \ - "movel %3, %%d2\n\t" \ - "movel %2, %%d1\n\t" \ - "movel %1, %%d0\n\t" \ - "trap #0\n\t" \ - "movel %%d0, %0" \ - : "=g" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)a), \ - "a" ((long)b), \ - "a" ((long)c), \ - "a" ((long)d), \ - "g" ((long)e) \ - : "memory", "cc", "%d0", "%d1", "%d2", "%d3", \ - "%d4", "%d5"); \ - __syscall_return(type, __res); \ -} - -#define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f) \ -type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \ -{ \ - long __res; \ - __asm__ __volatile__ ( \ - "movel %7, %%a0\n\t" \ - "movel %6, %%d5\n\t" \ - "movel %5, %%d4\n\t" \ - "movel %4, %%d3\n\t" \ - "movel %3, %%d2\n\t" \ - "movel %2, %%d1\n\t" \ - "movel %1, %%d0\n\t" \ - "trap #0\n\t" \ - "movel %%d0, %0" \ - : "=g" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)a), \ - "a" ((long)b), \ - "a" ((long)c), \ - "a" ((long)d), \ - "g" ((long)e), \ - "g" ((long)f) \ - : "memory", "cc", "%d0", "%d1", "%d2", "%d3", \ - "%d4", "%d5", "%a0"); \ - __syscall_return(type, __res); \ -} +/* 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. */ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +(__extension__ \ + ({ unsigned int _sys_result; \ + { \ + /* Load argument values in temporary variables + to perform side effects like function calls + before the call used registers are set. */ \ + LOAD_ARGS_##nr (args) \ + LOAD_REGS_##nr \ + register int _d0 __asm__ ("%d0") = name; \ + __asm__ __volatile__ ("trap #0" \ + : "=d" (_d0) \ + : "0" (_d0) ASM_ARGS_##nr \ + : "memory"); \ + _sys_result = _d0; \ + } \ + (int) _sys_result; \ + }) \ +) +#define LOAD_ARGS_0() +#define LOAD_REGS_0 +#define ASM_ARGS_0 +#define LOAD_ARGS_1(a1) \ + LOAD_ARGS_0 () \ + int __arg1 = (int) (a1); +#define LOAD_REGS_1 \ + register int _d1 __asm__ ("d1") = __arg1; \ + LOAD_REGS_0 +#define ASM_ARGS_1 ASM_ARGS_0, "d" (_d1) +#define LOAD_ARGS_2(a1, a2) \ + LOAD_ARGS_1 (a1) \ + int __arg2 = (int) (a2); +#define LOAD_REGS_2 \ + register int _d2 __asm__ ("d2") = __arg2; \ + LOAD_REGS_1 +#define ASM_ARGS_2 ASM_ARGS_1, "d" (_d2) +#define LOAD_ARGS_3(a1, a2, a3) \ + LOAD_ARGS_2 (a1, a2) \ + int __arg3 = (int) (a3); +#define LOAD_REGS_3 \ + register int _d3 __asm__ ("d3") = __arg3; \ + LOAD_REGS_2 +#define ASM_ARGS_3 ASM_ARGS_2, "d" (_d3) +#define LOAD_ARGS_4(a1, a2, a3, a4) \ + LOAD_ARGS_3 (a1, a2, a3) \ + int __arg4 = (int) (a4); +#define LOAD_REGS_4 \ + register int _d4 __asm__ ("d4") = __arg4; \ + LOAD_REGS_3 +#define ASM_ARGS_4 ASM_ARGS_3, "d" (_d4) +#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \ + LOAD_ARGS_4 (a1, a2, a3, a4) \ + int __arg5 = (int) (a5); +#define LOAD_REGS_5 \ + register int _d5 __asm__ ("d5") = __arg5; \ + LOAD_REGS_4 +#define ASM_ARGS_5 ASM_ARGS_4, "d" (_d5) +#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \ + LOAD_ARGS_5 (a1, a2, a3, a4, a5) \ + int __arg6 = (int) (a6); +#define LOAD_REGS_6 \ + register int _a0 __asm__ ("a0") = __arg6; \ + LOAD_REGS_5 +#define ASM_ARGS_6 ASM_ARGS_5, "a" (_a0) #endif /* __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h index b5ef48f4b..5cfaa4343 100644 --- a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h @@ -15,8 +15,8 @@ /* can your target use syscall6() for mmap ? */ #undef __UCLIBC_MMAP_HAS_6_ARGS__ -/* does your target use syscall4() for truncate64 ? (32bit arches only) */ -#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ +/* does your target align 64bit values in register pairs ? (32bit arches only) */ +#undef __UCLIBC_SYSCALL_ALIGN_64BIT__ /* does your target have a broken create_module() ? */ #define __UCLIBC_BROKEN_CREATE_MODULE__ @@ -27,19 +27,19 @@ /* does your target have an asm .set ? */ #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ -/* define if target doesn't like .global */ -#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ - /* define if target supports .weak */ #define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ /* define if target supports .weakext */ #undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ -/* needed probably only for ppc64 */ -#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ +/* define if target supports CFI pseudo ops */ +#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__ /* define if target supports IEEE signed zero floats */ #define __UCLIBC_HAVE_SIGNED_ZERO__ +/* only weird assemblers generally need this */ +#undef __UCLIBC_ASM_LINE_SEP__ + #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_page.h b/libc/sysdeps/linux/m68k/bits/uClibc_page.h index 51c6f1446..6a202b1d2 100644 --- a/libc/sysdeps/linux/m68k/bits/uClibc_page.h +++ b/libc/sysdeps/linux/m68k/bits/uClibc_page.h @@ -11,8 +11,8 @@ * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. */ /* Supply an architecture specific value for PAGE_SIZE and friends. */ diff --git a/libc/sysdeps/linux/m68k/bits/wordsize.h b/libc/sysdeps/linux/m68k/bits/wordsize.h index ba643b60a..ca82fd7d4 100644 --- a/libc/sysdeps/linux/m68k/bits/wordsize.h +++ b/libc/sysdeps/linux/m68k/bits/wordsize.h @@ -12,8 +12,7 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define __WORDSIZE 32 diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c index 7daf1bd76..40ebf4fc7 100644 --- a/libc/sysdeps/linux/m68k/brk.c +++ b/libc/sysdeps/linux/m68k/brk.c @@ -9,7 +9,6 @@ #include <sys/syscall.h> #include <errno.h> -libc_hidden_proto(brk) /* This must be initialized data because commons can't have aliases. */ void * __curbrk = 0; diff --git a/libc/sysdeps/linux/m68k/bsd-_setjmp.S b/libc/sysdeps/linux/m68k/bsd-_setjmp.S index 0380c3dee..c963cccf5 100644 --- a/libc/sysdeps/linux/m68k/bsd-_setjmp.S +++ b/libc/sysdeps/linux/m68k/bsd-_setjmp.S @@ -2,9 +2,8 @@ /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ /* This file is released under the LGPL, any version you like */ -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <features.h> +#include <jmpbuf-offsets.h> .globl _setjmp; .type _setjmp,@function @@ -14,7 +13,7 @@ _setjmp: moveal %sp@(4), %a0 movel %sp@(0), %a0@(JB_PC) moveml %d2-%d7/%a2-%a7, %a0@(JB_REGS) -#if defined(__HAVE_68881__) || defined(__HAVE_FPU__) +#if defined __HAVE_68881__ || defined __UCLIBC_HAS_FPU__ fmovemx %fp2-%fp7, %a0@(JB_FPREGS) #endif clrl %d0 diff --git a/libc/sysdeps/linux/m68k/bsd-setjmp.S b/libc/sysdeps/linux/m68k/bsd-setjmp.S index fdd7540a6..9daf27713 100644 --- a/libc/sysdeps/linux/m68k/bsd-setjmp.S +++ b/libc/sysdeps/linux/m68k/bsd-setjmp.S @@ -2,9 +2,8 @@ /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ /* This file is released under the LGPL, any version you like */ -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <features.h> +#include <jmpbuf-offsets.h> #include "m68k_pic.S" .globl setjmp; @@ -15,7 +14,7 @@ setjmp: moveal %sp@(4), %a0 movel %sp@(0), %a0@(JB_PC) moveml %d2-%d7/%a2-%a7, %a0@(JB_REGS) -#if defined(__HAVE_68881__) || defined(__HAVE_FPU__) +#if defined __HAVE_68881__ || defined __UCLIBC_HAS_FPU__ fmovemx %fp2-%fp7, %a0@(JB_FPREGS) #endif clrl %d0 diff --git a/libc/sysdeps/linux/m68k/crt1.S b/libc/sysdeps/linux/m68k/crt1.S index a9cf00193..815a6076f 100644 --- a/libc/sysdeps/linux/m68k/crt1.S +++ b/libc/sysdeps/linux/m68k/crt1.S @@ -30,9 +30,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <features.h> #include "m68k_pic.S" diff --git a/libc/sysdeps/linux/m68k/fpu_control.h b/libc/sysdeps/linux/m68k/fpu_control.h index 040e62c94..35ad95e6d 100644 --- a/libc/sysdeps/linux/m68k/fpu_control.h +++ b/libc/sysdeps/linux/m68k/fpu_control.h @@ -13,9 +13,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _FPU_CONTROL_H #define _FPU_CONTROL_H diff --git a/libc/sysdeps/linux/m68k/jmpbuf-offsets.h b/libc/sysdeps/linux/m68k/jmpbuf-offsets.h new file mode 100644 index 000000000..fdd365d12 --- /dev/null +++ b/libc/sysdeps/linux/m68k/jmpbuf-offsets.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <features.h> + +#define JB_REGS 0 +#define JB_DREGS 0 +#define JB_AREGS 24 +#define JB_PC 48 +#define JB_FPREGS 52 + +#if defined __HAVE_68881__ || defined __UCLIBC_HAS_FPU__ +# define JB_SIZE 76 +#else +# define JB_SIZE 52 +#endif diff --git a/libc/sysdeps/linux/m68k/jmpbuf-unwind.h b/libc/sysdeps/linux/m68k/jmpbuf-unwind.h new file mode 100644 index 000000000..d87ace333 --- /dev/null +++ b/libc/sysdeps/linux/m68k/jmpbuf-unwind.h @@ -0,0 +1,11 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +#include <setjmp.h> + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)->__aregs[5]) diff --git a/libc/sysdeps/linux/m68k/setjmp.S b/libc/sysdeps/linux/m68k/setjmp.S index 4adda0af5..5f05b8591 100644 --- a/libc/sysdeps/linux/m68k/setjmp.S +++ b/libc/sysdeps/linux/m68k/setjmp.S @@ -2,9 +2,8 @@ /* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */ /* This file is released under the LGPL, any version you like */ -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <features.h> +#include <jmpbuf-offsets.h> #include "m68k_pic.S" .globl __sigsetjmp; @@ -15,7 +14,7 @@ __sigsetjmp: moveal %sp@(4), %a0 movel %sp@(0), %a0@(JB_PC) moveml %d2-%d7/%a2-%a7, %a0@(JB_REGS) -#if defined(__HAVE_68881__) || defined(__HAVE_FPU__) +#if defined __HAVE_68881__ || defined __UCLIBC_HAS_FPU__ fmovemx %fp2-%fp7, %a0@(JB_FPREGS) #endif clrl %d0 diff --git a/libc/sysdeps/linux/m68k/sys/procfs.h b/libc/sysdeps/linux/m68k/sys/procfs.h index 27abf8ef5..1722bf0f2 100644 --- a/libc/sysdeps/linux/m68k/sys/procfs.h +++ b/libc/sysdeps/linux/m68k/sys/procfs.h @@ -12,9 +12,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PROCFS_H #define _SYS_PROCFS_H 1 diff --git a/libc/sysdeps/linux/m68k/sys/reg.h b/libc/sysdeps/linux/m68k/sys/reg.h deleted file mode 100644 index 418f8323f..000000000 --- a/libc/sysdeps/linux/m68k/sys/reg.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright (C) 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. */ - -#ifndef _SYS_REG_H -#define _SYS_REG_H 1 - -/* Index into an array of 4 byte integers returned from ptrace for - location of the users' stored general purpose registers. */ - -enum -{ - PT_D1 = 0, -#define PT_D1 PT_D1 - PT_D2 = 1, -#define PT_D2 PT_D2 - PT_D3 = 2, -#define PT_D3 PT_D3 - PT_D4 = 3, -#define PT_D4 PT_D4 - PT_D5 = 4, -#define PT_D5 PT_D5 - PT_D6 = 5, -#define PT_D6 PT_D6 - PT_D7 = 6, -#define PT_D7 PT_D7 - PT_A0 = 7, -#define PT_A0 PT_A0 - PT_A1 = 8, -#define PT_A1 PT_A1 - PT_A2 = 9, -#define PT_A2 PT_A2 - PT_A3 = 10, -#define PT_A3 PT_A3 - PT_A4 = 11, -#define PT_A4 PT_A4 - PT_A5 = 12, -#define PT_A5 PT_A5 - PT_A6 = 13, -#define PT_A6 PT_A6 - PT_D0 = 14, -#define PT_D0 PT_D0 - PT_USP = 15, -#define PT_USP PT_USP - PT_ORIG_D0 = 16, -#define PT_ORIG_D0 PT_ORIG_D0 - PT_SR = 17, -#define PT_SR PT_SR - PT_PC = 18, -#define PT_PC PT_PC - PT_FP0 = 21, -#define PT_FP0 PT_FP0 - PT_FP1 = 24, -#define PT_FP1 PT_FP1 - PT_FP2 = 27, -#define PT_FP2 PT_FP2 - PT_FP3 = 30, -#define PT_FP3 PT_FP3 - PT_FP4 = 33, -#define PT_FP4 PT_FP4 - PT_FP5 = 36, -#define PT_FP5 PT_FP5 - PT_FP6 = 39, -#define PT_FP6 PT_FP6 - PT_FP7 = 42, -#define PT_FP7 PT_FP7 - PT_FPCR = 45, -#define PT_FPCR PT_FPCR - PT_FPSR = 46, -#define PT_FPSR PT_FPSR - PT_FPIAR = 47 -#define PT_FPIAR PT_FPIAR -}; - -#endif /* _SYS_REG_H */ diff --git a/libc/sysdeps/linux/m68k/sys/ucontext.h b/libc/sysdeps/linux/m68k/sys/ucontext.h index 3c441dc5c..85d2dd90e 100644 --- a/libc/sysdeps/linux/m68k/sys/ucontext.h +++ b/libc/sysdeps/linux/m68k/sys/ucontext.h @@ -12,9 +12,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* System V/m68k ABI compliant context switching support. */ diff --git a/libc/sysdeps/linux/m68k/sys/user.h b/libc/sysdeps/linux/m68k/sys/user.h new file mode 100644 index 000000000..8114a2bd3 --- /dev/null +++ b/libc/sysdeps/linux/m68k/sys/user.h @@ -0,0 +1,90 @@ +#ifndef _M68K_USER_H +#define _M68K_USER_H +/* + This file was taken verbatim from linux-2.6.26.5. + The linux kernel is Copyright (C) Linus Torvalds et al. + and is licensed under the GNU General Public License, version 2. +*/ +/* Core file format: The core file is written in such a way that gdb + can understand it and provide useful information to the user (under + linux we use the 'trad-core' bfd). There are quite a number of + obstacles to being able to view the contents of the floating point + registers, and until these are solved you will not be able to view the + contents of them. Actually, you can read in the core file and look at + the contents of the user struct to find out what the floating point + registers contain. + The actual file contents are as follows: + UPAGE: 1 page consisting of a user struct that tells gdb what is present + in the file. Directly after this is a copy of the task_struct, which + is currently not used by gdb, but it may come in useful at some point. + All of the registers are stored as part of the upage. The upage should + always be only one page. + DATA: The data area is stored. We use current->end_text to + current->brk to pick up all of the user variables, plus any memory + that may have been malloced. No attempt is made to determine if a page + is demand-zero or if a page is totally unused, we just cover the entire + range. All of the addresses are rounded in such a way that an integral + number of pages is written. + STACK: We need the stack information in order to get a meaningful + backtrace. We need to write the data from (esp) to + current->start_stack, so we round each of these off in order to be able + to write an integer number of pages. + The minimum core file size is 3 pages, or 12288 bytes. +*/ + +struct user_m68kfp_struct { + unsigned long fpregs[8*3]; /* fp0-fp7 registers */ + unsigned long fpcntl[3]; /* fp control regs */ +}; + +/* This is the old layout of "struct pt_regs" as of Linux 1.x, and + is still the layout used by user (the new pt_regs doesn't have + all registers). */ +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; +}; + + +/* When the kernel dumps core, it starts by dumping the user struct - + this will be used by gdb to figure out where the data and stack segments + are within the file, and what virtual addresses to use. */ +struct user{ +/* We start with the registers, to mimic the way that "memory" is returned + from the ptrace(3,...) function. */ + struct user_regs_struct regs; /* Where the registers are actually stored */ +/* ptrace does not yet supply these. Someday.... */ + int u_fpvalid; /* True if math co-processor being used. */ + /* for this mess. Not yet used. */ + struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */ +/* The rest of this junk is to help gdb figure out what goes where */ + unsigned long int u_tsize; /* Text segment size (pages). */ + unsigned long int u_dsize; /* Data segment size (pages). */ + unsigned long int u_ssize; /* Stack segment size (pages). */ + unsigned long start_code; /* Starting virtual address of text. */ + unsigned long start_stack; /* Starting virtual address of stack area. + This is actually the bottom of the stack, + the top of the stack is always found in the + esp register. */ + long int signal; /* Signal that caused the core dump. */ + int reserved; /* No longer used */ + unsigned long u_ar0; /* Used by gdb to help find the values for */ + /* the registers. */ + struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */ + unsigned long magic; /* To uniquely identify a core file */ + char u_comm[32]; /* User command that was responsible */ +}; +#define NBPG 4096 +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif diff --git a/libc/sysdeps/linux/m68k/syscall.c b/libc/sysdeps/linux/m68k/syscall.c deleted file mode 100644 index 5b13ea695..000000000 --- a/libc/sysdeps/linux/m68k/syscall.c +++ /dev/null @@ -1,47 +0,0 @@ -/* syscall for m68k/uClibc - * - * Copyright (C) 2005-2006 by Christian Magnusson <mag@mag.cx> - * Copyright (C) 2005-2006 Erik Andersen <andersen@uclibc.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library 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 Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <features.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/syscall.h> - -long syscall(long sysnum, long a, long b, long c, long d, long e, long f); -long syscall(long sysnum, long a, long b, long c, long d, long e, long f) -{ - long __res; - __asm__ __volatile__ ( - "movel %7, %%a0\n\t" - "movel %6, %%d5\n\t" - "movel %5, %%d4\n\t" - "movel %4, %%d3\n\t" - "movel %3, %%d2\n\t" - "movel %2, %%d1\n\t" - "movel %1, %%d0\n\t" - "trap #0\n\t" - "movel %%d0, %0" - : "=g" (__res) - : "g" (sysnum), - "g" ((long)a), "g" ((long)b), "g" ((long)c), - "g" ((long)d), "g" ((long)e), "g" ((long)f) - : "memory", "cc", "%d0", "%d1", "%d2", "%d3", - "%d4", "%d5", "%a0"); - __syscall_return(long,__res); -} diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index 56d57f73c..bde9d5a3a 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -4,9 +4,7 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <features.h> - -#include <asm/unistd.h> +#include <sys/syscall.h> #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ @@ -16,7 +14,6 @@ .text .align 2 - .globl errno .globl __vfork .hidden __vfork .type __vfork,@function @@ -25,21 +22,24 @@ __vfork: movl %sp@+, %a1 /* save the return address for later */ movl IMM __NR_vfork,%d0 trap #0 - movl IMM -4097, %d1 - cmpl %d0, %d1 - bcs fix_errno - jmp %a1@ /* don't return, just jmp directly */ -fix_errno: - negl %d0 + movl %a1, -(%sp) + + cmpil #-4096,%d0 + blss 1f + + neg.l %d0 #ifndef __PIC__ /* needs handling as the other archs */ movl errno, %a0 #else movl errno@GOT(%a5), %a0 #endif movl %d0, %a0@ - movl IMM -1, %d0 - jmp %a1@ /* don't return, just jmp directly */ + move.l #-1, %d0 + +1: + move.l %d0, %a0 + rts .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) |
