diff options
| author | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
|---|---|---|
| committer | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
| commit | 28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch) | |
| tree | 15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/m68k | |
| download | glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip | |
initial import
Diffstat (limited to 'sysdeps/m68k')
53 files changed, 1683 insertions, 0 deletions
diff --git a/sysdeps/m68k/Implies b/sysdeps/m68k/Implies new file mode 100644 index 0000000000..a67e1c2741 --- /dev/null +++ b/sysdeps/m68k/Implies @@ -0,0 +1,2 @@ +# 68k uses IEEE 754 floating point. +ieee754 diff --git a/sysdeps/m68k/Makefile b/sysdeps/m68k/Makefile new file mode 100644 index 0000000000..ea0c7d5cbb --- /dev/null +++ b/sysdeps/m68k/Makefile @@ -0,0 +1,32 @@ +# Copyright (C) 1993, 1994 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 Library General Public License +# as published by the Free Software Foundation; either version 2 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 +# Library General Public License for more details. + +# You should have received a copy of the GNU Library General Public +# License along with the GNU C Library; see the file COPYING.LIB. If +# not, write to the Free Software Foundation, Inc., 675 Mass Ave, +# Cambridge, MA 02139, USA. + +# This uses MIT assembler syntax. We have no convenient +# way to choose a sysdep file based on MIT vs Motorola syntax. +# No existing m68k ports use Motorola syntax. + +crypt := crypt.sun3 # Use crypt/crypt.sun3.S. + +# The mpn functions need this. All existing 68k ports use MIT syntax. If +# a new port wants to use Motorola or Sony syntax, it can redefine this +# variable. +ifndef m68k-syntax-flag +m68k-syntax-flag = -DMIT_SYNTAX +endif + +asm-CPPFLAGS := $(asm-CPPFLAGS) $(m68k-syntax-flag) diff --git a/sysdeps/m68k/__longjmp.c b/sysdeps/m68k/__longjmp.c new file mode 100644 index 0000000000..4fc61084a0 --- /dev/null +++ b/sysdeps/m68k/__longjmp.c @@ -0,0 +1,56 @@ +/* Copyright (C) 1991, 1992, 1993, 1994, 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <setjmp.h> +#include <stdlib.h> + +/* Jump to the position specified by ENV, causing the + setjmp call there to return VAL, or 1 if VAL is 0. */ +void +__longjmp (__jmp_buf env, int val) +{ + /* This restores the FP and SP that setjmp's caller had, + and puts the return address into A0 and VAL into D0. */ + +#if defined(__HAVE_68881__) || defined(__HAVE_FPU__) + /* Restore the floating-point registers. */ + asm volatile("fmovem%.x %0, fp0-fp7" : + /* No outputs. */ : "g" (env[0].__fpregs[0]) : + "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7"); +#endif + + /* Put VAL in D0. */ + asm volatile("move%.l %0, d0" : /* No outputs. */ : + "g" (val == 0 ? 1 : val) : "d0"); + + asm volatile(/* Restore the data and address registers. */ + "movem%.l %0, d1-d7/a0-a7\n" + /* Return to setjmp's caller. */ +#ifdef __motorola__ + "jmp (a0)" +#else + "jmp a0@" +#endif + : /* No outputs. */ : "g" (env[0].__dregs[0]) + /* We don't bother with the clobbers, + because this code always jumps out anyway. */ + ); + + /* This call avoids `volatile function does return' warnings. */ + abort (); +} diff --git a/sysdeps/m68k/bsd-_setjmp.S b/sysdeps/m68k/bsd-_setjmp.S new file mode 100644 index 0000000000..a0b639306d --- /dev/null +++ b/sysdeps/m68k/bsd-_setjmp.S @@ -0,0 +1,42 @@ +/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. m68k version. +Copyright (C) 1994 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* This just does a tail-call to `__sigsetjmp (ARG, 0)'. + We cannot do it in C because it must be a tail-call, so frame-unwinding + in setjmp doesn't clobber the state restored by longjmp. */ + +#include <sysdep.h> + +#ifdef MOTOROLA_SYNTAX +#define d0 %d0 +#define d1 %d1 +#define PUSH(reg) move.l reg, -(%esp) +#define POP(reg) move.l (%esp)+, reg +#else +#define PUSH(reg) movel reg, sp@- +#define POP(reg) movel sp@+, reg +#endif + +ENTRY (_setjmp) + POP (d0) /* Pop return PC. */ + POP (d1) /* Pop jmp_buf argument. */ + PUSH (#0) /* Push second argument of zero. */ + PUSH (d1) /* Push back first argument. */ + PUSH (d0) /* Push back return PC. */ + jmp C_SYMBOL_NAME (__sigsetjmp) diff --git a/sysdeps/m68k/bsd-setjmp.S b/sysdeps/m68k/bsd-setjmp.S new file mode 100644 index 0000000000..d218b44279 --- /dev/null +++ b/sysdeps/m68k/bsd-setjmp.S @@ -0,0 +1,42 @@ +/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. m68k version. +Copyright (C) 1994 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. + We cannot do it in C because it must be a tail-call, so frame-unwinding + in setjmp doesn't clobber the state restored by longjmp. */ + +#include <sysdep.h> + +#ifdef MOTOROLA_SYNTAX +#define d0 %d0 +#define d1 %d1 +#define PUSH(reg) move.l reg, -(%esp) +#define POP(reg) move.l (%esp)+, reg +#else +#define PUSH(reg) movel reg, sp@- +#define POP(reg) movel sp@+, reg +#endif + +ENTRY (setjmp) + POP (d0) /* Pop return PC. */ + POP (d1) /* Pop jmp_buf argument. */ + PUSH (#1) /* Push second argument of one. */ + PUSH (d1) /* Push back first argument. */ + PUSH (d0) /* Push back return PC. */ + jmp C_SYMBOL_NAME (__sigsetjmp) diff --git a/sysdeps/m68k/bytesex.h b/sysdeps/m68k/bytesex.h new file mode 100644 index 0000000000..6f985293f2 --- /dev/null +++ b/sysdeps/m68k/bytesex.h @@ -0,0 +1,3 @@ +/* m68k is big-endian. */ + +#define __BYTE_ORDER __BIG_ENDIAN diff --git a/sysdeps/m68k/ffs.c b/sysdeps/m68k/ffs.c new file mode 100644 index 0000000000..d9ec2b1ced --- /dev/null +++ b/sysdeps/m68k/ffs.c @@ -0,0 +1,42 @@ +/* ffs -- find first set bit in a word, counted from least significant end. + For mc68020, mc68030, mc68040. + Copyright (C) 1991, 1992 Free Software Foundation, Inc. + Contributed by Torbjorn Granlund (tege@sics.se). + +The GNU C Library 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. + +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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <ansidecl.h> +#include <string.h> + +#undef ffs + +#if defined (__GNUC__) && defined (__mc68020__) + +int +DEFUN(ffs, (x), int x) +{ + int cnt; + + asm("bfffo %1{#0:#0},%0" : "=d" (cnt) : "rm" (x & -x)); + + return 32 - cnt; +} + +#else + +#include <sysdeps/generic/ffs.c> + +#endif diff --git a/sysdeps/m68k/fpu/Makefile b/sysdeps/m68k/fpu/Makefile new file mode 100644 index 0000000000..42db6381d3 --- /dev/null +++ b/sysdeps/m68k/fpu/Makefile @@ -0,0 +1,11 @@ +ifeq ($(subdir),math) +ifndef math-twiddled + +# Avoid twiddling in generic/Makefile. +math-twiddled := t + +endif + +bsdmath_dirs := $(bsdmath_dirs) mc68881 + +endif diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h new file mode 100644 index 0000000000..a9ae2d966c --- /dev/null +++ b/sysdeps/m68k/fpu/__math.h @@ -0,0 +1,168 @@ +/* Copyright (C) 1991, 1992, 1993, 1994 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifdef __GNUC__ + +#include <sys/cdefs.h> + +#ifdef __NO_MATH_INLINES +/* This is used when defining the functions themselves. Define them with + __ names, and with `static inline' instead of `extern inline' so the |
