diff options
author | 2016-09-01 09:26:04 +0000 | |
---|---|---|
committer | 2016-09-01 09:26:04 +0000 | |
commit | 3d1107806c4789012a8da1e6d187128842366f16 (patch) | |
tree | 400f3f642dfac2a53c25102dc65dc3495eaf414f | |
parent | Celebrate OpenBSD 6.0 release by retiring the sparc port. (diff) | |
download | wireguard-openbsd-3d1107806c4789012a8da1e6d187128842366f16.tar.xz wireguard-openbsd-3d1107806c4789012a8da1e6d187128842366f16.zip |
retire the sparc library code
46 files changed, 0 insertions, 2936 deletions
diff --git a/lib/libc/arch/sparc/DEFS.h b/lib/libc/arch/sparc/DEFS.h deleted file mode 100644 index 13efbc6a428..00000000000 --- a/lib/libc/arch/sparc/DEFS.h +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $OpenBSD: DEFS.h,v 1.4 2015/08/31 02:53:57 guenther Exp $ - */ - -#include <machine/asm.h> - -/* - * We define a hidden alias with the prefix "_libc_" for each global symbol - * that may be used internally. By referencing _libc_x instead of x, other - * parts of libc prevent overriding by the application and avoid unnecessary - * relocations. - */ -#define _HIDDEN(x) _libc_##x -#define _HIDDEN_ALIAS(x,y) \ - STRONG_ALIAS(_HIDDEN(x),y); \ - .hidden _HIDDEN(x) -#define _HIDDEN_FALIAS(x,y) \ - _HIDDEN_ALIAS(x,y); \ - .type _HIDDEN(x),@function - -/* - * For functions implemented in ASM that aren't syscalls. - * END_STRONG(x) Like DEF_STRONG() in C; for standard/reserved C names - * END_WEAK(x) Like DEF_WEAK() in C; for non-ISO C names - */ -#define END_STRONG(x) END(x); _HIDDEN_FALIAS(x,x); END(_HIDDEN(x)) -#define END_WEAK(x) END_STRONG(x); .weak x - diff --git a/lib/libc/arch/sparc/Makefile.inc b/lib/libc/arch/sparc/Makefile.inc deleted file mode 100644 index c66455bb654..00000000000 --- a/lib/libc/arch/sparc/Makefile.inc +++ /dev/null @@ -1,30 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.4 2014/06/09 20:47:11 miod Exp $ - -# `source' files built from m4 source -# the name `div.o' is taken for the ANSI C `div' function, hence sdiv here -SRCS+= rem.S sdiv.S udiv.S urem.S -CLEANFILES+=rem.S sdiv.S udiv.S urem.S - -sdiv.S: ${LIBCSRCDIR}/arch/sparc/gen/divrem.m4 - @echo 'building ${.TARGET} from ${.ALLSRC}' - @(echo "define(NAME,\`.div')define(OP,\`div')define(S,\`true')"; \ - cat ${.ALLSRC}) | m4 > ${.TARGET} - @chmod 444 ${.TARGET} - -udiv.S: ${LIBCSRCDIR}/arch/sparc/gen/divrem.m4 - @echo 'building ${.TARGET} from ${.ALLSRC}' - @(echo "define(NAME,\`.udiv')define(OP,\`div')define(S,\`false')"; \ - cat ${.ALLSRC}) | m4 > ${.TARGET} - @chmod 444 ${.TARGET} - -rem.S: ${LIBCSRCDIR}/arch/sparc/gen/divrem.m4 - @echo 'building ${.TARGET} from ${.ALLSRC}' - @(echo "define(NAME,\`.rem')define(OP,\`rem')define(S,\`true')"; \ - cat ${.ALLSRC}) | m4 > ${.TARGET} - @chmod 444 ${.TARGET} - -urem.S: ${LIBCSRCDIR}/arch/sparc/gen/divrem.m4 - @echo 'building ${.TARGET} from ${.ALLSRC}' - @(echo "define(NAME,\`.urem')define(OP,\`rem')define(S,\`false')"; \ - cat ${.ALLSRC}) | m4 > ${.TARGET} - @chmod 444 ${.TARGET} diff --git a/lib/libc/arch/sparc/SYS.h b/lib/libc/arch/sparc/SYS.h deleted file mode 100644 index b507659224a..00000000000 --- a/lib/libc/arch/sparc/SYS.h +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $OpenBSD: SYS.h,v 1.21 2016/05/07 19:05:22 guenther Exp $ - */ - -#include "DEFS.h" -#include <sys/syscall.h> -#include <machine/trap.h> - -/* offsetof(struct tib, tib_errno) - offsetof(struct tib, __tib_tcb) */ -#define TCB_OFFSET_ERRNO 12 - -#define _CAT(x,y) x##y - -#define __ENTRY(p,x) ENTRY(_CAT(p,x)) ; .weak x ; x = _CAT(p,x) -#define __ENTRY_HIDDEN(p,x) ENTRY(_CAT(p,x)) - -#define __END_HIDDEN(p,x) END(_CAT(p,x)); \ - _HIDDEN_FALIAS(x, _CAT(p,x)); \ - END(_HIDDEN(x)) -#define __END(p,x) __END_HIDDEN(p,x); END(x) - -/* - * ERROR sets the thread's errno and returns - */ -#define ERROR() \ - st %o0, [%g7 + TCB_OFFSET_ERRNO]; \ - mov -1, %o0; \ - retl; \ - mov -1, %o1 - -/* - * SYSCALL is used when further action must be taken before returning. - * Note that it adds a `nop' over what we could do, if we only knew what - * came at label 1.... - */ -#define __SYSCALL(p,x) \ - __ENTRY(p,x); mov _CAT(SYS_,x),%g1; t ST_SYSCALL; bcc 1f; nop; ERROR(); 1: -#define __SYSCALL_HIDDEN(p,x) \ - __ENTRY_HIDDEN(p,x); mov _CAT(SYS_,x),%g1; t ST_SYSCALL; bcc 1f; nop; ERROR(); 1: - -/* - * RSYSCALL is used when the system call should just return. Here - * we use the SYSCALL_G2RFLAG to put the `success' return address in %g2 - * and avoid a branch. - */ -#define __RSYSCALL(p,x) \ - __ENTRY(p,x); mov (_CAT(SYS_,x))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL; ERROR(); __END(p,x) - -/* - * PSEUDO(x,y) is like RSYSCALL(y) except that the name is x. - */ -#define __PSEUDO(p,x,y) \ - __ENTRY(p,x); mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL; ERROR(); __END(p,x) - -/* - * PSEUDO_NOERROR(x,y) is like PSEUDO(x,y) except that errno is not set. - */ -#define __PSEUDO_NOERROR(p,x,y) \ - __ENTRY(p,x); mov (_CAT(SYS_,y))|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \ - t ST_SYSCALL; __END(p,x) - -# define SYSCALL(x) __SYSCALL(_thread_sys_,x) -# define RSYSCALL(x) __RSYSCALL(_thread_sys_,x) -# define RSYSCALL_HIDDEN(x) __RSYSCALL(_thread_sys_,x) -# define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y) -# define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y) -# define SYSENTRY(x) __ENTRY(_thread_sys_,x) -# define SYSENTRY_HIDDEN(x) __ENTRY_HIDDEN(_thread_sys_,x) -# define SYSCALL_END(x) __END(_thread_sys_,x) -# define SYSCALL_END_HIDDEN(x) __END_HIDDEN(_thread_sys_,x) diff --git a/lib/libc/arch/sparc/Symbols.list b/lib/libc/arch/sparc/Symbols.list deleted file mode 100644 index f678e521ec4..00000000000 --- a/lib/libc/arch/sparc/Symbols.list +++ /dev/null @@ -1,15 +0,0 @@ -.div -.mul -.rem -.udiv -.umul -.urem -__builtin_saveregs -__fixunsdfsi -__floatundidf -__plt_end -__plt_start -_mcount -fabsl -frexpl -ldexpl diff --git a/lib/libc/arch/sparc/gdtoa/Makefile.inc b/lib/libc/arch/sparc/gdtoa/Makefile.inc deleted file mode 100644 index 5f4dfe3bb59..00000000000 --- a/lib/libc/arch/sparc/gdtoa/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.2 2008/12/09 19:52:34 martynas Exp $ - -SRCS+= strtord.c diff --git a/lib/libc/arch/sparc/gdtoa/arith.h b/lib/libc/arch/sparc/gdtoa/arith.h deleted file mode 100644 index e1954befb99..00000000000 --- a/lib/libc/arch/sparc/gdtoa/arith.h +++ /dev/null @@ -1,3 +0,0 @@ -#define IEEE_MC68k -#define Arith_Kind_ASL 2 -#define Double_Align diff --git a/lib/libc/arch/sparc/gdtoa/gd_qnan.h b/lib/libc/arch/sparc/gdtoa/gd_qnan.h deleted file mode 100644 index b25361613d6..00000000000 --- a/lib/libc/arch/sparc/gdtoa/gd_qnan.h +++ /dev/null @@ -1,12 +0,0 @@ -#define f_QNAN 0x7fffffff -#define d_QNAN0 0x7fffffff -#define d_QNAN1 0xffffffff -#define ld_QNAN0 0x7fffffff -#define ld_QNAN1 0xffffffff -#define ld_QNAN2 0x0 -#define ld_QNAN3 0x0 -#define ldus_QNAN0 0x7fff -#define ldus_QNAN1 0xffff -#define ldus_QNAN2 0xffff -#define ldus_QNAN3 0xffff -#define ldus_QNAN4 0x0 diff --git a/lib/libc/arch/sparc/gen/Makefile.inc b/lib/libc/arch/sparc/gen/Makefile.inc deleted file mode 100644 index 7356de33886..00000000000 --- a/lib/libc/arch/sparc/gen/Makefile.inc +++ /dev/null @@ -1,6 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.13 2012/04/12 16:14:09 deraadt Exp $ - -SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.S nan.c -SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ - fpsetround.c fpsetsticky.c -SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S setjmp.S sigsetjmp.S diff --git a/lib/libc/arch/sparc/gen/_setjmp.S b/lib/libc/arch/sparc/gen/_setjmp.S deleted file mode 100644 index 68d87e09da9..00000000000 --- a/lib/libc/arch/sparc/gen/_setjmp.S +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: _setjmp.S,v 1.7 2005/08/07 16:40:15 espie Exp $ */ -/* - * - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * C library -- _setjmp, _longjmp - * - * _longjmp(a,v) - * will generate a "return(v?v:1)" from - * the last call to - * _setjmp(a) - * by restoring the previous context. - * The previous signal state is NOT restored. - */ - -#include "DEFS.h" -#include <machine/trap.h> /* T_FLUSHWIN */ -#define CCFSZ 96 /* from locore.S */ - -ENTRY(_setjmp) - st %sp, [%o0 + 0] /* store caller's stack pointer */ - st %o7, [%o0 + 4] /* ... and return pc */ - retl - clr %o0 ! return 0 - -ENTRY(_longjmp) - sub %sp, CCFSZ, %sp ! set up a local stack frame - tst %o1 ! compute v ? v : 1 - be,a 0f - mov 1, %o1 -0: - t ST_FLUSHWIN ! flush register windows out to the stack - - /* - * We restore the saved stack pointer to %fp, then issue - * a `restore' instruction which will reload the register - * window from the stack. - */ - ld [%o0 + 4], %o7 /* restore return pc */ - ld [%o0 + 0], %fp /* and stack pointer */ - - retl ! success, return %g6 - restore %o1, 0, %o0 diff --git a/lib/libc/arch/sparc/gen/divrem.m4 b/lib/libc/arch/sparc/gen/divrem.m4 deleted file mode 100644 index 9152f9f37e8..00000000000 --- a/lib/libc/arch/sparc/gen/divrem.m4 +++ /dev/null @@ -1,273 +0,0 @@ -/* $OpenBSD: divrem.m4,v 1.7 2011/03/12 18:50:05 deraadt Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: divrem.m4,v 1.4 92/06/25 13:23:57 torek Exp - */ - -/* - * Division and remainder, from Appendix E of the Sparc Version 8 - * Architecture Manual, with fixes from Gordon Irlam. - */ - -/* - * Input: dividend and divisor in %o0 and %o1 respectively. - * - * m4 parameters: - * NAME name of function to generate - * OP OP=div => %o0 / %o1; OP=rem => %o0 % %o1 - * S S=true => signed; S=false => unsigned - * - * Algorithm parameters: - * N how many bits per iteration we try to get (4) - * WORDSIZE total number of bits (32) - * - * Derived constants: - * TWOSUPN 2^N, for label generation (m4 exponentiation currently broken) - * TOPBITS number of bits in the top `decade' of a number - * - * Important variables: - * Q the partial quotient under development (initially 0) - * R the remainder so far, initially the dividend - * ITER number of main division loop iterations required; - * equal to ceil(log2(quotient) / N). Note that this - * is the log base (2^N) of the quotient. - * V the current comparand, initially divisor*2^(ITER*N-1) - * - * Cost: - * Current estimate for non-large dividend is - * ceil(log2(quotient) / N) * (10 + 7N/2) + C - * A large dividend is one greater than 2^(31-TOPBITS) and takes a - * different path, as the upper bits of the quotient must be developed - * one bit at a time. - */ - -define(N, `4') -define(TWOSUPN, `16') -define(WORDSIZE, `32') -define(TOPBITS, eval(WORDSIZE - N*((WORDSIZE-1)/N))) - -define(dividend, `%o0') -define(divisor, `%o1') -define(Q, `%o2') -define(R, `%o3') -define(ITER, `%o4') -define(V, `%o5') - -/* m4 reminder: ifelse(a,b,c,d) => if a is b, then c, else d */ -define(T, `%g1') -define(SC, `%g5') -ifelse(S, `true', `define(SIGN, `%g6')') - -/* - * This is the recursive definition for developing quotient digits. - * - * Parameters: - * $1 the current depth, 1 <= $1 <= N - * $2 the current accumulation of quotient bits - * N max depth - * - * We add a new bit to $2 and either recurse or insert the bits in - * the quotient. R, Q, and V are inputs and outputs as defined above; - * the condition codes are expected to reflect the input R, and are - * modified to reflect the output R. - */ -define(DEVELOP_QUOTIENT_BITS, -` ! depth $1, accumulated bits $2 - bl L.$1.eval(TWOSUPN+$2) - srl V,1,V - ! remainder is positive - subcc R,V,R - ifelse($1, N, - ` b 9f - add Q, ($2*2+1), Q - ', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2+1)')') -L.$1.eval(TWOSUPN+$2): - ! remainder is negative - addcc R,V,R - ifelse($1, N, - ` b 9f - add Q, ($2*2-1), Q - ', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2-1)')') - ifelse($1, 1, `9:')') - -#include "DEFS.h" -#include <machine/trap.h> - -#ifndef STRONG_SPARC -.weak NAME -#else -FUNC(patsubst(NAME,\.,__)) -#endif -FUNC(NAME) -ifelse(S, `true', -` ! compute sign of result; if neither is negative, no problem - orcc divisor, dividend, %g0 ! either negative? - bge 2f ! no, go do the divide - ifelse(OP, `div', - `xor divisor, dividend, SIGN', - `mov dividend, SIGN') ! compute sign in any case - tst divisor - bge 1f - tst dividend - ! divisor is definitely negative; dividend might also be negative - bge 2f ! if dividend not negative... - neg divisor ! in any case, make divisor nonneg -1: ! dividend is negative, divisor is nonnegative - neg dividend ! make dividend nonnegative -2: -') - ! Ready to divide. Compute size of quotient; scale comparand. - orcc divisor, %g0, V - bnz 1f - mov dividend, R - - ! Divide by zero trap. If it returns, return 0 (about as - ! wrong as possible, but that is what SunOS does...). - t ST_DIV0 - retl - clr %o0 - -1: - cmp R, V ! if divisor exceeds dividend, done - blu Lgot_result ! (and algorithm fails otherwise) - clr Q - sethi %hi(1 << (WORDSIZE - TOPBITS - 1)), T - cmp R, T - blu Lnot_really_big - clr ITER - - ! `Here the dividend is >= 2^(31-N) or so. We must be careful here, - ! as our usual N-at-a-shot divide step will cause overflow and havoc. - ! The number of bits in the result here is N*ITER+SC, where SC <= N. - ! Compute ITER in an unorthodox manner: know we need to shift V into - ! the top decade: so do not even bother to compare to R.' - 1: - cmp V, T - bgeu 3f - mov 1, SC - sll V, N, V - b 1b - inc ITER - - ! Now compute SC. - 2: addcc V, V, V - bcc Lnot_too_big - inc SC - - ! We get here if the divisor overflowed while shifting. - ! This means that R has the high-order bit set. - ! Restore V and subtract from R. - sll T, TOPBITS, T ! high order bit - srl V, 1, V ! rest of V - add V, T, V - b Ldo_single_div - dec SC - - Lnot_too_big: - 3: cmp V, R - blu 2b - nop - be Ldo_single_div - nop - /* NB: these are commented out in the V8-Sparc manual as well */ - /* (I do not understand this) */ - ! V > R: went too far: back up 1 step - ! srl V, 1, V - ! dec SC - ! do single-bit divide steps - ! - ! We have to be careful here. We know that R >= V, so we can do the - ! first divide step without thinking. BUT, the others are conditional, - ! and are only done if R >= 0. Because both R and V may have the high- - ! order bit set in the first step, just falling into the regular - ! division loop will mess up the first time around. - ! So we unroll slightly... - Ldo_single_div: - deccc SC - bl Lend_regular_divide - nop - sub R, V, R - mov 1, Q - b Lend_single_divloop - nop - Lsingle_divloop: - sll Q, 1, Q - bl 1f - srl V, 1, V - ! R >= 0 - sub R, V, R - b 2f - inc Q - 1: ! R < 0 - add R, V, R - dec Q - 2: - Lend_single_divloop: - deccc SC - bge Lsingle_divloop - tst R - b,a Lend_regular_divide - -Lnot_really_big: -1: - sll V, N, V - cmp V, R - bleu 1b - inccc ITER - be Lgot_result - dec ITER - - tst R ! set up for initial iteration -Ldivloop: - sll Q, N, Q - DEVELOP_QUOTIENT_BITS(1, 0) -Lend_regular_divide: - deccc ITER - bge Ldivloop - tst R - bl,a Lgot_result - ! non-restoring fixup here (one instruction only!) -ifelse(OP, `div', -` dec Q -', ` add R, divisor, R -') - -Lgot_result: -ifelse(S, `true', -` ! check to see if answer should be < 0 - tst SIGN - bl,a 1f - ifelse(OP, `div', `neg Q', `neg R') -1:') - retl - ifelse(OP, `div', `mov Q, %o0', `mov R, %o0') diff --git a/lib/libc/arch/sparc/gen/fabs.S b/lib/libc/arch/sparc/gen/fabs.S deleted file mode 100644 index ff76923bc10..00000000000 --- a/lib/libc/arch/sparc/gen/fabs.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: fabs.S,v 1.9 2013/03/28 18:09:38 martynas Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* fabs - floating absolute value */ - -#include "DEFS.h" - -STRONG_ALIAS(fabsl, fabs) -ENTRY(fabs) - std %o0, [%sp + 32] ! return value => %f0:f1 - ldd [%sp + 32], %f0 ! (via kernel %o0/%o1 slot) - retl - fabss %f0, %f0 ! return absolute value diff --git a/lib/libc/arch/sparc/gen/fixunsdfsi.S b/lib/libc/arch/sparc/gen/fixunsdfsi.S deleted file mode 100644 index a3aff2c8779..00000000000 --- a/lib/libc/arch/sparc/gen/fixunsdfsi.S +++ /dev/null @@ -1,82 +0,0 @@ -/* $OpenBSD: fixunsdfsi.S,v 1.7 2012/08/22 17:19:35 pascal Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Convert double to unsigned integer (for gcc). - * - * I have made the output for NaN agree with the Sun compiler, not - * that it really matters, by using `fbul,a'. - */ - -#include "DEFS.h" - - .align 8 -Lbig: - .word 0x41e00000 ! .double 0r2147483648.0e+00 - .word 0 ! (who me, not trust the assembler?) - -ENTRY(__fixunsdfsi) - sub %sp, 8, %sp - std %o0, [%sp + 64] ! get argument into fpu reg - ldd [%sp + 64], %f0 -#ifdef __PIC__ - PICCY_SET(Lbig, %g1, %o0) - ldd [%g1], %f2 -#else - sethi %hi(Lbig), %g1 - ldd [%g1 + %lo(Lbig)], %f2 -#endif - fcmped %f0, %f2 ! d < 2^31, or NaN, or -Inf? - nop ! (fpop2 delay) - fbul,a 1f ! if so, use fdtoi to convert to int - fdtoi %f0, %f0 ! (this includes negatives!) - - ! d does not fit in an int, so subtract 2^31, convert, - ! and add 2^31 again (sigh). Just hope the intermediate - ! fits (if not, the result is undefined anyway). - - fsubd %f0, %f2, %f0 ! d -= 2^31 - fdtoi %f0, %f0 ! convert to int - st %f0, [%sp + 64] ! move into return reg - ld [%sp + 64], %o0 - sethi %hi(0x80000000), %o1 - add %o0, %o1, %o0 ! add 2^31 - retl - add %sp, 8, %sp - -1: - st %f0, [%sp + 64] ! return result - ld [%sp + 64], %o0 - retl - add %sp, 8, %sp diff --git a/lib/libc/arch/sparc/gen/flt_rounds.c b/lib/libc/arch/sparc/gen/flt_rounds.c deleted file mode 100644 index df39481949a..00000000000 --- a/lib/libc/arch/sparc/gen/flt_rounds.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $OpenBSD: flt_rounds.c,v 1.7 2015/10/27 05:54:49 guenther Exp $ */ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include <sys/types.h> -#include <float.h> - -static const int map[] = { - 1, /* round to nearest */ - 0, /* round to zero */ - 2, /* round to positive infinity */ - 3 /* round to negative infinity */ -}; - -int -__flt_rounds() -{ - int x; - - __asm__("st %%fsr,%0" : "=m" (*&x)); - return map[(x >> 30) & 0x03]; -} -DEF_STRONG(__flt_rounds); diff --git a/lib/libc/arch/sparc/gen/fpgetmask.c b/lib/libc/arch/sparc/gen/fpgetmask.c deleted file mode 100644 index 22a6c143643..00000000000 --- a/lib/libc/arch/sparc/gen/fpgetmask.c +++ /dev/null @@ -1,16 +0,0 @@ -/* $OpenBSD: fpgetmask.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include <ieeefp.h> - -fp_except -fpgetmask() -{ - int x; - - __asm__("st %%fsr,%0" : "=m" (*&x)); - return (x >> 23) & 0x1f; -} diff --git a/lib/libc/arch/sparc/gen/fpgetround.c b/lib/libc/arch/sparc/gen/fpgetround.c deleted file mode 100644 index 84e7f49a82d..00000000000 --- a/lib/libc/arch/sparc/gen/fpgetround.c +++ /dev/null @@ -1,17 +0,0 @@ -/* $OpenBSD: fpgetround.c,v 1.4 2016/07/26 19:07:09 guenther Exp $ */ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include <ieeefp.h> - -fp_rnd -fpgetround(void) -{ - int x; - - __asm__("st %%fsr,%0" : "=m" (*&x)); - return (x >> 30) & 0x03; -} -DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/sparc/gen/fpgetsticky.c b/lib/libc/arch/sparc/gen/fpgetsticky.c deleted file mode 100644 index f6ed85ea76a..00000000000 --- a/lib/libc/arch/sparc/gen/fpgetsticky.c +++ /dev/null @@ -1,16 +0,0 @@ -/* $OpenBSD: fpgetsticky.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include <ieeefp.h> - -fp_except -fpgetsticky() -{ - int x; - - __asm__("st %%fsr,%0" : "=m" (*&x)); - return (x >> 5) & 0x1f; -} diff --git a/lib/libc/arch/sparc/gen/fpsetmask.c b/lib/libc/arch/sparc/gen/fpsetmask.c deleted file mode 100644 index f9518a134c0..00000000000 --- a/lib/libc/arch/sparc/gen/fpsetmask.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $OpenBSD: fpsetmask.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include <ieeefp.h> - -fp_except -fpsetmask(mask) - fp_except mask; -{ - fp_except old; - fp_except new; - - __asm__("st %%fsr,%0" : "=m" (*&old)); - - new = old; - new &= ~(0x1f << 23); - new |= ((mask & 0x1f) << 23); - - __asm__("ld %0,%%fsr" : : "m" (*&new)); - - return (old >> 23) & 0x1f; -} diff --git a/lib/libc/arch/sparc/gen/fpsetround.c b/lib/libc/arch/sparc/gen/fpsetround.c deleted file mode 100644 index aee229a55b8..00000000000 --- a/lib/libc/arch/sparc/gen/fpsetround.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $OpenBSD: fpsetround.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include <ieeefp.h> - -fp_rnd -fpsetround(rnd_dir) - fp_rnd rnd_dir; -{ - fp_rnd old; - fp_rnd new; - - __asm__("st %%fsr,%0" : "=m" (*&old)); - - new = old; - new &= ~(0x03 << 30); - new |= ((rnd_dir & 0x03) << 30); - - __asm__("ld %0,%%fsr" : : "m" (*&new)); - - return (old >> 30) & 0x03; -} diff --git a/lib/libc/arch/sparc/gen/fpsetsticky.c b/lib/libc/arch/sparc/gen/fpsetsticky.c deleted file mode 100644 index e8f3bcfe937..00000000000 --- a/lib/libc/arch/sparc/gen/fpsetsticky.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $OpenBSD: fpsetsticky.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */ -/* - * Written by J.T. Conklin, Apr 10, 1995 - * Public domain. - */ - -#include <ieeefp.h> - -fp_except -fpsetsticky(sticky) - fp_except sticky; -{ - fp_except old; - fp_except new; - - __asm__("st %%fsr,%0" : "=m" (*&old)); - - new = old; - new &= ~(0x1f << 5); - new |= ((sticky & 0x1f) << 5); - - __asm__("ld %0,%%fsr" : : "m" (*&new)); - - return (old >> 5) & 0x1f; -} diff --git a/lib/libc/arch/sparc/gen/infinity.c b/lib/libc/arch/sparc/gen/infinity.c deleted file mode 100644 index ad5204b9439..00000000000 --- a/lib/libc/arch/sparc/gen/infinity.c +++ /dev/null @@ -1,7 +0,0 @@ -/* $OpenBSD: infinity.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */ -/* infinity.c */ - -#include <math.h> - -/* bytes for +Infinity on a sparc */ -char __infinity[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; diff --git a/lib/libc/arch/sparc/gen/modf.S b/lib/libc/arch/sparc/gen/modf.S deleted file mode 100644 index f5102305df0..00000000000 --- a/lib/libc/arch/sparc/gen/modf.S +++ /dev/null @@ -1,186 +0,0 @@ -/* $OpenBSD: modf.S,v 1.9 2014/06/07 01:41:26 tobiasu Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "DEFS.h" -#include <machine/fsr.h> - -/* - * double modf(double val, double *iptr) - * - * Returns the fractional part of `val', storing the integer part of - * `val' in *iptr. Both *iptr and the return value have the same sign - * as `val'. - * - * Method: - * - * We use the fpu's normalization hardware to compute the integer portion - * of the double precision argument. Sun IEEE double precision numbers - * have 52 bits of mantissa, 11 bits of exponent, and one bit of sign, - * with the sign occupying bit 31 of word 0, and the exponent bits 30:20 - * of word 0. Thus, values >= 2^52 are by definition integers. - * - * If we take a value that is in the range [+0..2^52) and add 2^52, all - * of the fractional bits fall out and all of the integer bits are summed - * with 2^52. If we then subtract 2^52, we get those integer bits back. - * This must be done with rounding set to `towards 0' or `towards -inf'. - * `Toward -inf' fails when the value is 0 (we get -0 back).... - * - * Note that this method will work anywhere, but is machine dependent in - * various aspects. - * - * Stack usage: - * 4@[%fp - 4] saved %fsr - * 4@[%fp - 8] new %fsr with rounding set to `towards 0' - * 8@[%fp - 16] space for moving between %i and %f registers - * Register usage: - * %i0%i1 double val; - * %l0 scratch - * %l1 sign bit (0x80000000) - * %i2 double *iptr; - * %f2:f3 `magic number' 2^52, in fpu registers - * %f4:f5 double v, in fpu registers - */ - - .align 8 -Lmagic: - .word 0x43300000 ! sign = 0, exponent = 52 + 1023, mantissa = 0 - .word 0 ! (i.e., .double 0r4503599627370496e+00) - -L0: - .word 0 ! 0.0 - .word 0 - -ENTRY(modf) - save %sp, -64-16, %sp - - /* - * First, compute v = abs(val) by clearing sign bit, - * and then set up the fpu registers. This would be - * much easier if we could do alu operations on fpu registers! - */ - sethi %hi(0x80000000), %l1 ! sign bit - andn %i0, %l1, %l0 - st %l0, [%fp - 16] -#ifdef __PIC__ - PICCY_SET(Lmagic, %l0, %o7) - ldd [%l0], %f2 -#else - sethi %hi(Lmagic), %l0 - ldd [%l0 + %lo(Lmagic)], %f2 -#endif - st %i1, [%fp - 12] - ldd [%fp - 16], %f4 ! %f4:f5 = v - - /* - * Is %f4:f5 >= %f2:f3 ? If so, it is all integer bits. - * It is probably less, though. - */ - fcmped %f4, %f2 - nop ! fpop2 delay - fbuge Lbig ! if >= (or unordered), go out - nop - - /* - * v < 2^52, so add 2^52, then subtract 2^52, but do it all - * with rounding set towards zero. We leave any enabled - * traps enabled, but change the rounding mode. This might - * not be so good. Oh well.... - */ - st %fsr, [%fp - 4] ! %l5 = current FSR mode - set FSR_RD, %l3 ! %l3 = rounding direction mask - ld [%fp - 4], %l5 - set FSR_RD_RZ << FSR_RD_SHIFT, %l4 - andn %l5, %l3, %l6 - or %l6, %l4, %l6 ! round towards zero, please - and %l5, %l3, %l5 ! save original rounding mode - st %l6, [%fp - 8] - ld [%fp - 8], %fsr - - faddd %f4, %f2, %f4 ! %f4:f5 += 2^52 - fsubd %f4, %f2, %f4 ! %f4:f5 -= 2^52 - - /* - * Restore %fsr, but leave exceptions accrued. - */ - st %fsr, [%fp - 4] - ld [%fp - 4], %l6 - andn %l6, %l3, %l6 ! %l6 = %fsr & ~FSR_RD; - or %l5, %l6, %l5 ! %l5 |= %l6; - st %l5, [%fp - 4] - ld [%fp - 4], %fsr ! restore %fsr, leaving accrued stuff - - /* - * Now insert the original sign in %f4:f5. - * This is a lot of work, so it is conditional here. - */ - btst %l1, %i0 - be 1f - nop - st %f4, [%fp - 16] - ld [%fp - 16], %g1 - or %l1, %g1, %g1 - st %g1, [%fp - 16] - ld [%fp - 16], %f4 -1: - - /* - * The value in %f4:f5 is now the integer portion of the original - * argument. We need to store this in *ival (%i2), subtract it - * from the original value argument (%i0:i1), and return the result. - */ - std %f4, [%i2] ! *ival = %f4:f5; - std %i0, [%fp - 16] - ldd [%fp - 16], %f0 ! %f0:f1 = val; - fsubd %f0, %f4, %f0 ! %f0:f1 -= %f4:f5; - ret - restore - -Lbig: - /* - * We get here if the original comparison of %f4:f5 (v) to - * %f2:f3 (2^52) came out `greater or unordered'. In this - * case the integer part is the original value, and the - * fractional part is 0. - */ -#ifdef __PIC__ - PICCY_SET(L0, %l0, %o7) - std %i0, [%i2] ! *ival = val; - ldd [%l0], %f0 ! return 0.0; -#else - sethi %hi(L0), %l0 - std %i0, [%i2] ! *ival = val; - ldd [%l0 + %lo(L0)], %f0 ! return 0.0; -#endif - ret - restore diff --git a/lib/libc/arch/sparc/gen/mul.S b/lib/libc/arch/sparc/gen/mul.S deleted file mode 100644 index 3907c8e7ebe..00000000000 --- a/lib/libc/arch/sparc/gen/mul.S +++ /dev/null @@ -1,150 +0,0 @@ -/* $OpenBSD: mul.S,v 1.6 2005/08/07 16:40:15 espie Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Signed multiply, from Appendix E of the Sparc Version 8 - * Architecture Manual. - * - * Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the upper 32 bits of - * the 64-bit product). - * - * This code optimizes short (less than 13-bit) multiplies. - */ - -#include "DEFS.h" -#ifndef STRONG_SPARC -.weak .mul -#else -FUNC(__mul) -#endif -FUNC(.mul) - mov %o0, %y ! multiplier -> Y - andncc %o0, 0xfff, %g0 ! test bits 12..31 - be Lmul_shortway ! if zero, can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product and clear N and V - - /* - * Long multiply. 32 steps, followed by a final shift step. - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %o1, %o4 ! 13 - mulscc %o4, %o1, %o4 ! 14 - mulscc %o4, %o1, %o4 ! 15 - mulscc %o4, %o1, %o4 ! 16 - mulscc %o4, %o1, %o4 ! 17 - mulscc %o4, %o1, %o4 ! 18 - mulscc %o4, %o1, %o4 ! 19 - mulscc %o4, %o1, %o4 ! 20 - mulscc %o4, %o1, %o4 ! 21 - mulscc %o4, %o1, %o4 ! 22 - mulscc %o4, %o1, %o4 ! 23 - mulscc %o4, %o1, %o4 ! 24 - mulscc %o4, %o1, %o4 ! 25 - mulscc %o4, %o1, %o4 ! 26 - mulscc %o4, %o1, %o4 ! 27 - mulscc %o4, %o1, %o4 ! 28 - mulscc %o4, %o1, %o4 ! 29 - mulscc %o4, %o1, %o4 ! 30 - mulscc %o4, %o1, %o4 ! 31 - mulscc %o4, %o1, %o4 ! 32 - mulscc %o4, %g0, %o4 ! final shift - - ! If %o0 was negative, the result is - ! (%o0 * %o1) + (%o1 << 32)) - ! We fix that here. - - tst %o0 - bge 1f - rd %y, %o0 - - ! %o0 was indeed negative; fix upper 32 bits of result by subtracting - ! %o1 (i.e., return %o4 - %o1 in %o1). - retl - sub %o4, %o1, %o1 - -1: - retl - mov %o4, %o1 - -Lmul_shortway: - /* - * Short multiply. 12 steps, followed by a final shift step. - * The resulting bits are off by 12 and (32-12) = 20 bit positions, - * but there is no problem with %o0 being negative (unlike above). - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %g0, %o4 ! final shift - - /* - * %o4 has 20 of the bits that should be in the low part of the - * result; %y has the bottom 12 (as %y's top 12). That is: - * - * %o4 %y - * +----------------+----------------+ - * | -12- | -20- | -12- | -20- | - * +------(---------+------)---------+ - * --hi-- ----low-part---- - * - * The upper 12 bits of %o4 should be sign-extended to form the - * high part of the product (i.e., highpart = %o4 >> 20). - */ - - rd %y, %o5 - sll %o4, 12, %o0 ! shift middle bits left 12 - srl %o5, 20, %o5 ! shift low bits right 20, zero fill at left - or %o5, %o0, %o0 ! construct low part of result - retl - sra %o4, 20, %o1 ! ... and extract high part of result diff --git a/lib/libc/arch/sparc/gen/nan.c b/lib/libc/arch/sparc/gen/nan.c deleted file mode 100644 index 28a6c300950..00000000000 --- a/lib/libc/arch/sparc/gen/nan.c +++ /dev/null @@ -1,9 +0,0 @@ -/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */ - -/* Written by Martynas Venckus. Public Domain. */ - -#include <math.h> - -/* bytes for qNaN on a sparc (IEEE single format) */ -char __nan[] __attribute__((__aligned__(sizeof(float)))) = - { 0x7f, 0xc0, 0, 0 }; diff --git a/lib/libc/arch/sparc/gen/saveregs.S b/lib/libc/arch/sparc/gen/saveregs.S deleted file mode 100644 index 7254e685ec2..00000000000 --- a/lib/libc/arch/sparc/gen/saveregs.S +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: saveregs.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Save register arguments in caller's `arg dump' area, so that - * stdarg functions work. - * - * This really should be done with a pointer to the arg dump area; - * our caller should allocate that area, not our caller's caller. - * But then, they did not let me invent the calling sequence.... - * - * We assume the caller has executed a `save' instruction. - */ -#include "DEFS.h" - -ENTRY(__builtin_saveregs) - st %i0, [%fp + 0x44] ! fr->fr_argd[0] - st %i1, [%fp + 0x48] ! fr->fr_argd[1] - st %i2, [%fp + 0x4c] ! fr->fr_argd[2] - st %i3, [%fp + 0x50] ! fr->fr_argd[3] - st %i4, [%fp + 0x54] ! fr->fr_argd[4] - retl - st %i5, [%fp + 0x58] ! fr->fr_argd[5] diff --git a/lib/libc/arch/sparc/gen/setjmp.S b/lib/libc/arch/sparc/gen/setjmp.S deleted file mode 100644 index 5a618ec199e..00000000000 --- a/lib/libc/arch/sparc/gen/setjmp.S +++ /dev/null @@ -1,83 +0,0 @@ -/* $OpenBSD: setjmp.S,v 1.9 2016/05/23 09:42:09 guenther Exp $ */ -/* - * - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * C library -- _setjmp, _longjmp - * - * _longjmp(a,v) - * will generate a "return(v?v:1)" from - * the last call to - * _setjmp(a) - * by restoring the previous context. - * The previous signal state is restored. - */ - -#include "SYS.h" -#include <machine/trap.h> /* T_FLUSHWIN */ -#define CCFSZ 96 /* from locore.S */ - -ENTRY(setjmp) - mov %o0, %o3 /* Save our jmp_buf in %o3 */ - - mov 1, %o0 /* SIG_BLOCK */ - mov SYS_sigprocmask, %g1 - clr %o1 /* sigprocmask(SIG_BLOCK, 0) */ - t ST_SYSCALL - st %o0, [%o3 + 8] - - st %sp, [%o3 + 0] /* store caller's stack pointer */ - st %o7, [%o3 + 4] /* ... and return pc */ - retl - clr %o0 /* return 0 */ - -ENTRY(longjmp) - save %sp, -CCFSZ, %sp - t ST_FLUSHWIN ! flush register windows out to the stack - - mov 3, %o0 /* SIG_SETMASK */ - ld [%i0 + 8], %o1 - mov SYS_sigprocmask, %g1 - t ST_SYSCALL - - ld [%i0 + 0], %fp - ld [%i0 + 4], %i7 - - tst %i1 ! compute v ? v : 1 - be,a 0f - mov 1, %i1 -0: - mov %i1, %i0 - ret - restore diff --git a/lib/libc/arch/sparc/gen/sigsetjmp.S b/lib/libc/arch/sparc/gen/sigsetjmp.S deleted file mode 100644 index ad62e7e3d1b..00000000000 --- a/lib/libc/arch/sparc/gen/sigsetjmp.S +++ /dev/null @@ -1,98 +0,0 @@ -/* $OpenBSD: sigsetjmp.S,v 1.7 2012/09/04 19:08:15 deraadt Exp $ */ -/* - * Copyright (c) 1995 Paul Kranenburg - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Paul Kranenburg. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "SYS.h" - -#ifdef __PIC__ - -ENTRY(sigsetjmp) - PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE - cmp %o1,0 - st %o1,[%o0+40] ! jmpbuf[JBLEN] -#if __PIC__ == 1 - bne,a 1f - ld [%g1+_C_LABEL(setjmp)], %g1 ! if (%o1 != 0) goto setjmp; - ld [%g1+_C_LABEL(_setjmp)], %g1 ! else goto _setjmp; -1: -#else /* __PIC__ == 2 */ - be 1f - sethi %hi(_C_LABEL(setjmp)), %g2 ! if (%o1 != 0) goto setjmp; - or %g2, %lo(_C_LABEL(setjmp)), %g2 - ba,a 2f -1: sethi %hi(_C_LABEL(_setjmp)), %g2 ! else goto _setjmp; - or %g2, %lo(_C_LABEL(_setjmp)), %g2 -2: ld [%g1 + %g2], %g1 -#endif - jmp %g1 - nop - -ENTRY(siglongjmp) - PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE - ld [%o0+40],%g2 ! jmpbuf[JBLEN] - cmp %g2,0 -#if __PIC__ == 1 - bne,a 1f - ld [%g1+_C_LABEL(longjmp)], %g1 ! if (%g2 != 0) goto longjmp; - ld [%g1+_C_LABEL(_longjmp)], %g1 ! else goto _longjmp; -1: -#else /* __PIC__ == 2 */ - be 1f - sethi %hi(_C_LABEL(longjmp)), %g2 ! if (%g2 != 0) goto longjmp; - or %g2, %lo(_C_LABEL(longjmp)), %g2 - ba,a 2f -1: sethi %hi(_C_LABEL(_longjmp)), %g2 ! else goto _longjmp; - or %g2, %lo(_C_LABEL(_longjmp)), %g2 -2: ld [%g1 + %g2], %g1 -#endif - jmp %g1 - nop - unimp 0 - -#else /* PIC */ - -ENTRY(sigsetjmp) - cmp %o1,0 - be _C_LABEL(_setjmp) - st %o1,[%o0+40] ! jmpbuf[JBLEN] - nop - ba,a _C_LABEL(setjmp) - unimp 0 - -ENTRY(siglongjmp) - ld [%o0+40],%g1 - cmp %g1,0 - be _C_LABEL(_longjmp) - nop - ba,a _C_LABEL(_longjmp) - unimp 0 - -#endif /* PIC */ diff --git a/lib/libc/arch/sparc/gen/umul.S b/lib/libc/arch/sparc/gen/umul.S deleted file mode 100644 index 3d3a6ba1781..00000000000 --- a/lib/libc/arch/sparc/gen/umul.S +++ /dev/null @@ -1,183 +0,0 @@ -/* $OpenBSD: umul.S,v 1.6 2005/08/07 16:40:15 espie Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the - * upper 32 bits of the 64-bit product). - * - * This code optimizes short (less than 13-bit) multiplies. Short - * multiplies require 25 instruction cycles, and long ones require - * 45 instruction cycles. - * - * On return, overflow has occurred (%o1 is not zero) if and only if - * the Z condition code is clear, allowing, e.g., the following: - * - * call .umul - * nop - * bnz overflow (or tnz) - */ - -#include "DEFS.h" -#ifndef STRONG_SPARC -.weak .umul -#else -FUNC(__umul) -#endif -FUNC(.umul) - or %o0, %o1, %o4 - mov %o0, %y ! multiplier -> Y - andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args - be Lmul_shortway ! if zero, can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product and clear N and V - - /* - * Long multiply. 32 steps, followed by a final shift step. - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %o1, %o4 ! 13 - mulscc %o4, %o1, %o4 ! 14 - mulscc %o4, %o1, %o4 ! 15 - mulscc %o4, %o1, %o4 ! 16 - mulscc %o4, %o1, %o4 ! 17 - mulscc %o4, %o1, %o4 ! 18 - mulscc %o4, %o1, %o4 ! 19 - mulscc %o4, %o1, %o4 ! 20 - mulscc %o4, %o1, %o4 ! 21 - mulscc %o4, %o1, %o4 ! 22 - mulscc %o4, %o1, %o4 ! 23 - mulscc %o4, %o1, %o4 ! 24 - mulscc %o4, %o1, %o4 ! 25 - mulscc %o4, %o1, %o4 ! 26 - mulscc %o4, %o1, %o4 ! 27 - mulscc %o4, %o1, %o4 ! 28 - mulscc %o4, %o1, %o4 ! 29 - mulscc %o4, %o1, %o4 ! 30 - mulscc %o4, %o1, %o4 ! 31 - mulscc %o4, %o1, %o4 ! 32 - mulscc %o4, %g0, %o4 ! final shift - - - /* - * Normally, with the shift-and-add approach, if both numbers are - * positive you get the correct result. WIth 32-bit two's-complement - * numbers, -x is represented as - * - * x 32 - * ( 2 - ------ ) mod 2 * 2 - * 32 - * 2 - * - * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s, - * we can treat this as if the radix point were just to the left - * of the sign bit (multiply by 2^32), and get - * - * -x = (2 - x) mod 2 - * - * Then, ignoring the `mod 2's for convenience: - * - * x * y = xy - * -x * y = 2y - xy - * x * -y = 2x - xy - * -x * -y = 4 - 2x - 2y + xy - * - * For signed multiplies, we subtract (x << 32) from the partial - * product to fix this problem for negative multipliers (see mul.s). - * Because of the way the shift into the partial product is calculated - * (N xor V), this term is automatically removed for the multiplicand, - * so we don't have to adjust. - * - * But for unsigned multiplies, the high order bit wasn't a sign bit, - * and the correction is wrong. So for unsigned multiplies where the - * high order bit is one, we end up with xy - (y << 32). To fix it - * we add y << 32. - */ - tst %o1 - bl,a 1f ! if %o1 < 0 (high order bit = 1), - add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half) -1: rd %y, %o0 ! get lower half of product - retl - addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0 - -Lmul_shortway: - /* - * Short multiply. 12 steps, followed by a final shift step. - * The resulting bits are off by 12 and (32-12) = 20 bit positions, - * but there is no problem with %o0 being negative (unlike above), - * and overflow is impossible (the answer is at most 24 bits long). - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %g0, %o4 ! final shift - - /* - * %o4 has 20 of the bits that should be in the result; %y has - * the bottom 12 (as %y's top 12). That is: - * - * %o4 %y - * +----------------+----------------+ - * | -12- | -20- | -12- | -20- | - * +------(---------+------)---------+ - * -----result----- - * - * The 12 bits of %o4 left of the `result' area are all zero; - * in fact, all top 20 bits of %o4 are zero. - */ - - rd %y, %o5 - sll %o4, 12, %o0 ! shift middle bits left 12 - srl %o5, 20, %o5 ! shift low bits right 20 - or %o5, %o0, %o0 - retl - addcc %g0, %g0, %o1 ! %o1 = zero, and set Z diff --git a/lib/libc/arch/sparc/net/Makefile.inc b/lib/libc/arch/sparc/net/Makefile.inc deleted file mode 100644 index 80584144bcc..00000000000 --- a/lib/libc/arch/sparc/net/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.4 2012/09/04 03:10:42 okan Exp $ - -SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/arch/sparc/net/htonl.S b/lib/libc/arch/sparc/net/htonl.S deleted file mode 100644 index 6e1aa622eea..00000000000 --- a/lib/libc/arch/sparc/net/htonl.S +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* netorder = htonl(hostorder) */ - -#include "DEFS.h" - -ENTRY(htonl) - retl - nop diff --git a/lib/libc/arch/sparc/net/htons.S b/lib/libc/arch/sparc/net/htons.S deleted file mode 100644 index 0f482050fe4..00000000000 --- a/lib/libc/arch/sparc/net/htons.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* netorder = htons(hostorder) */ - -#include "DEFS.h" - -ENTRY(htons) - sethi %hi(0xffff0000), %o1 - retl - andn %o0, %o1, %o0 diff --git a/lib/libc/arch/sparc/net/ntohl.S b/lib/libc/arch/sparc/net/ntohl.S deleted file mode 100644 index c30694a71fa..00000000000 --- a/lib/libc/arch/sparc/net/ntohl.S +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* hostorder = ntohl(netorder) */ - -#include "DEFS.h" - -ENTRY(ntohl) - retl - nop diff --git a/lib/libc/arch/sparc/net/ntohs.S b/lib/libc/arch/sparc/net/ntohs.S deleted file mode 100644 index 44dc111fbd2..00000000000 --- a/lib/libc/arch/sparc/net/ntohs.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* hostorder = ntohs(netorder) */ - -#include "DEFS.h" - -ENTRY(ntohs) - sethi %hi(0xffff0000), %o1 - retl - andn %o0, %o1, %o0 diff --git a/lib/libc/arch/sparc/stdlib/abs.S b/lib/libc/arch/sparc/stdlib/abs.S deleted file mode 100644 index a55a9b9cd2b..00000000000 --- a/lib/libc/arch/sparc/stdlib/abs.S +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* abs - int absolute value */ - -#include "DEFS.h" - -ENTRY(abs) - tst %o0 - bl,a 1f - neg %o0 -1: retl - nop -END_STRONG(abs) diff --git a/lib/libc/arch/sparc/string/Makefile.inc b/lib/libc/arch/sparc/string/Makefile.inc deleted file mode 100644 index 93aac247a4b..00000000000 --- a/lib/libc/arch/sparc/string/Makefile.inc +++ /dev/null @@ -1,9 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.7 2015/05/15 22:29:37 millert Exp $ - -SRCS+= bcopy.c memcpy.c memmove.c \ - ffs.S strlen.S bzero.S \ - bcmp.c memchr.c memcmp.c \ - memset.c strcat.c strchr.c \ - strcmp.c strcpy.c strcspn.c strlcat.c strlcpy.c \ - strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ - strspn.c strstr.c swab.c diff --git a/lib/libc/arch/sparc/string/bzero.S b/lib/libc/arch/sparc/string/bzero.S deleted file mode 100644 index 13ffe17f56b..00000000000 --- a/lib/libc/arch/sparc/string/bzero.S +++ /dev/null @@ -1,137 +0,0 @@ -/* $OpenBSD: bzero.S,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "DEFS.h" - -/* - * bzero(addr, len) - * - * We should unroll the loop, but at the moment this would - * gain nothing since the `std' instructions are what limits us. - */ -ENTRY(bzero) - ! %o0 = addr, %o1 = len - - ! Optimize a common case: addr and len are both multiples of 8. - or %o0, %o1, %o2 - btst 7, %o2 ! ((addr | len) & 7) != 0? - bnz 1f ! if so, cannot optimize - clr %g1 ! in any case, we want g1=0 - - /* `Good' operands, can just store doubles. */ -0: - deccc 8, %o1 ! while ((len -= 8) >= 0) - bge,a 0b - std %g0, [%o0 + %o1] ! *(quad *)(addr + len) = 0; - retl - nop - - /* - * Either the address is unaligned, or the count is not a - * multiple of 8, or both. We will have to align the address - * in order to use anything `better' than stb. - */ -1: - cmp %o1, 15 ! len >= 15? - bge,a Lstd ! yes, use std - btst 1, %o0 ! (but first check alignment) - - ! not enough to bother: do byte-at-a-time loop. -2: - deccc %o1 ! while (--len >= 0) - bge,a 2b - stb %g0, [%o0 + %o1] ! addr[len] = 0; - retl - nop - -Lstd: - /* - * There are at least 15 bytes to zero. - * We may have to zero some initial stuff to align - * the address. - */ - bz,a 1f ! if (addr & 1) { - btst 2, %o0 - stb %g0, [%o0] ! *addr = 0; - inc %o0 ! addr++; - dec %o1 ! len--; - btst 2, %o0 ! } -1: - bz,a 1f ! if (addr & 2) { - btst 4, %o0 - sth %g0, [%o0] ! *(short *)addr = 0; - inc 2, %o0 ! addr += 2; - dec 2, %o1 ! len -= 2; - btst 4, %o0 ! } -1: - bz 1f ! if (addr & 4) { - dec 8, %o1 - st %g0, [%o0] ! *(int *)addr = 0; - inc 4, %o0 ! addr += 4; - dec 4, %o1 ! len -= 4; - ! } - /* - * Address is double word aligned; len is 8 less than - * the number of bytes remaining (i.e., len is 0 if - * the remaining count is 8, 1 if it is 9, etc.). - */ -1: - std %g0, [%o0] ! do { -2: ! *(quad *)addr = 0; - inc 8, %o0 ! addr += 8; - deccc 8, %o1 ! } while ((len -= 8) >= 0); - bge,a 2b - std %g0, [%o0] - - /* - * Len is in [-8..-1] where -8 => done, -7 => 1 byte to zero, - * -6 => two bytes, etc. Mop up this remainder, if any. - */ - btst 4, %o1 - bz 1f ! if (len & 4) { - btst 2, %o1 - st %g0, [%o0] ! *(int *)addr = 0; - inc 4, %o0 ! addr += 4; -1: - bz 1f ! if (len & 2) { - btst 1, %o1 - sth %g0, [%o0] ! *(short *)addr = 0; - inc 2, %o0 ! addr += 2; -1: - bnz,a 1f ! if (len & 1) - stb %g0, [%o0] ! *addr = 0; -1: - retl - nop -END_WEAK(bzero) diff --git a/lib/libc/arch/sparc/string/ffs.S b/lib/libc/arch/sparc/string/ffs.S deleted file mode 100644 index 530d7e706e6..00000000000 --- a/lib/libc/arch/sparc/string/ffs.S +++ /dev/null @@ -1,104 +0,0 @@ -/* $OpenBSD: ffs.S,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "DEFS.h" - -/* - * ffs returns the number of the rightmost bit set in its argument, - * i.e., the lowest value such that (x & (ffs(x) - 1)) is nonzero. - * If no bits are set, ffs returns 0. - * - * We use a table lookup on each byte. - * - * In each section below, %o1 is the current byte (0, 1, 2, or 3). - * The last byte is handled specially: for the first three, - * if that byte is nonzero, we return the table value - * (plus 0, 8, or 16 for the byte number), but for the last - * one, we just return the table value plus 24. This means - * that ffstab[0] must be -24 so that ffs(0) will return 0. - */ -ENTRY(ffs) -#ifdef __PIC__ - PICCY_SET(ffstab, %o2, %o5) -#else - set ffstab, %o2 -#endif - andcc %o0, 0xff, %o1 ! get low byte - be,a 1f ! try again if 0 - srl %o0, 8, %o0 ! delay slot, get ready for next byte - - retl ! return ffstab[%o1] - ldsb [%o2 + %o1], %o0 - -1: - andcc %o0, 0xff, %o1 ! byte 1 like byte 0... - be,a 2f - srl %o0, 8, %o0 ! (use delay to prepare for byte 2) - - ldsb [%o2 + %o1], %o0 - retl ! return ffstab[%o1] + 8 - add %o0, 8, %o0 - -2: - andcc %o0, 0xff, %o1 - be,a 3f - srl %o0, 8, %o0 ! (prepare for byte 3) - - ldsb [%o2 + %o1], %o0 - retl ! return ffstab[%o1] + 16 - add %o0, 16, %o0 - -3: ! just return ffstab[%o0] + 24 - ldsb [%o2 + %o0], %o0 - retl - add %o0, 24, %o0 -END_WEAK(ffs) - -ffstab: - .byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-1f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 20-2f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 30-3f */ - .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 40-4f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 50-5f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 60-6f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 70-7f */ - .byte 8,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 80-8f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-9f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* a0-af */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* b0-bf */ - .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* c0-cf */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* d0-df */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* e0-ef */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* f0-ff */ diff --git a/lib/libc/arch/sparc/string/strlen.S b/lib/libc/arch/sparc/string/strlen.S deleted file mode 100644 index c23bfbeff0d..00000000000 --- a/lib/libc/arch/sparc/string/strlen.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: strlen.S,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "DEFS.h" - -ENTRY(strlen) - add %o0, 1, %o1 ! save starting point + 1 -1: - ldsb [%o0], %o2 ! fetch byte - tst %o2 ! null? - bne 1b ! no, keep going - inc %o0 ! always increment pointer - retl - sub %o0, %o1, %o0 ! return length (ptr - (origptr+1)) -END_STRONG(strlen) diff --git a/lib/libc/arch/sparc/sys/Ovfork.S b/lib/libc/arch/sparc/sys/Ovfork.S deleted file mode 100644 index fd37aecda0b..00000000000 --- a/lib/libc/arch/sparc/sys/Ovfork.S +++ /dev/null @@ -1,37 +0,0 @@ -/* $OpenBSD: Ovfork.S,v 1.6 2016/05/07 19:05:22 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "SYS.h" - -RSYSCALL_HIDDEN(vfork) diff --git a/lib/libc/arch/sparc/sys/brk.S b/lib/libc/arch/sparc/sys/brk.S deleted file mode 100644 index f3aa5c9a8e5..00000000000 --- a/lib/libc/arch/sparc/sys/brk.S +++ /dev/null @@ -1,98 +0,0 @@ -/* $OpenBSD: brk.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "SYS.h" - - .globl __curbrk - - .data -__minbrk: - .long _end ! lower brk limit; also for gmon code - END(__minbrk) - .type __minbrk,@object - - .text - - .weak brk - -#ifdef __PIC__ -ENTRY(brk) - PIC_PROLOGUE(%o5,%o4) -#if __PIC__ == 1 - ld [%o5 + __minbrk], %o4 -#else /* __PIC__ == 2 */ - sethi %hi(__minbrk), %o4 - or %o4, %lo(__minbrk), %o4 - ld [%o5 + %o4], %o4 -#endif - ld [%o4], %o1 ! %o1 = minbrk - cmp %o1, %o0 ! if (minbrk > %o0) - bgu,a 0f - mov %o1, %o0 ! %o0 = minbrk -0: - mov %o0, %o2 ! save argument to syscall - mov SYS_break, %g1 - t ST_SYSCALL - bcc,a 1f -#if __PIC__ == 1 - ld [%o5 + __curbrk], %o4 -#else /* __PIC__ == 2 */ - sethi %hi(__curbrk), %o4 - or %o4, %lo(__curbrk), %o4 - ld [%o5 + %o4], %o4 -#endif - ERROR() -1: - retl ! success, return 0 & record new break - st %o2, [%o4] -END(brk) -#else -ENTRY(brk) - sethi %hi(__minbrk), %o1 ! %o1 = minbrk - ld [%o1 + %lo(__minbrk)], %o1 - cmp %o1, %o0 ! if (minbrk > %o0) - bgu,a 0f - mov %o1, %o0 ! %o0 = minbrk -0: - mov %o0, %o2 ! save argument to syscall - mov SYS_break, %g1 - t ST_SYSCALL - bcc,a 1f - sethi %hi(__curbrk), %g1 - ERROR() -1: - retl ! success, return 0 & record new break - st %o2, [%g1 + %lo(__curbrk)] -END(brk) -#endif diff --git a/lib/libc/arch/sparc/sys/sbrk.S b/lib/libc/arch/sparc/sys/sbrk.S deleted file mode 100644 index b0d3497976c..00000000000 --- a/lib/libc/arch/sparc/sys/sbrk.S +++ /dev/null @@ -1,85 +0,0 @@ -/* $OpenBSD: sbrk.S,v 1.9 2015/09/10 13:29:09 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "SYS.h" - - .globl _end - .globl __curbrk - .hidden __curbrk - - .data -__curbrk: .long _end - END(__curbrk) - .type __curbrk,@object - - .text - - .weak sbrk - -ENTRY(sbrk) -#ifdef __PIC__ - PIC_PROLOGUE(%o5,%o4) -#if __PIC__ == 1 - ld [%o5 + __curbrk], %o2 -#else /* __PIC__ == 2 */ - sethi %hi(__curbrk), %o2 - or %o2, %lo(__curbrk), %o2 - ld [%o5 + %o2], %o2 -#endif - ld [%o2], %o3 ! %o3 = old break - add %o3, %o0, %o4 ! %o4 = new break - mov %o4, %o0 ! copy for syscall - mov SYS_break, %g1 - t ST_SYSCALL ! break(new_break) - bcc,a 1f ! if success, - mov %o3, %o0 ! set return value - ERROR() -1: - retl ! and update curbrk - st %o4, [%o2] -#else - sethi %hi(__curbrk), %o2 - ld [%o2 + %lo(__curbrk)], %o3 ! %o3 = old break - add %o3, %o0, %o4 ! %o4 = new break - mov %o4, %o0 ! copy for syscall - mov SYS_break, %g1 - t ST_SYSCALL ! break(new_break) - bcc,a 1f ! if success, - mov %o3, %o0 ! set return value - ERROR() -1: - retl ! and update curbrk - st %o4, [%o2 + %lo(__curbrk)] -#endif -END(sbrk) diff --git a/lib/libc/arch/sparc/sys/sigpending.S b/lib/libc/arch/sparc/sys/sigpending.S deleted file mode 100644 index cfc6ab51a75..00000000000 --- a/lib/libc/arch/sparc/sys/sigpending.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: sigpending.S,v 1.6 2015/09/10 13:29:09 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "SYS.h" - -SYSENTRY(sigpending) - mov %o0, %o2 ! save pointer - mov SYS_sigpending, %g1 - t ST_SYSCALL ! sigpending() - bcc,a 1f ! if success, - st %o0, [%o2] ! store return value - ERROR() -1: - retl ! and return 0 - clr %o0 -SYSCALL_END(sigpending) diff --git a/lib/libc/arch/sparc/sys/sigprocmask.S b/lib/libc/arch/sparc/sys/sigprocmask.S deleted file mode 100644 index 7122af5f842..00000000000 --- a/lib/libc/arch/sparc/sys/sigprocmask.S +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: sigprocmask.S,v 1.7 2015/10/23 04:39:25 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "SYS.h" - -/* - * sigprocmask(int how, sigset_t *set, sigset_t *oset) - */ -SYSENTRY_HIDDEN(sigprocmask) - tst %o1 ! set == NULL? - bne,a 1f ! if not, - ld [%o1], %o1 ! replace it in %o1 with *set -! clr %o1 ! else block no signals ... - mov 1, %o0 ! ... using sigprocmask(SIG_BLOCK) -1: - mov SYS_sigprocmask, %g1 - t ST_SYSCALL - bcc 2f ! if success, - tst %o2 ! check to see if oset requested - ERROR() -2: - bne,a 3f ! if oset != NULL, - st %o0, [%o2] ! *oset = oldmask -3: - retl ! in any case, return 0 - clr %o0 -SYSCALL_END_HIDDEN(sigprocmask) diff --git a/lib/libc/arch/sparc/sys/sigsuspend.S b/lib/libc/arch/sparc/sys/sigsuspend.S deleted file mode 100644 index 0dcd0dbaff0..00000000000 --- a/lib/libc/arch/sparc/sys/sigsuspend.S +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: sigsuspend.S,v 1.7 2016/05/07 19:05:22 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "SYS.h" - -SYSENTRY_HIDDEN(sigsuspend) - ld [%o0], %o0 ! indirect to mask argument - mov SYS_sigsuspend, %g1 - t ST_SYSCALL - ERROR() ! always terminates with EINTR -SYSCALL_END_HIDDEN(sigsuspend) diff --git a/lib/libc/arch/sparc/sys/syscall.S b/lib/libc/arch/sparc/sys/syscall.S deleted file mode 100644 index 45ce38791d8..00000000000 --- a/lib/libc/arch/sparc/sys/syscall.S +++ /dev/null @@ -1,37 +0,0 @@ -/* $OpenBSD: syscall.S,v 1.5 2016/03/27 21:59:32 guenther Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "SYS.h" - -RSYSCALL(syscall) diff --git a/lib/libc/arch/sparc/sys/tfork_thread.S b/lib/libc/arch/sparc/sys/tfork_thread.S deleted file mode 100644 index 09bf0083810..00000000000 --- a/lib/libc/arch/sparc/sys/tfork_thread.S +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: tfork_thread.S,v 1.2 2012/06/21 00:56:59 guenther Exp $ */ - -/* - * Copyright (c) 2005, Miodrag Vallat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "SYS.h" - -/* - * int __tfork_thread(const struct __tfork *param, size_t psize, void (*func)(void *), void *arg); - */ -ENTRY(__tfork_thread) - /* - * We can not invoke __tfork as a G2-style system call since we want - * different return paths. - */ - mov SYS___tfork, %g1 - t ST_SYSCALL - bcs 9f - nop - - cmp %o0, 0 - be 1f - nop - - /* - * In parent process: just return. - */ - retl - nop - -1: - /* - * In child process: invoke function, then exit. - */ - call %o2 /* func */ - mov %o3, %o0 /* arg */ - - mov SYS___threxit, %g1 - clr %o0 - t ST_SYSCALL /* will not return */ - -9: - /* - * System call failure. - */ - ERROR() diff --git a/lib/libm/arch/sparc/fenv.c b/lib/libm/arch/sparc/fenv.c deleted file mode 100644 index c226db4ee48..00000000000 --- a/lib/libm/arch/sparc/fenv.c +++ /dev/null @@ -1,336 +0,0 @@ -/* $OpenBSD: fenv.c,v 1.4 2014/04/18 15:09:52 guenther Exp $ */ -/* $NetBSD: fenv.c,v 1.1 2011/01/31 00:19:33 christos Exp $ */ - -/*- - * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - */ - -#include <fenv.h> - -/* - * The following constant represents the default floating-point environment - * (that is, the one installed at program startup) and has type pointer to - * const-qualified fenv_t. - * - * It can be used as an argument to the functions within the <fenv.h> header - * that manage the floating-point environment, namely fesetenv() and - * feupdateenv(). - */ -fenv_t __fe_dfl_env = 0; - -/* - * The feclearexcept() function clears the supported floating-point exceptions - * represented by `excepts'. - */ -int -feclearexcept(int excepts) -{ - fexcept_t r; - - excepts &= FE_ALL_EXCEPT; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - r &= ~excepts; - - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (r)); - - return 0; -} - -/* - * The fegetexceptflag() function stores an implementation-defined - * representation of the states of the floating-point status flags indicated - * by the argument excepts in the object pointed to by the argument flagp. - */ -int -fegetexceptflag(fexcept_t *flagp, int excepts) -{ - fexcept_t r; - - excepts &= FE_ALL_EXCEPT; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - *flagp = r & excepts; - - return 0; -} - - -/* - * This function sets the floating-point status flags indicated by the argument - * `excepts' to the states stored in the object pointed to by `flagp'. It does - * NOT raise any floating-point exceptions, but only sets the state of the flags. - */ -int -fesetexceptflag(const fexcept_t *flagp, int excepts) -{ - fexcept_t r; - - excepts &= FE_ALL_EXCEPT; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - r &= ~excepts; - r |= *flagp & excepts; - - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (r)); - - return 0; -} - -/* - * The feraiseexcept() function raises the supported floating-point exceptions - * represented by the argument `excepts'. - * - * The order in which these floating-point exceptions are raised is unspecified - * (by the standard). - */ -int -feraiseexcept(int excepts) -{ - volatile double d; - - excepts &= FE_ALL_EXCEPT; - - /* - * With a compiler that supports the FENV_ACCESS pragma properly, simple - * expressions like '0.0 / 0.0' should be sufficient to generate traps. - * Unfortunately, we need to bring a volatile variable into the equation - * to prevent incorrect optimizations. - */ - if (excepts & FE_INVALID) { - d = 0.0; - d = 0.0 / d; - } - if (excepts & FE_DIVBYZERO) { - d = 0.0; - d = 1.0 / d; - } - if (excepts & FE_OVERFLOW) { - d = 0x1.ffp1023; - d *= 2.0; - } - if (excepts & FE_UNDERFLOW) { - d = 0x1p-1022; - d /= 0x1p1023; - } - if (excepts & FE_INEXACT) { - d = 0x1p-1022; - d += 1.0; - } - - return 0; -} - -/* - * The fetestexcept() function determines which of a specified subset of the - * floating-point exception flags are currently set. The `excepts' argument - * specifies the floating-point status flags to be queried. - */ -int -fetestexcept(int excepts) -{ - fexcept_t r; - - excepts &= FE_ALL_EXCEPT; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - return r & excepts; -} - -/* - * The fegetround() function gets the current rounding direction. - */ -int -fegetround(void) -{ - fenv_t r; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - return (r >> _ROUND_SHIFT) & _ROUND_MASK; -} - -/* - * The fesetround() function establishes the rounding direction represented by - * its argument `round'. If the argument is not equal to the value of a rounding - * direction macro, the rounding direction is not changed. - */ -int -fesetround(int round) -{ - fenv_t r; - - if (round & ~_ROUND_MASK) - return -1; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - r &= ~(_ROUND_MASK << _ROUND_SHIFT); - r |= round << _ROUND_SHIFT; - - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (r)); - - return 0; -} - -/* - * The fegetenv() function attempts to store the current floating-point - * environment in the object pointed to by envp. - */ -int -fegetenv(fenv_t *envp) -{ - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (*envp)); - - return 0; -} - - -/* - * The feholdexcept() function saves the current floating-point environment - * in the object pointed to by envp, clears the floating-point status flags, and - * then installs a non-stop (continue on floating-point exceptions) mode, if - * available, for all floating-point exceptions. - */ -int -feholdexcept(fenv_t *envp) -{ - fenv_t r; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - *envp = r; - r &= ~(FE_ALL_EXCEPT | (FE_ALL_EXCEPT << _MASK_SHIFT)); - - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (r)); - - return 0; -} - -/* - * The fesetenv() function attempts to establish the floating-point environment - * represented by the object pointed to by envp. The argument `envp' points - * to an object set by a call to fegetenv() or feholdexcept(), or equal a - * floating-point environment macro. The fesetenv() function does not raise - * floating-point exceptions, but only installs the state of the floating-point - * status flags represented through its argument. - */ -int -fesetenv(const fenv_t *envp) -{ - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (*envp)); - - return 0; -} - - -/* - * The feupdateenv() function saves the currently raised floating-point - * exceptions in its automatic storage, installs the floating-point environment - * represented by the object pointed to by `envp', and then raises the saved - * floating-point exceptions. The argument `envp' shall point to an object set - * by a call to feholdexcept() or fegetenv(), or equal a floating-point - * environment macro. - */ -int -feupdateenv(const fenv_t *envp) -{ - fexcept_t r; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (*envp)); - - feraiseexcept(r & FE_ALL_EXCEPT); - - return 0; -} - -/* - * The following functions are extentions to the standard - */ -int -feenableexcept(int mask) -{ - fenv_t old_r, new_r; - - mask &= FE_ALL_EXCEPT; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (old_r)); - - new_r = old_r | (mask << _MASK_SHIFT); - - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (new_r)); - - return (old_r >> _MASK_SHIFT) & FE_ALL_EXCEPT; -} - -int -fedisableexcept(int mask) -{ - fenv_t old_r, new_r; - - mask &= FE_ALL_EXCEPT; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (old_r)); - - new_r = old_r & ~(mask << _MASK_SHIFT); - - /* Load floating-point state register */ - __asm__ volatile ("ld %0, %%fsr" : : "m" (new_r)); - - return (old_r >> _MASK_SHIFT) & FE_ALL_EXCEPT; -} - -int -fegetexcept(void) -{ - fenv_t r; - - /* Save floating-point state register */ - __asm__ volatile ("st %%fsr, %0" : "=m" (r)); - - return (r & (FE_ALL_EXCEPT << _MASK_SHIFT)) >> _MASK_SHIFT; -} |