From: Imre Vadasz Date: Mon, 29 Feb 2016 20:14:44 +0000 (+0100) Subject: lib/libstand: Remove special lib/libstand/machine headers. X-Git-Tag: v4.6.0rc~767 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/5a6cf1bb53c8beb49e681751a80b27db2970f5bf lib/libstand: Remove special lib/libstand/machine headers. * stdarg.h was identical * stdint.h stuff was already included in sys/cpu/x86_64/include/stdint.h. * endian.h is obsoleted by the sys/cpu/x86_64/include/endian.h. * Added #ifdef-s to sys/cpu/x86_64/include/asm.h to handle the __i386__ case. * No need for CFLAGS+= -I${.CURDIR} in lib/libstand/Makefile anymore. --- diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile index af24f4ef2c..bfde95a03b 100644 --- a/lib/libstand/Makefile +++ b/lib/libstand/Makefile @@ -94,7 +94,3 @@ SRCS+= hammer1.c SRCS+= hammer2.c .include - -.if ${MACHINE_ARCH} == "x86_64" -CFLAGS+= -I${.CURDIR} -.endif diff --git a/lib/libstand/machine/asm.h b/lib/libstand/machine/asm.h deleted file mode 100644 index c0af8bbd74..0000000000 --- a/lib/libstand/machine/asm.h +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * 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: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 - * $FreeBSD: src/sys/i386/include/asm.h,v 1.7 2000/01/25 09:01:55 bde Exp $ - */ - -#ifndef _CPU_ASM_H_ -#define _CPU_ASM_H_ - -#include - -#ifdef PIC -#define PIC_PROLOGUE \ - pushl %ebx; \ - call 1f; \ -1: \ - popl %ebx; \ - addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx -#define PIC_EPILOGUE \ - popl %ebx -#define PIC_PLT(x) x@PLT -#define PIC_GOT(x) x@GOT(%ebx) -#define PIC_GOTOFF(x) x@GOTOFF(%ebx) -#else -#define PIC_PROLOGUE -#define PIC_EPILOGUE -#define PIC_PLT(x) x -#define PIC_GOT(x) x -#define PIC_GOTOFF(x) x -#endif - -/* - * CNAME and HIDENAME manage the relationship between symbol names in C - * and the equivalent assembly language names. CNAME is given a name as - * it would be used in a C program. It expands to the equivalent assembly - * language name. HIDENAME is given an assembly-language name, and expands - * to a possibly-modified form that will be invisible to C programs. - */ -#define CNAME(csym) csym -#define HIDENAME(asmsym) .asmsym - -/* XXX should use .p2align 4,0x90 for -m486. */ -#define _START_ENTRY .text; .p2align 2,0x90 - -#define _ENTRY(x) _START_ENTRY; \ - .globl CNAME(x); .type CNAME(x),@function; CNAME(x): -#define END(x) .size x, . - x - -#ifdef PROF -#define ALTENTRY(x) _ENTRY(x); \ - pushl %ebp; movl %esp,%ebp; \ - call PIC_PLT(HIDENAME(mcount)); \ - popl %ebp; \ - jmp 9f -#define ENTRY(x) _ENTRY(x); \ - pushl %ebp; movl %esp,%ebp; \ - call PIC_PLT(HIDENAME(mcount)); \ - popl %ebp; \ - 9: -#else -#define ALTENTRY(x) _ENTRY(x) -#define ENTRY(x) _ENTRY(x) -#endif - -#define RCSID(x) .text; .asciz x - -#endif /* !_CPU_ASM_H_ */ diff --git a/lib/libstand/machine/endian.h b/lib/libstand/machine/endian.h deleted file mode 100644 index 24e7b8d5f7..0000000000 --- a/lib/libstand/machine/endian.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2004 The DragonFly Project. All rights reserved. - * - * Copyright (c) 1987, 1991 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. - * - * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 - * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ - */ - -#ifndef _CPU_ENDIAN_H_ -#define _CPU_ENDIAN_H_ - -#include -#include - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 1 -#define _QUAD_LOWWORD 0 - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define _BYTE_ORDER _LITTLE_ENDIAN - -/* - * Deprecated variants that don't have enough underscores to be useful in more - * strict namespaces. - */ -#if __BSD_VISIBLE -#define LITTLE_ENDIAN _LITTLE_ENDIAN -#define BIG_ENDIAN _BIG_ENDIAN -#define PDP_ENDIAN _PDP_ENDIAN -#define BYTE_ORDER _BYTE_ORDER -#endif - -#define __htonl(x) __bswap32(x) -#define __htons(x) __bswap16(x) -#define __ntohl(x) __bswap32(x) -#define __ntohs(x) __bswap16(x) - -#define __byte_swap16_const(x) \ - ((((x) & 0xff00) >> 8) | \ - (((x) & 0x00ff) << 8)) - -#define __byte_swap32_const(x) \ - ((((x) & 0xff000000) >> 24) | \ - (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | \ - (((x) & 0x000000ff) << 24)) - -#define __byte_swap64_const(x) \ - (((x) >> 56) | (((x) >> 40) & 0xff00) | (((x) >> 24) & 0xff0000) | \ - (((x) >> 8) & 0xff000000) | (((x) << 8) & ((__uint64_t)0xff << 32)) | \ - (((x) << 24) & ((__uint64_t)0xff << 40)) | \ - (((x) << 40) & ((__uint64_t)0xff << 48)) | (((x) << 56))) - -#if defined(__INTEL_COMPILER) -# if !defined(__cplusplus) || (defined(__cplusplus) && __INTEL_COMPILER >= 800) -# define __INTEL_COMPILER_with_DragonFly_endian 1 -# endif -#endif - -#if defined(__GNUC__) || defined(__INTEL_COMPILER_with_DragonFly_endian) - -#define __byte_swap32_var(x) \ - __extension__ ({ register __uint32_t __X = (x); \ - __asm ("bswap %0" : "+r" (__X)); \ - __X; }) - -#define __byte_swap16_var(x) \ - __extension__ ({ register __uint16_t __X = (x); \ - __asm ("xchgb %h0, %b0" : "+Q" (__X)); \ - __X; }) - -#ifdef __OPTIMIZE__ - -#define __byte_swap16(x) (__builtin_constant_p(x) ? \ - __byte_swap16_const(x) : __byte_swap16_var(x)) - -#define __byte_swap32(x) (__builtin_constant_p(x) ? \ - __byte_swap32_const(x) : __byte_swap32_var(x)) - -#else /* __OPTIMIZE__ */ - -#define __byte_swap16(x) __byte_swap16_var(x) -#define __byte_swap32(x) __byte_swap32_var(x) - -#endif /* __OPTIMIZE__ */ - -#endif /* __GNUC__ || __INTEL_COMPILER_with_DragonFly_endian */ - -/* - * If the compiler-specific part didn't provide this, fallback - * to the generic versions. - */ - -#ifndef __byte_swap16 -#define __byte_swap16(x) __byte_swap16_const(x) -#endif - -#ifndef __byte_swap32 -#define __byte_swap32(x) __byte_swap32_const(x) -#endif - -#ifndef __byte_swap64 -#define __byte_swap64(x) __byte_swap64_const(x) -#endif - -__BEGIN_DECLS - -static __inline __uint16_t -__bswap16(__uint16_t _x) -{ - return (__byte_swap16(_x)); -} - -static __inline __uint32_t -__bswap32(__uint32_t _x) -{ - return (__byte_swap32(_x)); -} - -static __inline __uint64_t -__bswap64(__uint64_t _x) -{ - return (__byte_swap64(_x)); -} - -__END_DECLS - -#endif /* !_CPU_ENDIAN_H_ */ diff --git a/lib/libstand/machine/stdarg.h b/lib/libstand/machine/stdarg.h deleted file mode 100644 index 901c6f2b95..0000000000 --- a/lib/libstand/machine/stdarg.h +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * 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. - * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/i386/include/stdarg.h,v 1.10 1999/08/28 00:44:26 peter Exp $ - */ - -#ifndef _CPU_STDARG_H_ -#define _CPU_STDARG_H_ - -/* - * GNUC mess - */ -#if defined(__GNUC__) -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* post GCC 2.95 */ -#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - -/* - * Standard va types and macros - */ -#define __va_size(type) \ - (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) - -#ifdef __GNUC__ - -#define __va_start(ap, last) \ - __builtin_va_start(ap, last) -#define __va_arg(ap, type) \ - __builtin_va_arg((ap), type) -#define __va_copy(dest, src) \ - __builtin_va_copy((dest), (src)) -#define __va_end(ap) \ - __builtin_va_end(ap) - -#else /* !__GNUC__ */ - -/* Provide a free-standing implementation */ -#define __va_start(ap, last) \ - ((ap) = (__va_list)&(last) + __va_size(last)) -#define __va_arg(ap, type) \ - (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) -/* This assumes a typical stack machine */ -#define __va_copy(dest, src) \ - ((void)((dest) = (src))) -#define __va_end(ap) - -#endif /* __GNUC__ */ - -#endif /* !_CPU_STDARG_H_ */ diff --git a/lib/libstand/machine/stdint.h b/lib/libstand/machine/stdint.h deleted file mode 100644 index 8b5cada100..0000000000 --- a/lib/libstand/machine/stdint.h +++ /dev/null @@ -1,134 +0,0 @@ -/*- - * Copyright (c) 2001, 2002 Mike Barcroft - * Copyright (c) 2001 The NetBSD Foundation, Inc. All rights reserved. - * Copyright (c) 1990, 1993 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * 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 the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. - * - * $FreeBSD: src/sys/i386/include/_stdint.h,v 1.1 2002/07/29 17:41:07 mike Exp $ - */ - -#ifndef _CPU_STDINT_H_ -#define _CPU_STDINT_H_ - -/* - * Basic types upon which most other types are built. - */ -typedef __signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef int __boolean_t; - -/* - * This mess is to override compiler options that might restrict long long - * and for lint which doesn't understand GNUC attributes. - */ -#if defined(lint) -typedef long long __int64_t; -typedef unsigned long long __uint64_t; -#elif defined(__GNUC__) -typedef int __attribute__((__mode__(__DI__))) __int64_t; -typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; -#else -typedef long long __int64_t; -typedef unsigned long long __uint64_t; -#endif - -/* - * Standard type definitions. - */ -typedef __int64_t __intmax_t; -typedef __uint64_t __uintmax_t; - -typedef __int32_t __intptr_t; -typedef __uint32_t __uintptr_t; - -typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ - -typedef __int32_t __int_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __uint32_t __uint_fast8_t; -typedef __uint32_t __uint_fast16_t; -typedef __uint32_t __uint_fast32_t; -typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; - -/* - * System types conveniently placed in this header file in order to put them - * in proximity with the limit macros below and for convenient access by - * other include files which need to pick and choose particular types but - * do not wish to overly pollute their namespaces. - */ - -typedef __uint32_t __size_t; -typedef __int32_t __ssize_t; -typedef long __time_t; -typedef int __timer_t; -typedef __int32_t __register_t; -typedef __uint32_t __u_register_t; -typedef __int32_t __sig_atomic_t; -typedef unsigned long __clock_t; -typedef unsigned long __clockid_t; -typedef __uint32_t __socklen_t; -typedef volatile int __atomic_intr_t; -/* - * Its convenient to put these here rather then create another header file. - */ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) -#define __offsetof(type, field) __builtin_offsetof(type, field) -#else -#ifndef __cplusplus -#define __offsetof(type, field) ((__size_t)(&((type *)0)->field)) -#else -#define __offsetof(type, field) \ - (__offsetof__ (reinterpret_cast <__size_t> \ - (&reinterpret_cast \ - (static_cast (0)->field)))) -#endif -#endif - -#define __arysize(ary) (sizeof(ary)/sizeof((ary)[0])) - -#endif /* _CPU_STDINT_H_ */ diff --git a/sys/cpu/x86_64/include/asm.h b/sys/cpu/x86_64/include/asm.h index 06ad7cf293..6f2d319d66 100644 --- a/sys/cpu/x86_64/include/asm.h +++ b/sys/cpu/x86_64/include/asm.h @@ -40,8 +40,26 @@ #ifdef PIC #define PIC_PLT(x) x@PLT +#if defined(__x86_64__) #define PIC_GOT(x) x@GOTPCREL(%rip) #else +#define PIC_PROLOGUE \ + pushl %ebx; \ + call 1f; \ +1: \ + popl %ebx; \ + addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx +#define PIC_EPILOGUE \ + popl %ebx +#define PIC_GOT(x) x@GOT(%ebx) +#define PIC_GOTOFF(x) x@GOTOFF(%ebx) +#endif +#else +#if !defined(__x86_64__) +#define PIC_PROLOGUE +#define PIC_EPILOGUE +#define PIC_GOTOFF(x) x +#endif #define PIC_PLT(x) x #define PIC_GOT(x) x #endif @@ -63,6 +81,7 @@ .globl CNAME(x); .type CNAME(x),@function; CNAME(x): #ifdef PROF +#if defined(__x86_64__) #define ALTENTRY(x) _ENTRY(x); \ call PIC_PLT(HIDENAME(mcount)); \ jmp 9f @@ -70,6 +89,18 @@ call PIC_PLT(HIDENAME(mcount)); \ 9: #else +#define ALTENTRY(x) _ENTRY(x); \ + pushl %ebp; movl %esp,%ebp; \ + call PIC_PLT(HIDENAME(mcount)); \ + popl %ebp; \ + jmp 9f +#define ENTRY(x) _ENTRY(x); \ + pushl %ebp; movl %esp,%ebp; \ + call PIC_PLT(HIDENAME(mcount)); \ + popl %ebp; \ + 9: +#endif +#else #define ALTENTRY(x) _ENTRY(x) #define ENTRY(x) _ENTRY(x) #endif