diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-04-19 19:14:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-04-19 19:14:57 +0000 |
commit | da0144fa66bbe4dd734def64a18f43c73c49a83a (patch) | |
tree | b57308b0b486e33f60e1d04f094821b577d45856 /lib/libc | |
parent | 5449d7759b0759fad6328dc4d80cfa18aa77a699 (diff) |
rely on the compiler giving us a built-in alloca. any new architecture
or compiler we use will.
ok millert
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/arch/amd64/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/arch/amd64/gen/alloca.S | 13 | ||||
-rw-r--r-- | lib/libc/arch/arm/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/arch/arm/gen/alloca.S | 45 | ||||
-rw-r--r-- | lib/libc/arch/i386/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/arch/i386/gen/alloca.S | 50 | ||||
-rw-r--r-- | lib/libc/arch/m68k/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/arch/m68k/gen/alloca.S | 47 | ||||
-rw-r--r-- | lib/libc/arch/sparc64/gen/Makefile.inc | 12 | ||||
-rw-r--r-- | lib/libc/arch/vax/gen/Makefile.inc | 8 | ||||
-rw-r--r-- | lib/libc/arch/vax/gen/alloca.S | 42 |
11 files changed, 14 insertions, 219 deletions
diff --git a/lib/libc/arch/amd64/gen/Makefile.inc b/lib/libc/arch/amd64/gen/Makefile.inc index 283e1115513..e995309ed71 100644 --- a/lib/libc/arch/amd64/gen/Makefile.inc +++ b/lib/libc/arch/amd64/gen/Makefile.inc @@ -1,9 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.11 2012/04/12 16:14:09 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.12 2012/04/19 19:14:55 deraadt Exp $ SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.S nan.c setjmp.S \ sigsetjmp.S SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c isnormall.c signbitl.c SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \ fpsetround.S fpsetsticky.S - -SRCS+= alloca.S diff --git a/lib/libc/arch/amd64/gen/alloca.S b/lib/libc/arch/amd64/gen/alloca.S deleted file mode 100644 index 8c15583012c..00000000000 --- a/lib/libc/arch/amd64/gen/alloca.S +++ /dev/null @@ -1,13 +0,0 @@ -/* $OpenBSD: alloca.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: alloca.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ - -#include <machine/asm.h> - -ENTRY(alloca) - popq %rdx - movq %rsp,%rcx - addq $15,%rdi /* round up to 16 bytes */ - andq $~15,%rdi - subq %rdi,%rsp - movq %rsp,%rax - jmp *%rdx diff --git a/lib/libc/arch/arm/gen/Makefile.inc b/lib/libc/arch/arm/gen/Makefile.inc index fbaf8d4382f..1b4ab2f3ae7 100644 --- a/lib/libc/arch/arm/gen/Makefile.inc +++ b/lib/libc/arch/arm/gen/Makefile.inc @@ -1,8 +1,6 @@ -# $OpenBSD: Makefile.inc,v 1.14 2012/04/12 16:14:09 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.15 2012/04/19 19:14:56 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.6 2003/08/01 17:03:47 lukem Exp $ SRCS+= byte_swap_2.S byte_swap_4.S divsi3.S fabs.c flt_rounds.c infinity.c SRCS+= ldexp.c modf.c nan.c SRCS+= setjmp.S _setjmp.S sigsetjmp.S - -SRCS+= alloca.S diff --git a/lib/libc/arch/arm/gen/alloca.S b/lib/libc/arch/arm/gen/alloca.S deleted file mode 100644 index 93bbeed50e5..00000000000 --- a/lib/libc/arch/arm/gen/alloca.S +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: alloca.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */ -/* $NetBSD: alloca.S,v 1.3 2003/04/05 23:08:51 bjh21 Exp $ */ - -/* - * Copyright (c) 1995 Mark Brinicombe - * 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 Mark Brinicombe - * 4. 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 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 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* like alloc, but automatic automatic free in return */ - -#include <machine/asm.h> - -ENTRY(alloca) - add r0, r0, #0x00000007 /* round up to next 8 byte alignment */ - bic r0, r0, #0x00000007 - sub sp, sp, r0 /* Adjust the stack pointer */ - mov r0, sp /* r0 = base of new space */ - mov r15, r14 /* return */ diff --git a/lib/libc/arch/i386/gen/Makefile.inc b/lib/libc/arch/i386/gen/Makefile.inc index f87ee1ffe78..4c18e059581 100644 --- a/lib/libc/arch/i386/gen/Makefile.inc +++ b/lib/libc/arch/i386/gen/Makefile.inc @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile.inc,v 1.13 2012/04/12 16:14:09 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.14 2012/04/19 19:14:56 deraadt Exp $ -SRCS+= _setjmp.S alloca.S fabs.S infinity.c ldexp.c \ +SRCS+= _setjmp.S fabs.S infinity.c ldexp.c \ modf.S nan.c setjmp.S sigsetjmp.S SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c isnormall.c signbitl.c SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \ diff --git a/lib/libc/arch/i386/gen/alloca.S b/lib/libc/arch/i386/gen/alloca.S deleted file mode 100644 index 28af9eb12f1..00000000000 --- a/lib/libc/arch/i386/gen/alloca.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: alloca.S,v 1.6 2005/08/07 11:30:38 espie Exp $ */ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * 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 <machine/asm.h> - -/* like alloc, but automatic automatic free in return */ - -ENTRY(alloca) - popl %edx /* pop return addr */ - popl %eax /* pop amount to allocate */ - movl %esp,%ecx - addl $3,%eax /* round up to next word */ - andl $-4,%eax - subl %eax,%esp - movl %esp,%eax /* base of newly allocated space */ - pushl 8(%ecx) /* copy possible saved registers */ - pushl 4(%ecx) - pushl 0(%ecx) - pushl %eax /* dummy to pop at callsite */ - jmp *%edx /* "return" */ diff --git a/lib/libc/arch/m68k/gen/Makefile.inc b/lib/libc/arch/m68k/gen/Makefile.inc index 7a5f72ce459..b7ee20ce153 100644 --- a/lib/libc/arch/m68k/gen/Makefile.inc +++ b/lib/libc/arch/m68k/gen/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.11 2012/04/12 16:14:09 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.12 2012/04/19 19:14:56 deraadt Exp $ SRCS+= _setjmp.S fabs.S infinity.c ldexp.S \ modf.S nan.c setjmp.S sigsetjmp.S @@ -10,5 +10,3 @@ SRCS+= adddf3.S addsf3.S ashlsi3.S ashrsi3.S cmpdf2.S cmpsf2.S divdf3.S \ floatsidf.S lshlsi3.S lshrsi3.S modsi3.S muldf3.S mulsf3.S mulsi3.S \ negdf2.S negsf2.S saveregs.c subdf3.S subsf3.S truncdfsf2.S udivsi3.S \ umodsi3.S umulsi3.S - -SRCS+= alloca.S diff --git a/lib/libc/arch/m68k/gen/alloca.S b/lib/libc/arch/m68k/gen/alloca.S deleted file mode 100644 index d8fe399c940..00000000000 --- a/lib/libc/arch/m68k/gen/alloca.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: alloca.S,v 1.4 2005/08/07 16:40:14 espie Exp $ */ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. - */ - -/* like alloc, but automatic free in return */ - -#include "DEFS.h" - -ENTRY(alloca) - movl sp@,a0 /* save return addr */ - movl sp,d0 /* get current SP value */ - subl sp@(4),d0 /* allocate requested space */ - andb #~3,d0 /* longword align for efficiency */ - addql #8,d0 /* reuse space of call frame */ - movl d0,sp /* set new SP value */ - lea sp@(-4),sp /* account for argument pop in caller */ - jmp a0@ /* funny return */ diff --git a/lib/libc/arch/sparc64/gen/Makefile.inc b/lib/libc/arch/sparc64/gen/Makefile.inc index 6a560d4b56f..e75461ed470 100644 --- a/lib/libc/arch/sparc64/gen/Makefile.inc +++ b/lib/libc/arch/sparc64/gen/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.12 2012/04/12 16:14:09 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.13 2012/04/19 19:14:56 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+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c isnormall.c signbitl.c -SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S setjmp.S sigsetjmp.S +SRCS+= _setjmp.S fabs.S fixunsdfsi.S flt_rounds.c fpclassifyl.c \ + fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ + fpsetround.c fpsetsticky.c infinity.c isfinitel.c \ + isinfl.c isnanl.c isnormall.c ldexp.c modf.S \ + mul.S nan.c saveregs.S setjmp.S signbitl.c sigsetjmp.S umul.S diff --git a/lib/libc/arch/vax/gen/Makefile.inc b/lib/libc/arch/vax/gen/Makefile.inc index 975b3354c32..e4b99b3d917 100644 --- a/lib/libc/arch/vax/gen/Makefile.inc +++ b/lib/libc/arch/vax/gen/Makefile.inc @@ -1,6 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.10 2012/04/12 16:14:09 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.11 2012/04/19 19:14:56 deraadt Exp $ -SRCS+= _setjmp.S fabs.S infinity.c ldexp.S modf.S \ - setjmp.S udiv.S urem.S sigsetjmp.S - -SRCS+= alloca.S +SRCS+= _setjmp.S fabs.S infinity.c ldexp.S modf.S setjmp.S \ + sigsetjmp.S udiv.S urem.S diff --git a/lib/libc/arch/vax/gen/alloca.S b/lib/libc/arch/vax/gen/alloca.S deleted file mode 100644 index 051ddb0db9b..00000000000 --- a/lib/libc/arch/vax/gen/alloca.S +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: alloca.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. 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. 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(alloca, R2) - movl 4(ap),r0 # get allocation size - movl 16(fp),r2 # save return address before we smash it - movab here,16(fp) - ret -here: - subl2 r0,sp # create stack space - bicl2 $3,sp # align to longword boundary - movl sp,r0 - jmp (r2) |