diff options
| author | Joseph Myers <joseph@codesourcery.com> | 2014-02-10 23:30:21 +0000 |
|---|---|---|
| committer | Joseph Myers <joseph@codesourcery.com> | 2014-02-10 23:30:21 +0000 |
| commit | 2ad7600be76ada35c6e9f0baa75bc96252785268 (patch) | |
| tree | 15f3bfba2d40ea05b02fdbf584aa9f403df2cdbc /sysdeps/mips/mips64 | |
| parent | 384b7b4309cbbbe84481973b84ead98bb4fc54be (diff) | |
| download | glibc-2ad7600be76ada35c6e9f0baa75bc96252785268.tar.xz glibc-2ad7600be76ada35c6e9f0baa75bc96252785268.zip | |
Move mips from ports to libc.
I've moved the MIPS port from ports to the main sysdeps hierarchy.
Beyond the README update, the move of the files was simply
git mv ports/sysdeps/mips sysdeps/mips
git mv ports/sysdeps/unix/mips sysdeps/unix/mips
git mv ports/sysdeps/unix/sysv/linux/mips sysdeps/unix/sysv/linux/mips
and in addition to the ChangeLog entries here, I put a note at the top
of ports/ChangeLog.mips similar to those in other files.
Tested that disassembly of installed shared libraries for mips is the
same before and after this patch (except for ld.so where paths in
assertions are involved, as for arm).
* sysdeps/mips: Move directory from ports/sysdeps/mips.
* sysdeps/unix/mips: Move directory from ports/sysdeps/unix/mips.
* sysdeps/unix/sysv/linux/mips: Move directory from
ports/sysdeps/unix/sysv/linux/mips.
* README: Update listing for mips-*-linux-gnu and
mips64-*-linux-gnu.
* sysdeps/mips: Move directory to ../sysdeps/mips.
* sysdeps/unix/mips: Move directory to ../sysdeps/unix/mips.
* sysdeps/unix/sysv/linux/mips: Move directory to
../sysdeps/unix/sysv/linux/mips.
Diffstat (limited to 'sysdeps/mips/mips64')
32 files changed, 18086 insertions, 0 deletions
diff --git a/sysdeps/mips/mips64/Implies b/sysdeps/mips/mips64/Implies new file mode 100644 index 0000000000..826ff1541f --- /dev/null +++ b/sysdeps/mips/mips64/Implies @@ -0,0 +1,4 @@ +# MIPS uses IEEE 754 floating point. +mips/ieee754 +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/mips/mips64/Versions b/sysdeps/mips/mips64/Versions new file mode 100644 index 0000000000..253a65f04e --- /dev/null +++ b/sysdeps/mips/mips64/Versions @@ -0,0 +1,7 @@ +libm { + GLIBC_2.1 { + # A generic bug got this omitted from other configurations' version + # sets, but we always had it. + exp2l; + } +} diff --git a/sysdeps/mips/mips64/__longjmp.c b/sysdeps/mips/mips64/__longjmp.c new file mode 100644 index 0000000000..d8697b4e4c --- /dev/null +++ b/sysdeps/mips/mips64/__longjmp.c @@ -0,0 +1,97 @@ +/* Copyright (C) 1992-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + 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/>. */ + +#include <setjmp.h> +#include <sgidefs.h> +#include <stdlib.h> + +#ifndef __GNUC__ + #error This file uses GNU C extensions; you must compile with GCC. +#endif + +void +__longjmp (env_arg, val_arg) + __jmp_buf env_arg; + int val_arg; +{ + /* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before + the hack around it); force it to use $a1 for the longjmp value. + Without this it saves $a1 in a register which gets clobbered + along the way. */ + register struct __jmp_buf_internal_tag *env asm ("a0"); + register int val asm ("a1"); +#ifdef CHECK_SP + register long long sp asm ("$29"); + CHECK_SP (env[0].__sp, sp, long long); +#endif + +#ifdef __mips_hard_float + /* Pull back the floating point callee-saved registers. */ +#if _MIPS_SIM == _ABI64 + asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[0])); + asm volatile ("l.d $f25, %0" : : "m" (env[0].__fpregs[1])); + asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[2])); + asm volatile ("l.d $f27, %0" : : "m" (env[0].__fpregs[3])); + asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4])); + asm volatile ("l.d $f29, %0" : : "m" (env[0].__fpregs[5])); + asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[6])); + asm volatile ("l.d $f31, %0" : : "m" (env[0].__fpregs[7])); +#else + asm volatile ("l.d $f20, %0" : : "m" (env[0].__fpregs[0])); + asm volatile ("l.d $f22, %0" : : "m" (env[0].__fpregs[1])); + asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[2])); + asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[3])); + asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4])); + asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5])); +#endif +#endif + + /* Get the GP. */ + asm volatile ("ld $gp, %0" : : "m" (env[0].__gp)); + + /* Get the callee-saved registers. */ + asm volatile ("ld $16, %0" : : "m" (env[0].__regs[0])); + asm volatile ("ld $17, %0" : : "m" (env[0].__regs[1])); + asm volatile ("ld $18, %0" : : "m" (env[0].__regs[2])); + asm volatile ("ld $19, %0" : : "m" (env[0].__regs[3])); + asm volatile ("ld $20, %0" : : "m" (env[0].__regs[4])); + asm volatile ("ld $21, %0" : : "m" (env[0].__regs[5])); + asm volatile ("ld $22, %0" : : "m" (env[0].__regs[6])); + asm volatile ("ld $23, %0" : : "m" (env[0].__regs[7])); + + /* Get the PC. */ + asm volatile ("ld $31, %0" : : "m" (env[0].__pc)); + + + /* Restore the stack pointer and the FP. They have to be restored + last and in a single asm as gcc, depending on options used, may + use either of them to access env. */ + asm volatile ("ld $29, %0\n\t" + "ld $30, %1\n\t" : : "m" (env[0].__sp), "m" (env[0].__fp)); + +/* Give setjmp 1 if given a 0, or what they gave us if non-zero. */ + if (val == 0) + asm volatile ("dli $2, 1"); + else + asm volatile ("move $2, %0" : : "r" (val)); + + asm volatile ("j $31"); + + /* Avoid `volatile function does return' warnings. */ + for (;;); +} diff --git a/sysdeps/mips/mips64/add_n.S b/sysdeps/mips/mips64/add_n.S new file mode 100644 index 0000000000..6b9c93828b --- /dev/null +++ b/sysdeps/mips/mips64/add_n.S @@ -0,0 +1,125 @@ +/* MIPS3 __mpn_add_n -- Add two limb vectors of the same length > 0 and + * store sum in a third limb vector. + * + * Copyright (C) 1995-2014 Free Software Foundation, Inc. + * + * This file is part of the GNU MP Library. + * + * The GNU MP 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 MP 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 MP Library. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#include <sysdep.h> +#include <sys/asm.h> + +/* + * INPUT PARAMETERS + * res_ptr $4 + * s1_ptr $5 + * s2_ptr $6 + * size $7 + */ +#ifdef __PIC__ + .option pic2 +#endif +ENTRY (__mpn_add_n) +#ifdef __PIC__ + SETUP_GP /* ??? unused */ +#endif + .set noreorder + .set nomacro + + ld $10,0($5) + ld $11,0($6) + + daddiu $7,$7,-1 + and $9,$7,4-1 # number of limbs in first loop + beq $9,$0,L(L0) # if multiple of 4 limbs, skip first loop + move $2,$0 + + dsubu $7,$7,$9 + +L(Loop0): daddiu $9,$9,-1 + ld $12,8($5) + daddu $11,$11,$2 + ld $13,8($6) + sltu $8,$11,$2 + daddu $11,$10,$11 + sltu $2,$11,$10 + sd $11,0($4) + or $2,$2,$8 + + daddiu $5,$5,8 + daddiu $6,$6,8 + move $10,$12 + move $11,$13 + bne $9,$0,L(Loop0) + daddiu $4,$4,8 + +L(L0): beq $7,$0,L(Lend) + nop + +L(Loop): daddiu $7,$7,-4 + + ld $12,8($5) + daddu $11,$11,$2 + ld $13,8($6) + sltu $8,$11,$2 + daddu $11,$10,$11 + sltu $2,$11,$10 + sd $11,0($4) + or $2,$2,$8 + + ld $10,16($5) + daddu $13,$13,$2 + ld $11,16($6) + sltu $8,$13,$2 + daddu $13,$12,$13 + sltu $2,$13,$12 + sd $13,8($4) + or $2,$2,$8 + + ld $12,24($5) + daddu $11,$11,$2 + ld $13,24($6) + sltu $8,$11,$2 + daddu $11,$10,$11 + sltu $2,$11,$10 + sd $11,16($4) + or $2,$2,$8 + + ld $10,32($5) + daddu $13,$13,$2 + ld $11,32($6) + sltu $8,$13,$2 + daddu $13,$12,$13 + sltu $2,$13,$12 + sd $13,24($4) + or $2,$2,$8 + + daddiu $5,$5,32 + daddiu $6,$6,32 + + bne $7,$0,L(Loop) + daddiu $4,$4,32 + +L(Lend): daddu $11,$11,$2 + sltu $8,$11,$2 + daddu $11,$10,$11 + sltu $2,$11,$10 + sd $11,0($4) + j $31 + or $2,$2,$8 + +END (__mpn_add_n) diff --git a/sysdeps/mips/mips64/addmul_1.S b/sysdeps/mips/mips64/addmul_1.S new file mode 100644 index 0000000000..57edd4aa76 --- /dev/null +++ b/sysdeps/mips/mips64/addmul_1.S @@ -0,0 +1,101 @@ +/* MIPS3 __mpn_addmul_1 -- Multiply a limb vector with a single limb and + * add the product to a second limb vector. + * + * Copyright (C) 1992-2014 Free Software Foundation, Inc. + * + * This file is part of the GNU MP Library. + * + * The GNU MP 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 MP 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 MP Library. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <sysdep.h> +#include <sys/asm.h> + +/* INPUT PARAMETERS + * res_ptr $4 + * s1_ptr $5 + * size $6 + * s2_limb $7 + */ + +#ifdef PIC + .option pic2 +#endif +ENTRY (__mpn_addmul_1) +#ifdef PIC + SETUP_GP /* ??? unused */ +#endif + .set noreorder + .set nomacro + + # warm up phase 0 + ld $8,0($5) + + # warm up phase 1 + daddiu $5,$5,8 + dmultu $8,$7 + + daddiu $6,$6,-1 + beq $6,$0,L(LC0) + move $2,$0 # zero cy2 + + daddiu $6,$6,-1 + beq $6,$0,L(LC1) + ld $8,0($5) # load new s1 limb as early as possible + +L(Loop): ld $10,0($4) + mflo $3 + mfhi $9 + daddiu $5,$5,8 + daddu $3,$3,$2 # add old carry limb to low product limb + dmultu $8,$7 + ld $8,0($5) # load new s1 limb as early as possible + daddiu $6,$6,-1 # decrement loop counter + sltu $2,$3,$2 # carry from previous addition -> $2 + daddu $3,$10,$3 + sltu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + daddiu $4,$4,8 + bne $6,$0,L(Loop) + daddu $2,$9,$2 # add high product limb and carry from addition + + # cool down phase 1 +L(LC1): ld $10,0($4) + mflo $3 + mfhi $9 + daddu $3,$3,$2 + sltu $2,$3,$2 + dmultu $8,$7 + daddu $3,$10,$3 + sltu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + daddiu $4,$4,8 + daddu $2,$9,$2 # add high product limb and carry from addition + + # cool down phase 0 +L(LC0): ld $10,0($4) + mflo $3 + mfhi $9 + daddu $3,$3,$2 + sltu $2,$3,$2 + daddu $3,$10,$3 + sltu $10,$3,$10 + daddu $2,$2,$10 + sd $3,0($4) + j $31 + daddu $2,$9,$2 # add high product limb and carry from addition + +END (__mpn_addmul_1) diff --git a/sysdeps/mips/mips64/bsd-_setjmp.S b/sysdeps/mips/mips64/bsd-_setjmp.S new file mode 100644 index 0000000000..8b4681f15e --- /dev/null +++ b/sysdeps/mips/mips64/bsd-_setjmp.S @@ -0,0 +1,47 @@ +/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. MIPS64 version. + Copyright (C) 1996-2014 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/>. */ + +/* 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 <sgidefs.h> +#include <sysdep.h> +#include <sys/asm.h> + +#ifdef __PIC__ + .option pic2 +#endif +ENTRY (_setjmp) +#ifdef __PIC__ + SETUP_GP +#endif + SETUP_GP64_REG (v0, C_SYMBOL_NAME (_setjmp)) + PTR_LA t9, C_SYMBOL_NAME (__sigsetjmp) +#if _MIPS_SIM == _ABIO32 + nop +#endif + RESTORE_GP64_REG + move a1, zero /* Pass a second argument of zero. */ +#ifdef __PIC__ + jr t9 +#else + j C_SYMBOL_NAME (__sigsetjmp) +#endif +END (_setjmp) +libc_hidden_def (_setjmp) diff --git a/sysdeps/mips/mips64/bsd-setjmp.S b/sysdeps/mips/mips64/bsd-setjmp.S new file mode 100644 index 0000000000..0c2c0594ce --- /dev/null +++ b/sysdeps/mips/mips64/bsd-setjmp.S @@ -0,0 +1,46 @@ +/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. MIPS64 version. + Copyright (C) 1996-2014 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/>. */ + +/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. + We cannot do |
