diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-11-14 21:53:04 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-11-14 21:53:04 +0000 |
commit | 8ced3373b2371c49ada7379cc96f449ca67ec9e9 (patch) | |
tree | 19bf30e1f09c9ee98f9dec46967ae7accdb1acb4 /lib | |
parent | ea58e11937d8d252af4b25562047bddb4c759ae9 (diff) |
Split the non-syscall ASM bits from SYS.h into DEFS.h and use that in the
non-syscall .S source
ok millert@ miod@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/amd64/DEFS.h | 61 | ||||
-rw-r--r-- | lib/libc/arch/amd64/SYS.h | 26 | ||||
-rw-r--r-- | lib/libc/arch/amd64/gen/flt_rounds.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/bcmp.S | 2 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/bzero.S | 2 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/ffs.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/memchr.S | 2 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/memmove.S | 2 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/memset.S | 2 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/strchr.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/strcmp.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/strlen.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/strrchr.S | 4 |
13 files changed, 80 insertions, 41 deletions
diff --git a/lib/libc/arch/amd64/DEFS.h b/lib/libc/arch/amd64/DEFS.h new file mode 100644 index 00000000000..9a2daa3d424 --- /dev/null +++ b/lib/libc/arch/amd64/DEFS.h @@ -0,0 +1,61 @@ +/* $OpenBSD: DEFS.h,v 1.1 2015/11/14 21:53:03 guenther 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. + * + * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91 + * $NetBSD: SYS.h,v 1.5 2002/06/03 18:30:32 fvdl 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/amd64/SYS.h b/lib/libc/arch/amd64/SYS.h index e9b6be457eb..3168fa60ab2 100644 --- a/lib/libc/arch/amd64/SYS.h +++ b/lib/libc/arch/amd64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.17 2015/10/23 04:39:24 guenther Exp $ */ +/* $OpenBSD: SYS.h,v 1.18 2015/11/14 21:53:03 guenther Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -35,31 +35,9 @@ * $NetBSD: SYS.h,v 1.5 2002/06/03 18:30:32 fvdl Exp $ */ -#include <machine/asm.h> +#include "DEFS.h" #include <sys/syscall.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 - #define SYSTRAP(x) movl $(SYS_ ## x),%eax; movq %rcx, %r10; syscall diff --git a/lib/libc/arch/amd64/gen/flt_rounds.S b/lib/libc/arch/amd64/gen/flt_rounds.S index b0def90d548..556e5850173 100644 --- a/lib/libc/arch/amd64/gen/flt_rounds.S +++ b/lib/libc/arch/amd64/gen/flt_rounds.S @@ -1,4 +1,4 @@ -/* $OpenBSD: flt_rounds.S,v 1.5 2015/10/27 05:54:49 guenther Exp $ */ +/* $OpenBSD: flt_rounds.S,v 1.6 2015/11/14 21:53:03 guenther Exp $ */ /* $NetBSD: flt_rounds.S,v 1.2 2002/06/06 23:04:35 fvdl Exp $ */ /* @@ -6,7 +6,7 @@ * Public domain. */ -#include "SYS.h" +#include "DEFS.h" .text _ALIGN_TEXT diff --git a/lib/libc/arch/amd64/string/bcmp.S b/lib/libc/arch/amd64/string/bcmp.S index fc7afe5b8be..d0b20aa9aca 100644 --- a/lib/libc/arch/amd64/string/bcmp.S +++ b/lib/libc/arch/amd64/string/bcmp.S @@ -1,4 +1,4 @@ -#include "SYS.h" +#include "DEFS.h" ENTRY(bcmp) xorl %eax,%eax /* clear return value */ diff --git a/lib/libc/arch/amd64/string/bzero.S b/lib/libc/arch/amd64/string/bzero.S index eb3a7713be7..f692b57632a 100644 --- a/lib/libc/arch/amd64/string/bzero.S +++ b/lib/libc/arch/amd64/string/bzero.S @@ -4,7 +4,7 @@ * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include "SYS.h" +#include "DEFS.h" ENTRY(bzero) movq %rsi,%rdx diff --git a/lib/libc/arch/amd64/string/ffs.S b/lib/libc/arch/amd64/string/ffs.S index 3e2d81e56b5..c10fb6b85f5 100644 --- a/lib/libc/arch/amd64/string/ffs.S +++ b/lib/libc/arch/amd64/string/ffs.S @@ -1,11 +1,11 @@ -/* $OpenBSD: ffs.S,v 1.3 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: ffs.S,v 1.4 2015/11/14 21:53:03 guenther Exp $ */ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include "SYS.h" +#include "DEFS.h" ENTRY(ffs) bsfl %edi,%eax diff --git a/lib/libc/arch/amd64/string/memchr.S b/lib/libc/arch/amd64/string/memchr.S index 4fe2d4d996a..9394c7e738c 100644 --- a/lib/libc/arch/amd64/string/memchr.S +++ b/lib/libc/arch/amd64/string/memchr.S @@ -4,7 +4,7 @@ * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include "SYS.h" +#include "DEFS.h" ENTRY(memchr) movb %sil,%al /* set character to search for */ diff --git a/lib/libc/arch/amd64/string/memmove.S b/lib/libc/arch/amd64/string/memmove.S index 8a924a06801..f0e01654c2f 100644 --- a/lib/libc/arch/amd64/string/memmove.S +++ b/lib/libc/arch/amd64/string/memmove.S @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ -#include "SYS.h" +#include "DEFS.h" /* * memmove (dst,src,cnt) diff --git a/lib/libc/arch/amd64/string/memset.S b/lib/libc/arch/amd64/string/memset.S index 779ea53b9f8..b3f4ffa17bf 100644 --- a/lib/libc/arch/amd64/string/memset.S +++ b/lib/libc/arch/amd64/string/memset.S @@ -4,7 +4,7 @@ * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> */ -#include "SYS.h" +#include "DEFS.h" ENTRY(memset) movq %rsi,%rax diff --git a/lib/libc/arch/amd64/string/strchr.S b/lib/libc/arch/amd64/string/strchr.S index 285ce084114..4711116c36a 100644 --- a/lib/libc/arch/amd64/string/strchr.S +++ b/lib/libc/arch/amd64/string/strchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strchr.S,v 1.7 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: strchr.S,v 1.8 2015/11/14 21:53:03 guenther Exp $ */ /* $NetBSD: strchr.S,v 1.7 2014/03/22 19:16:34 jakllsch Exp $ */ /*- @@ -32,7 +32,7 @@ /* See comments in strlen.S about checking words for byte values */ -#include "SYS.h" +#include "DEFS.h" WEAK_ALIAS(index, strchr) diff --git a/lib/libc/arch/amd64/string/strcmp.S b/lib/libc/arch/amd64/string/strcmp.S index 752d8e8c1d7..11df374cc70 100644 --- a/lib/libc/arch/amd64/string/strcmp.S +++ b/lib/libc/arch/amd64/string/strcmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strcmp.S,v 1.6 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: strcmp.S,v 1.7 2015/11/14 21:53:03 guenther Exp $ */ /* $NetBSD: strcmp.S,v 1.2 2014/03/22 19:16:34 jakllsch Exp $ */ /* @@ -6,7 +6,7 @@ * Public domain. */ -#include "SYS.h" +#include "DEFS.h" ENTRY(strcmp) /* diff --git a/lib/libc/arch/amd64/string/strlen.S b/lib/libc/arch/amd64/string/strlen.S index bde5df68e6e..29c3e18fe79 100644 --- a/lib/libc/arch/amd64/string/strlen.S +++ b/lib/libc/arch/amd64/string/strlen.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strlen.S,v 1.5 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: strlen.S,v 1.6 2015/11/14 21:53:03 guenther Exp $ */ /* $NetBSD: strlen.S,v 1.6 2014/03/22 19:16:34 jakllsch Exp $ */ /*- @@ -35,7 +35,7 @@ * (Only the long comment really remains his work!) */ -#include "SYS.h" +#include "DEFS.h" /* * There are many well known branch-free sequences which are used diff --git a/lib/libc/arch/amd64/string/strrchr.S b/lib/libc/arch/amd64/string/strrchr.S index 44a3839cf96..b5ef58806fc 100644 --- a/lib/libc/arch/amd64/string/strrchr.S +++ b/lib/libc/arch/amd64/string/strrchr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: strrchr.S,v 1.7 2015/08/31 02:53:56 guenther Exp $ */ +/* $OpenBSD: strrchr.S,v 1.8 2015/11/14 21:53:03 guenther Exp $ */ /* $NetBSD: strrchr.S,v 1.3 2014/03/22 19:16:34 jakllsch Exp $ */ /* @@ -6,7 +6,7 @@ * Public domain. */ -#include "SYS.h" +#include "DEFS.h" WEAK_ALIAS(rindex, strrchr) |