diff options
100 files changed, 270 insertions, 4307 deletions
@@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.99 2004/02/01 06:16:50 brad Exp $ +# $OpenBSD: Makefile,v 1.100 2004/02/27 17:36:11 deraadt Exp $ # # For more information on building in tricky environments, please see @@ -128,7 +128,7 @@ cross-env: .PHONY ${CROSSDIRS}: @-mkdir -p ${CROSSDIR} @case ${TARGET} in \ - alpha|hppa|i386|m68k|m88k|powerpc|sparc|sparc64|vax) \ + alpha|hppa|i386|m68k|m88k|powerpc|sparc|sparc64|vax|amd64) \ echo ${TARGET} ;;\ amiga|hp300|mac68k|mvme68k) \ echo m68k ;;\ @@ -138,8 +138,6 @@ ${CROSSDIRS}: echo powerpc ;;\ sgi) \ echo mips ;;\ - amd64) \ - echo x86_64 ;;\ *) \ (echo Unknown arch ${TARGET} >&2) ; exit 1;; \ esac > ${CROSSDIR}/TARGET_ARCH diff --git a/distrib/special/kbd/Makefile b/distrib/special/kbd/Makefile index 2a0b1025098..f2ae7af9b9e 100644 --- a/distrib/special/kbd/Makefile +++ b/distrib/special/kbd/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.7 2004/02/07 21:07:16 deraadt Exp $ +# $OpenBSD: Makefile,v 1.8 2004/02/27 17:36:14 deraadt Exp $ .if (${MACHINE} == "alpha") || (${MACHINE} == "hppa") || \ (${MACHINE} == "i386") || (${MACHINE} == "macppc") || \ (${MACHINE} == "sparc") || (${MACHINE} == "sparc64") || \ - (${MACHINE} == "vax") || (${MACHINE_ARCH} == "x86_64") || \ + (${MACHINE} == "vax") || (${MACHINE} == "amd64") || \ (${MACHINE} == "cats") || (${MACHINE} == "pegasos") PROG= kbd COPTS+= -Os diff --git a/etc/Makefile b/etc/Makefile index 15bd5e1198d..5218decb3e4 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.199 2004/02/16 19:03:30 miod Exp $ +# $OpenBSD: Makefile,v 1.200 2004/02/27 17:36:13 deraadt Exp $ TZDIR= /usr/share/zoneinfo LOCALTIME= Canada/Mountain @@ -25,8 +25,8 @@ BIN1= bootptab changelist ccd.conf csh.cshrc csh.login csh.logout \ .if ${MACHINE} == "alpha" || ${MACHINE} == "hppa" || \ ${MACHINE} == "i386" || ${MACHINE} == "macppc" || \ ${MACHINE} == "pegasos" || ${MACHINE} == "sparc" || \ - ${MACHINE} == "sparc64" || ${MACHINE_ARCH} == "x86_64" || \ - ${MACHINE} == "cats" + ${MACHINE} == "sparc64" || ${MACHINE} == "amd64" || \ + ${MACHINE} == "cats" || BIN1+= wsconsctl.conf .endif @@ -377,7 +377,7 @@ distrib: DHSIZE=1024 1536 2048 3072 4096 update-moduli: ( \ - echo '# $$OpenBSD: Makefile,v 1.199 2004/02/16 19:03:30 miod Exp $$'; \ + echo '# $$OpenBSD: Makefile,v 1.200 2004/02/27 17:36:13 deraadt Exp $$'; \ echo '# Time Type Tests Tries Size Generator Modulus'; \ ( for i in ${DHSIZE}; do \ ssh-keygen -b $$i -G /dev/stdout; \ diff --git a/lib/csu/Makefile b/lib/csu/Makefile index 7110281f872..608d26cce63 100644 --- a/lib/csu/Makefile +++ b/lib/csu/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.11 2004/02/01 07:21:56 drahn Exp $ +# $OpenBSD: Makefile,v 1.12 2004/02/27 17:36:14 deraadt Exp $ .if make(obj) -SUBDIR= alpha arm hppa i386 m68k m88k powerpc sparc sparc64 vax x86_64 +SUBDIR= alpha arm hppa i386 m68k m88k powerpc sparc sparc64 vax amd64 .else SUBDIR= ${MACHINE_ARCH} .endif diff --git a/lib/csu/x86_64/Makefile b/lib/csu/x86_64/Makefile deleted file mode 100644 index ddbe9a140f7..00000000000 --- a/lib/csu/x86_64/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2004/01/28 01:46:17 mickey Exp $ - -CFLAGS+= -DLIBC_SCCS -fno-omit-frame-pointer -OBJS= crt0.o gcrt0.o crtbegin.o crtend.o crtbeginS.o crtendS.o -SRCS= crt0.c crtbegin.c crtbeginS.c crtend.c crtendS.c - -ELFDIR= ${.CURDIR}/../common_elf -.PATH: ${ELFDIR} -CFLAGS+= -I${ELFDIR} -I${.CURDIR} - -PICFLAG?=-fpic - -all: ${OBJS} - -crt0.o: crt0.c - @echo ${COMPILE.c} -DCRT0 ${.CURDIR}/crt0.c -o ${.TARGET} - @${COMPILE.c} -DCRT0 ${.CURDIR}/crt0.c -o ${.TARGET}.o - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o - @rm -f ${.TARGET}.o - -gcrt0.o: crt0.c - @echo ${COMPILE.c} -DMCRT0 ${.CURDIR}/crt0.c -o ${.TARGET} - @${COMPILE.c} -DMCRT0 ${.CURDIR}/crt0.c -o ${.TARGET}.o - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o - @rm -f ${.TARGET}.o - -crtbegin.o: crtbegin.c - @echo ${COMPILE.c} ${ELFDIR}/crtbegin.c -o ${.TARGET} - @${COMPILE.c} ${ELFDIR}/crtbegin.c -o ${.TARGET}.o - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o - @rm -f ${.TARGET}.o - -crtbeginS.o: crtbeginS.c - @echo ${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtbeginS.c -o ${.TARGET} - @${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtbeginS.c -o ${.TARGET}.o - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o - @rm -f ${.TARGET}.o - -crtend.o: crtend.c - @echo ${COMPILE.c} ${ELFDIR}/crtend.c -o ${.TARGET} - @${COMPILE.c} ${ELFDIR}/crtend.c -o ${.TARGET}.o - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o - @rm -f ${.TARGET}.o - -crtendS.o: crtendS.c - @echo ${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtendS.c -o ${.TARGET} - @${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtendS.c -o ${.TARGET}.o - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o - @rm -f ${.TARGET}.o - -realinstall: - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 ${OBJS} \ - ${DESTDIR}/usr/lib - -afterdepend: .depend - @(TMP=/tmp/_depend$$$$; \ - sed -e 's/^\([^\.]*\).o[ ]*:/\1.o g\1.o:/' \ - < .depend > $$TMP; \ - mv $$TMP .depend) - -.include <bsd.prog.mk> diff --git a/lib/csu/x86_64/crt0.c b/lib/csu/x86_64/crt0.c deleted file mode 100644 index b948fe048de..00000000000 --- a/lib/csu/x86_64/crt0.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $OpenBSD: crt0.c,v 1.1 2004/01/28 01:46:17 mickey Exp $ */ -/* - * Copyright (c) 1995 Christopher G. Demetriou - * 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 Christopher G. Demetriou - * for the NetBSD Project. - * 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: crt0.c,v 1.1 2004/01/28 01:46:17 mickey Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/param.h> -#include <stdlib.h> - -static char *_strrchr(char *, char); - -char **environ; -char *__progname = ""; - -char __progname_storage[NAME_MAX+1]; - -#ifdef MCRT0 -extern void monstartup(u_long, u_long); -extern void _mcleanup(void); -extern unsigned char _etext, _eprol; -#endif /* MCRT0 */ - -__asm(" .text ;\ - .align 8 ;\ - .globl __start ;\ - .globl _start ;\ -_start: ;\ -__start: ;\ - movq %rbx,%r9 ;\ - movq %rcx,%r8 ;\ - movq %rdx,%rcx ;\ - movq (%rsp),%rdi ;\ - leaq 16(%rsp,%rdi,8),%rdx ;\ - leaq 8(%rsp),%rsi ;\ - subq $8,%rsp ;\ - andq $~15,%rsp ;\ - addq $8,%rsp ;\ - jmp ___start ;\ -"); - -void -___start(argc, argv, envp, cleanup, obj, ps_strings) - int argc; - char **argv; - char ** envp; - void (*cleanup)(void); /* from shared loader */ - const void *obj; /* from shared loader */ - struct ps_strings *ps_strings; -{ - char *namep; - register struct kframe *kfp; - char *s; - - environ = envp; - - if ((namep = argv[0]) != NULL) { /* NULL ptr if argc = 0 */ - if ((__progname = _strrchr(namep, '/')) == NULL) - __progname = namep; - else - ++__progname; - for (s = __progname_storage; *__progname && - s < &__progname_storage[sizeof __progname_storage - 1]; ) - *s++ = *__progname++; - *s = '\0'; - __progname = __progname_storage; - } - -#ifdef MCRT0 - atexit(_mcleanup); - monstartup((u_long)&_eprol, (u_long)&_etext); -#endif - - __init(); - - exit(main(argc, argv, environ)); -} - - -static char * -_strrchr(p, ch) -register char *p, ch; -{ - register char *save; - - for (save = NULL;; ++p) { - if (*p == ch) - save = (char *)p; - if (!*p) - return(save); - } -/* NOTREACHED */ -} - -#ifdef MCRT0 -asm (" .text"); -asm ("_eprol:"); -#endif - diff --git a/lib/csu/x86_64/md_init.h b/lib/csu/x86_64/md_init.h deleted file mode 100644 index 243091f7255..00000000000 --- a/lib/csu/x86_64/md_init.h +++ /dev/null @@ -1,61 +0,0 @@ -/* $OpenBSD: md_init.h,v 1.1 2004/01/28 01:46:17 mickey Exp $ */ - -/*- - * Copyright (c) 2001 Ross Harvey - * 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 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. - */ - -#define MD_SECT_CALL_FUNC(section, func) \ - __asm (".section "#section", \"ax\"\n" \ - " call " #func "\n" \ - " .previous") - -/* - * Align is after because we want the function to start at the first - * address of the section, but overall we want the section to be - * aligned by the align amount. - */ -#define MD_SECTION_PROLOGUE(sect, entry_pt) \ - __asm ( \ - ".section "#sect",\"ax\",@progbits \n" \ - " .globl " #entry_pt " \n" \ - " .type " #entry_pt ",@function \n" \ - #entry_pt": \n" \ - " .align 16 \n" \ - " /* fall thru */ \n" \ - " .previous") - - -#define MD_SECTION_EPILOGUE(sect) \ - __asm ( \ - ".section "#sect",\"ax\",@progbits \n" \ - " ret \n" \ - " .previous") diff --git a/lib/libarch/Makefile b/lib/libarch/Makefile index 1aef148c108..0c58b6a39d2 100644 --- a/lib/libarch/Makefile +++ b/lib/libarch/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.5 2004/02/26 00:11:05 deraadt Exp $ +# $OpenBSD: Makefile,v 1.6 2004/02/27 17:36:14 deraadt Exp $ # $NetBSD: Makefile,v 1.8 1996/02/21 02:43:52 jtk Exp $ -SUBDIR= alpha i386 x86_64 +SUBDIR= alpha i386 amd64 .include <bsd.subdir.mk> diff --git a/lib/libarch/amd64/Makefile b/lib/libarch/amd64/Makefile index b32bd7996b8..ec8831b5ccf 100644 --- a/lib/libarch/amd64/Makefile +++ b/lib/libarch/amd64/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2004/02/26 00:10:54 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 2004/02/27 17:36:14 deraadt Exp $ # $NetBSD: Makefile,v 1.1 1996/02/21 02:45:47 jtk Exp $ MAN+= x86_64_get_ldt.2 \ @@ -7,8 +7,8 @@ MANSUBDIR=amd64 MLINKS+=x86_64_get_ldt.2 x86_64_set_ldt.2 \ x86_64_get_ioperm.2 x86_64_set_ioperm.2 -.if ${MACHINE_ARCH} == "x86_64" -.PATH: ${LIBC}/x86_64 +.if ${MACHINE_ARCH} == "amd64" +.PATH: ${LIBC}/amd64 NOPIC= SRCS+= x86_64_get_ldt.c x86_64_set_ldt.c \ x86_64_iopl.c x86_64_get_ioperm.c x86_64_set_ioperm.c diff --git a/lib/libc/arch/amd64/Makefile.inc b/lib/libc/arch/amd64/Makefile.inc index 53949f1c6bc..c6e08b41c00 100644 --- a/lib/libc/arch/amd64/Makefile.inc +++ b/lib/libc/arch/amd64/Makefile.inc @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:44 mickey Exp $ +# $OpenBSD: Makefile.inc,v 1.2 2004/02/27 17:36:14 deraadt Exp $ -KMINCLUDES= arch/x86_64/SYS.h +KMINCLUDES= arch/amd64/SYS.h KMSRCS= bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlen.S \ htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/arch/x86_64/Makefile.inc b/lib/libc/arch/x86_64/Makefile.inc deleted file mode 100644 index 53949f1c6bc..00000000000 --- a/lib/libc/arch/x86_64/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:44 mickey Exp $ - -KMINCLUDES= arch/x86_64/SYS.h -KMSRCS= bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlen.S \ - htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/arch/x86_64/SYS.h b/lib/libc/arch/x86_64/SYS.h deleted file mode 100644 index ebac9b0df16..00000000000 --- a/lib/libc/arch/x86_64/SYS.h +++ /dev/null @@ -1,135 +0,0 @@ -/* $OpenBSD: SYS.h,v 1.3 2004/02/22 21:28:21 miod 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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 $ - */ - -/* - * XXXfvdl change to use syscall/sysret. - */ - -#include <machine/asm.h> -#include <sys/syscall.h> - -#ifdef __STDC__ - -#define SYSTRAP(x) movl $(SYS_ ## x),%eax; movq %rcx, %r10; syscall -#define OSYSTRAP(x) movl $(SYS_ ## x),%eax; int $0x80 -#define SYSENTRY(x) \ - ENTRY(_thread_sys_ ## x); \ - .weak _C_LABEL(x); \ - _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x) -#else - -#define SYSTRAP(x) movl $(SYS_/**/x),%eax; movq %rcx, %r10; syscall -#define OSYSTRAP(x) movl $(SYS_/**/x),%eax; int $0x80 -#define SYSENTRY(x) \ - ENTRY(_thread_sys_/**/x); \ - .weak _C_LABEL(x); \ - _C_LABEL(x) = _C_LABEL(_thread_sys_/**/x) - -#endif - -#define CERROR _C_LABEL(__cerror) -#define CURBRK _C_LABEL(__curbrk) - -#define _SYSCALL_NOERROR(x,y) \ - SYSENTRY(x); \ - SYSTRAP(y) - -#define _OSYSCALL_NOERROR(x,y) \ - SYSENTRY(x); \ - OSYSTRAP(y) - -#ifdef PIC -#define _SYSCALL(x,y) \ - .text; _ALIGN_TEXT; \ - 2: mov PIC_GOT(CERROR), %rcx; \ - jmp *%rcx; \ - _SYSCALL_NOERROR(x,y); \ - jc 2b -#define _OSYSCALL(x,y) \ - .text; _ALIGN_TEXT; \ - 2: mov PIC_GOT(CERROR), %rcx; \ - jmp *%rcx; \ - _OSYSCALL_NOERROR(x,y); \ - jc 2b -#else -#define _SYSCALL(x,y) \ - .text; _ALIGN_TEXT; \ - 2: jmp CERROR; \ - _SYSCALL_NOERROR(x,y); \ - jc 2b -#define _OSYSCALL(x,y) \ - .text; _ALIGN_TEXT; \ - 2: jmp CERROR; \ - _OSYSCALL_NOERROR(x,y); \ - jc 2b -#endif - -#define SYSCALL_NOERROR(x) \ - _SYSCALL_NOERROR(x,x) - -#define OSYSCALL_NOERROR(x) \ - _OSYSCALL_NOERROR(x,x) - -#define SYSCALL(x) \ - _SYSCALL(x,x) - -#define OSYSCALL(x) \ - _OSYSCALL(x,x) - -#define PSEUDO_NOERROR(x,y) \ - _SYSCALL_NOERROR(x,y); \ - ret - -#define PSEUDO(x,y) \ - _SYSCALL(x,y); \ - ret - -#define RSYSCALL_NOERROR(x) \ - PSEUDO_NOERROR(x,x) - -#define RSYSCALL(x) \ - PSEUDO(x,x) - -#define WSYSCALL(weak,strong) \ - WEAK_ALIAS(weak,strong); \ - PSEUDO(strong,weak) - - .globl CERROR diff --git a/lib/libc/arch/x86_64/gen/Makefile.inc b/lib/libc/arch/x86_64/gen/Makefile.inc deleted file mode 100644 index a150d95eba0..00000000000 --- a/lib/libc/arch/x86_64/gen/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:44 mickey Exp $ - -SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c \ - modf.S setjmp.S sigsetjmp.S -SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \ - fpsetround.S fpsetsticky.S - diff --git a/lib/libc/arch/x86_64/gen/_setjmp.S b/lib/libc/arch/x86_64/gen/_setjmp.S deleted file mode 100644 index d9a59f7aa14..00000000000 --- a/lib/libc/arch/x86_64/gen/_setjmp.S +++ /dev/null @@ -1,82 +0,0 @@ -/* $OpenBSD: _setjmp.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: _setjmp.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ - -/* - * Copyright (c) 2001 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Frank van der Linden for Wasabi Systems, Inc. - * - * 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 for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC - * 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> -#include <machine/setjmp.h> - -/* - * C library -- _setjmp, _longjmp - * - * _longjmp(a,v) - * will generate a "return(v)" from the last call to - * _setjmp(a) - * by restoring registers from the stack. - * The previous signal state is NOT restored. - */ - -ENTRY(_setjmp) - movq (%rsp),%r11 - movq %rbx,(_JB_RBX * 8)(%rdi) - movq %rbp,(_JB_RBP * 8)(%rdi) - movq %r12,(_JB_R12 * 8)(%rdi) - movq %r13,(_JB_R13 * 8)(%rdi) - movq %r14,(_JB_R14 * 8)(%rdi) - movq %r15,(_JB_R15 * 8)(%rdi) - movq %rsp,(_JB_RSP * 8)(%rdi) - movq %r11,(_JB_PC * 8)(%rdi) - - xorl %eax,%eax - ret - -ENTRY(_longjmp) - movq (_JB_RBX * 8)(%rdi),%rbx - movq (_JB_RBP * 8)(%rdi),%rbp - movq (_JB_R12 * 8)(%rdi),%r12 - movq (_JB_R13 * 8)(%rdi),%r13 - movq (_JB_R14 * 8)(%rdi),%r14 - movq (_JB_R15 * 8)(%rdi),%r15 - movq (_JB_RSP * 8)(%rdi),%rsp - movq (_JB_PC * 8)(%rdi),%r11 - - movl %esi,%eax - testl %eax,%eax - jnz 1f - incl %eax -1: movq %r11,0(%rsp) - ret diff --git a/lib/libc/arch/x86_64/gen/alloca.S b/lib/libc/arch/x86_64/gen/alloca.S deleted file mode 100644 index 8c15583012c..00000000000 --- a/lib/libc/arch/x86_64/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/x86_64/gen/fabs.S b/lib/libc/arch/x86_64/gen/fabs.S deleted file mode 100644 index ab31ac612fb..00000000000 --- a/lib/libc/arch/x86_64/gen/fabs.S +++ /dev/null @@ -1,17 +0,0 @@ -/* $OpenBSD: fabs.S,v 1.2 2004/02/08 17:29:57 deraadt Exp $ */ -/* $NetBSD: fabs.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ - -#include <machine/asm.h> - -/* - * Ok, this sucks. Is there really no way to push an xmm register onto - * the FP stack directly? - */ - -ENTRY(fabs) - movsd %xmm0, -8(%rsp) - fldl -8(%rsp) - fabs - fstpl -8(%rsp) - movsd -8(%rsp),%xmm0 - ret diff --git a/lib/libc/arch/x86_64/gen/flt_rounds.S b/lib/libc/arch/x86_64/gen/flt_rounds.S deleted file mode 100644 index 009c59ab64a..00000000000 --- a/lib/libc/arch/x86_64/gen/flt_rounds.S +++ /dev/null @@ -1,30 +0,0 @@ -/* $OpenBSD: flt_rounds.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: flt_rounds.S,v 1.2 2002/06/06 23:04:35 fvdl Exp $ */ - -/* - * Written by J.T. Conklin, Apr 4, 1995 - * Public domain. - */ - -#include <machine/asm.h> - - .text - _ALIGN_TEXT -_map: - .byte 1 /* round to nearest */ - .byte 3 /* round to negative infinity */ - .byte 2 /* round to positive infinity */ - .byte 0 /* round to zero */ - -ENTRY(__flt_rounds) - fnstcw -4(%rsp) - movl -4(%rsp),%eax - shrl $10,%eax - andl $3,%eax -#ifdef PIC - leaq PIC_GOT(_map),%rcx - movb (%rcx,%rax,1),%al -#else - movb _map(,%rax,1),%al -#endif - ret diff --git a/lib/libc/arch/x86_64/gen/fpgetmask.S b/lib/libc/arch/x86_64/gen/fpgetmask.S deleted file mode 100644 index 688ba49cddc..00000000000 --- a/lib/libc/arch/x86_64/gen/fpgetmask.S +++ /dev/null @@ -1,27 +0,0 @@ -/* $OpenBSD: fpgetmask.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: fpgetmask.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ - -/* - * Written by J.T. Conklin, Apr 4, 1995 - * Public domain. - */ - -#include <machine/asm.h> - -/* - * XXX only read x87 control word here. If an application only - * uses the fp* interface to manipulate FP bits, it should - * always remain in sync with the SSE mxcsr register. - */ - -#ifdef WEAK_ALIAS -WEAK_ALIAS(fpgetmask, _fpgetmask) -ENTRY(_fpgetmask) -#else -ENTRY(fpgetmask) -#endif - fnstcw -4(%rsp) - movl -4(%rsp),%eax - notl %eax - andl $63,%eax - ret diff --git a/lib/libc/arch/x86_64/gen/fpgetround.S b/lib/libc/arch/x86_64/gen/fpgetround.S deleted file mode 100644 index 5220b3ef396..00000000000 --- a/lib/libc/arch/x86_64/gen/fpgetround.S +++ /dev/null @@ -1,26 +0,0 @@ -/* $OpenBSD: fpgetround.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: fpgetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ - -/* - * Written by J.T. Conklin, Apr 4, 1995 - * Public domain. - */ - -#include <machine/asm.h> - -/* - * XXX store only x87 state. If an application only uses the fp* - * interface, this should be in sync with the SSE mxcsr register. - */ - -#ifdef WEAK_ALIAS -WEAK_ALIAS(fpgetround, _fpgetround) -ENTRY(_fpgetround) -#else -ENTRY(fpgetround) -#endif - fnstcw -4(%rsp) - movl -4(%rsp),%eax - rorl $10,%eax - andl $3,%eax - ret diff --git a/lib/libc/arch/x86_64/gen/fpgetsticky.S b/lib/libc/arch/x86_64/gen/fpgetsticky.S deleted file mode 100644 index fd12e2b500a..00000000000 --- a/lib/libc/arch/x86_64/gen/fpgetsticky.S +++ /dev/null @@ -1,28 +0,0 @@ -/* $OpenBSD: fpgetsticky.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: fpgetsticky.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ - -/* - * Written by Frank van der Linden at Wasabi Systems for NetBSD. - * Public domain. - * - */ - -#include <machine/asm.h> - -/* - * XXX read both the x87 and SSE status words here, and OR - * them to get a complete picture of exceptions. - */ - -#ifdef WEAK_ALIAS -WEAK_ALIAS(fpgetsticky, _fpgetsticky) -ENTRY(_fpgetsticky) -#else -ENTRY(fpgetsticky) -#endif - fnstsw -4(%rsp) - stmxcsr -8(%rsp) - movl -4(%rsp),%eax - orl -8(%rsp),%eax - andl $63,%eax - ret diff --git a/lib/libc/arch/x86_64/gen/fpsetmask.S b/lib/libc/arch/x86_64/gen/fpsetmask.S deleted file mode 100644 index 665d55e8e47..00000000000 --- a/lib/libc/arch/x86_64/gen/fpsetmask.S +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: fpsetmask.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: fpsetmask.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ - -/* - * Written by Frank van der Linden at Wasabi Systems for NetBSD. - * Public domain. - */ - -#include <machine/asm.h> - -/* - * XXX set both the x87 control word and the SSE mxcsr register. - * Applications should only set exception and round flags - * via the fp*() interface, otherwise the status words - * will get our of sync. - */ - -#ifdef WEAK_ALIAS -WEAK_ALIAS(fpsetmask, _fpsetmask) -ENTRY(_fpsetmask) -#else -ENTRY(fpsetmask) -#endif - fnstcw -4(%rsp) - stmxcsr -8(%rsp) - andl $63,%edi - notl %edi - - movl -4(%rsp),%edx - movl %edx,%eax - andl %edi,%edx - movl %edx,-4(%rsp) - - movl -8(%rsp),%edx - roll $7,%edi - andl %edi,%edx - movl %edx,-8(%rsp) - - fldcw -4(%rsp) - ldmxcsr -8(%rsp) - andl $63,%eax - ret diff --git a/lib/libc/arch/x86_64/gen/fpsetround.S b/lib/libc/arch/x86_64/gen/fpsetround.S deleted file mode 100644 index b8508f8b6bd..00000000000 --- a/lib/libc/arch/x86_64/gen/fpsetround.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: fpsetround.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: fpsetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ - -/* - * Written by Frank van der Linden at Wasabi Systems for NetBSD. - * Public domain. - */ - -#include <machine/asm.h> - -/* - * XXX set both the x87 control word and the SSE mxcsr register. - * Applications should only set exception and round flags - * via the fp*() interface, otherwise the status words - * will get our of sync. - */ - - -#ifdef WEAK_ALIAS -WEAK_ALIAS(fpsetround, _fpsetround) -ENTRY(_fpsetround) -#else -ENTRY(fpsetround) -#endif - fnstcw -4(%rsp) - stmxcsr -8(%rsp) - - andl $3,%edi - - movl -4(%rsp),%edx - rorl $10,%edx - movl %edx,%eax - andl $3,%eax - - andl $~3,%edx - orl %edi,%edx - roll $10,%edx - movl %edx,-4(%rsp) - - movl -8(%rsp),%edx - rorl $13,%edx - andl $~3,%edx - orl %edi,%edx - roll $13,%edx - movl %edx,-8(%rsp) - - ldmxcsr -8(%rsp) - fldcw -4(%rsp) - ret diff --git a/lib/libc/arch/x86_64/gen/fpsetsticky.S b/lib/libc/arch/x86_64/gen/fpsetsticky.S deleted file mode 100644 index c8e61101a12..00000000000 --- a/lib/libc/arch/x86_64/gen/fpsetsticky.S +++ /dev/null @@ -1,43 +0,0 @@ -/* $OpenBSD: fpsetsticky.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: fpsetsticky.S,v 1.3 2002/06/12 19:17:23 fvdl Exp $ */ - -/* - * Written by Frank van der Linden at Wasabi Systems for NetBSD - * Public domain. - */ - -#include <machine/asm.h> - -/* - * XXX set both the x87 status word and the SSE mxcsr register. - * Applications should only set exception and round flags - * via the fp*() interface, otherwise the status words - * will get our of sync. - */ - - -#ifdef WEAK_ALIAS -WEAK_ALIAS(fpsetsticky, _fpsetsticky) -ENTRY(_fpsetsticky) -#else -ENTRY(fpsetsticky) -#endif - fnstenv -28(%rsp) - stmxcsr -32(%rsp) - - andl $63,%edi - - movl -24(%rsp),%eax - movl %eax,%edx - andl $63,%eax - - orl %edi,%edx - movl %edx,-24(%rsp) - - movl -32(%rsp),%edx - orl %edi,%edx - movl %edx,-32(%rsp) - - ldmxcsr -32(%rsp) - fldenv -28(%rsp) - ret diff --git a/lib/libc/arch/x86_64/gen/frexp.c b/lib/libc/arch/x86_64/gen/frexp.c deleted file mode 100644 index bc84467fa9e..00000000000 --- a/lib/libc/arch/x86_64/gen/frexp.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: frexp.c,v 1.1 2004/01/28 01:44:45 mickey 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: frexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <machine/ieee.h> - -/* - * Split the given value into a fraction in the range [0.5, 1.0) and - * an exponent, such that frac * (2^exp) == value. If value is 0, - * return 0. - */ -double -frexp(value, eptr) - double value; - int *eptr; -{ - union { - double v; - struct ieee_double s; - } u; - - if (value) { - /* - * Fractions in [0.5..1.0) have an exponent of 2^-1. - * Leave Inf and NaN alone, however. - * WHAT ABOUT DENORMS? - */ - u.v = value; - if (u.s.dbl_exp != DBL_EXP_INFNAN) { - *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1); - u.s.dbl_exp = DBL_EXP_BIAS - 1; - } - return (u.v); - } else { - *eptr = 0; - return ((double)0); - } -} diff --git a/lib/libc/arch/x86_64/gen/infinity.c b/lib/libc/arch/x86_64/gen/infinity.c deleted file mode 100644 index d1c2aa9a2f4..00000000000 --- a/lib/libc/arch/x86_64/gen/infinity.c +++ /dev/null @@ -1,12 +0,0 @@ -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: infinity.c,v 1.2 2004/02/08 17:31:44 deraadt Exp $"; -#endif /* LIBC_SCCS and not lint */ - -/* infinity.c */ - -#include <math.h> - -/* bytes for +Infinity on a 387 */ -char __infinity[] __attribute__((__aligned__(sizeof(double)))) = - { 0, 0, 0, 0, 0, 0, (char)0xf0, 0x7f }; - diff --git a/lib/libc/arch/x86_64/gen/isnan.c b/lib/libc/arch/x86_64/gen/isnan.c deleted file mode 100644 index 5df82ecce25..00000000000 --- a/lib/libc/arch/x86_64/gen/isnan.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $OpenBSD: isnan.c,v 1.1 2004/01/28 01:44:45 mickey 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: isnan.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <machine/ieee.h> - -int -isnan(d) - double d; -{ - struct ieee_double *p = (struct ieee_double *)&d; - - return (p->dbl_exp == DBL_EXP_INFNAN && - (p->dbl_frach != 0 || p->dbl_fracl != 0)); -} diff --git a/lib/libc/arch/x86_64/gen/ldexp.c b/lib/libc/arch/x86_64/gen/ldexp.c deleted file mode 100644 index b3e95956652..00000000000 --- a/lib/libc/arch/x86_64/gen/ldexp.c +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: ldexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Charles Hannum. - * - * 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: ldexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; -#endif /* LIBC_SCCS and not lint */ - -/* - * ldexp(value, exp): return value * (2 ** exp). - */ - -double -ldexp (double value, int exp) -{ - double temp; -#if __GNUC__ >= 2 - __asm ("fscale" - : "=t" (temp) - : "0" (value), "u" ((double)exp)); -#else - __asm ("fscale; fstp %%st(1)" - : "=f" (temp) - : "f" (value), "0" ((double)exp)); -#endif - return (temp); -} diff --git a/lib/libc/arch/x86_64/gen/modf.S b/lib/libc/arch/x86_64/gen/modf.S deleted file mode 100644 index 44ef74ab668..00000000000 --- a/lib/libc/arch/x86_64/gen/modf.S +++ /dev/null @@ -1,91 +0,0 @@ -/* $OpenBSD: modf.S,v 1.2 2004/02/08 17:29:39 deraadt Exp $ */ -/* $NetBSD: modf.S,v 1.1 2001/06/19 00:25:03 fvdl Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Sean Eric Fagan. - * - * 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 University of - * California, Berkeley and its contributors. - * 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 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: @(#)modf.s 5.5 (Berkeley) 3/18/91 - */ - -#include <machine/asm.h> - -/* - * modf(value, iptr): return fractional part of value, and stores the - * integral part into iptr (a pointer to double). - * - * Written by Sean Eric Fagan (sef@kithrup.COM) - * Sun Mar 11 20:27:30 PST 1990 - */ - -/* With CHOP mode on, frndint behaves as TRUNC does. Useful. */ -ENTRY(modf) - - /* - * Set chop mode. - */ - fnstcw -12(%rsp) - movw -12(%rsp),%dx - orw $3072,%dx - movw %dx,-16(%rsp) - fldcw -16(%rsp) - - /* - * Get integral part. - */ - movsd %xmm0,-24(%rsp) - fldl -24(%rsp) - frndint - fstpl -8(%rsp) - - /* - * Restore control word. - */ - fldcw -12(%rsp) - - /* - * Store integral part. - */ - movsd -8(%rsp),%xmm0 - movsd %xmm0,(%rdi) - - /* - * Get fractional part and return it. - */ - fldl -24(%rsp) - fsubl -8(%rsp) - fstpl -8(%rsp) - movsd -8(%rsp),%xmm0 - - ret diff --git a/lib/libc/arch/x86_64/gen/setjmp.S b/lib/libc/arch/x86_64/gen/setjmp.S deleted file mode 100644 index b7ae81f2141..00000000000 --- a/lib/libc/arch/x86_64/gen/setjmp.S +++ /dev/null @@ -1,103 +0,0 @@ -/* $OpenBSD: setjmp.S,v 1.2 2004/02/09 21:25:08 deraadt Exp $ */ -/* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ - -/* - * Copyright (c) 2001 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Frank van der Linden for Wasabi Systems, Inc. - * - * 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 for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC - * 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> -#include <machine/setjmp.h> - -/* - * C library -- _setjmp, _longjmp - * - * longjmp(a,v) - * will generate a "return(v)" from the last call to - * setjmp(a) - * by restoring registers from the stack. - * The previous signal state is restored. - */ - -ENTRY(setjmp) - pushq %rdi - xorq %rdi,%rdi -#ifdef PIC - call PIC_PLT(_C_LABEL(sigblock)) -#else - call _C_LABEL(sigblock) -#endif - popq %rdi - movq %rax,(_JB_SIGMASK * 8)(%rdi) - - movq (%rsp),%r11 - movq %rbx,(_JB_RBX * 8)(%rdi) - movq %rbp,(_JB_RBP * 8)(%rdi) - movq %r12,(_JB_R12 * 8)(%rdi) - movq %r13,(_JB_R13 * 8)(%rdi) - movq %r14,(_JB_R14 * 8)(%rdi) - movq %r15,(_JB_R15 * 8)(%rdi) - movq %rsp,(_JB_RSP * 8)(%rdi) - movq %r11,(_JB_PC * 8)(%rdi) - -2: xorl %eax,%eax - ret - -ENTRY(longjmp) - movq %rdi,%r12 - movl %esi,%r8d - - movq (_JB_SIGMASK * 8)(%rdi),%rdi - pushq %r8 -#ifdef PIC - call PIC_PLT(_C_LABEL(sigsetmask)) -#else - call _C_LABEL(sigsetmask) -#endif - popq %r8 - movq (_JB_RBX * 8)(%r12),%rbx - movq (_JB_RBP * 8)(%r12),%rbp - movq (_JB_R13 * 8)(%r12),%r13 - movq (_JB_R14 * 8)(%r12),%r14 - movq (_JB_R15 * 8)(%r12),%r15 - movq (_JB_RSP * 8)(%r12),%rsp - movq (_JB_PC * 8)(%r12),%r11 - movq (_JB_R12 * 8)(%r12),%r12 - - movl %r8d,%eax - testl %eax,%eax - jnz 1f - incl %eax -1: movq %r11,0(%rsp) - ret diff --git a/lib/libc/arch/x86_64/gen/sigsetjmp.S b/lib/libc/arch/x86_64/gen/sigsetjmp.S deleted file mode 100644 index e4c26d50927..00000000000 --- a/lib/libc/arch/x86_64/gen/sigsetjmp.S +++ /dev/null @@ -1,107 +0,0 @@ -/* $OpenBSD: sigsetjmp.S,v 1.2 2004/02/09 21:25:08 deraadt Exp $ */ -/* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ - -/* - * Copyright (c) 2001 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Frank van der Linden for Wasabi Systems, Inc. - * - * 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 for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC - * 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> -#include <machine/setjmp.h> - -/* - * C library -- _setjmp, _longjmp - * - * longjmp(a,v) - * will generate a "return(v)" from the last call to - * setjmp(a) - * by restoring registers from the stack. - * The previous signal state is restored. - */ - -ENTRY(sigsetjmp) - movl %esi,(_JB_SIGFLAG * 8)(%rdi) - testl %esi,%esi - jz 2f - - pushq %rdi - xorq %rdi,%rdi -#ifdef PIC - call PIC_PLT(_C_LABEL(sigblock)) -#else - call _C_LABEL(sigblock) -#endif - popq %rdi - movq %rax,(_JB_SIGMASK * 8)(%rdi) - -2: movq (%rsp),%r11 - movq %rbx,(_JB_RBX * 8)(%rdi) - movq %rbp,(_JB_RBP * 8)(%rdi) - movq %r12,(_JB_R12 * 8)(%rdi) - movq %r13,(_JB_R13 * 8)(%rdi) - movq %r14,(_JB_R14 * 8)(%rdi) - movq %r15,(_JB_R15 * 8)(%rdi) - movq %rsp,(_JB_RSP * 8)(%rdi) - movq %r11,(_JB_PC * 8)(%rdi) - -2: xorl %eax,%eax - ret - -ENTRY(siglongjmp) - movq %rdi,%r12 - pushq %rsi - cmpl $0, (_JB_SIGFLAG * 8)(%rdi) - jz 2f - - movq (_JB_SIGMASK * 8)(%rdi),%rdi -#ifdef PIC - call PIC_PLT(_C_LABEL(sigsetmask)) -#else - call _C_LABEL(sigsetmask) -#endif -2: popq %rax - movq (_JB_RBX * 8)(%r12),%rbx - movq (_JB_RBP * 8)(%r12),%rbp - movq (_JB_R13 * 8)(%r12),%r13 - movq (_JB_R14 * 8)(%r12),%r14 - movq (_JB_R15 * 8)(%r12),%r15 - movq (_JB_RSP * 8)(%r12),%rsp - movq (_JB_PC * 8)(%r12),%r11 - movq (_JB_R12 * 8)(%r12),%r12 - - testl %eax,%eax - jnz 1f - incl %eax -1: movq %r11,0(%rsp) - ret diff --git a/lib/libc/arch/x86_64/net/Makefile.inc b/lib/libc/arch/x86_64/net/Makefile.inc deleted file mode 100644 index 4c046a624dd..00000000000 --- a/lib/libc/arch/x86_64/net/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:45 mickey Exp $ - -SRCS+= htonl.S htons.S ntohl.S ntohs.S -LSRCS+= htonl.c htons.c ntohl.c ntohs.c diff --git a/lib/libc/arch/x86_64/net/htonl.S b/lib/libc/arch/x86_64/net/htonl.S deleted file mode 100644 index e4c951a4b40..00000000000 --- a/lib/libc/arch/x86_64/net/htonl.S +++ /dev/null @@ -1,10 +0,0 @@ -/* $OpenBSD: htonl.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ - -/* Written by Artur Grabowski. Public Domain */ - -#include <machine/asm.h> - -ENTRY(_C_LABEL(htonl)) - movl %edi,%eax - bswapl %eax - ret diff --git a/lib/libc/arch/x86_64/net/htons.S b/lib/libc/arch/x86_64/net/htons.S deleted file mode 100644 index 62295abcd97..00000000000 --- a/lib/libc/arch/x86_64/net/htons.S +++ /dev/null @@ -1,11 +0,0 @@ -/* $OpenBSD: htons.S,v 1.2 2004/02/10 00:08:11 drahn Exp $ */ - -/* Written by Artur Grabowski. Public Domain */ - -#include <machine/asm.h> - -ENTRY(_C_LABEL(htons)) - movl %edi,%eax - xchgb %ah,%al - ret - diff --git a/lib/libc/arch/x86_64/net/ntohl.S b/lib/libc/arch/x86_64/net/ntohl.S deleted file mode 100644 index 0e39c1317e0..00000000000 --- a/lib/libc/arch/x86_64/net/ntohl.S +++ /dev/null @@ -1,10 +0,0 @@ -/* $OpenBSD: ntohl.S,v 1.2 2004/02/10 00:08:11 drahn Exp $ */ - -/* Written by Artur Grabowski. Public Domain */ - -#include <machine/asm.h> - -ENTRY(_C_LABEL(ntohl)) - movl %edi,%eax - bswapl %eax - ret diff --git a/lib/libc/arch/x86_64/net/ntohs.S b/lib/libc/arch/x86_64/net/ntohs.S deleted file mode 100644 index 3ee61fc5684..00000000000 --- a/lib/libc/arch/x86_64/net/ntohs.S +++ /dev/null @@ -1,11 +0,0 @@ -/* $OpenBSD: ntohs.S,v 1.2 2004/02/10 00:08:11 drahn Exp $ */ - -/* Written by Artur Grabowski. Public Domain */ - -#include <machine/asm.h> - -ENTRY(_C_LABEL(ntohs)) - movl %edi,%eax - xchgb %ah,%al - ret - diff --git a/lib/libc/arch/x86_64/string/Makefile.inc b/lib/libc/arch/x86_64/string/Makefile.inc deleted file mode 100644 index 002194e1d8c..00000000000 --- a/lib/libc/arch/x86_64/string/Makefile.inc +++ /dev/null @@ -1,6 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:45 mickey Exp $ - -SRCS+= bcmp.c ffs.S index.c memchr.c memcmp.c bcopy.c bzero.c \ - rindex.c strcat.c strcmp.c strcpy.c strcspn.c strlen.S \ - strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \ - strspn.c strstr.c swab.c memset.c strlcpy.c strlcat.c diff --git a/lib/libc/arch/x86_64/string/ffs.S b/lib/libc/arch/x86_64/string/ffs.S deleted file mode 100644 index 2666bc49e9d..00000000000 --- a/lib/libc/arch/x86_64/string/ffs.S +++ /dev/null @@ -1,18 +0,0 @@ -/* $OpenBSD: ffs.S,v 1.1 2004/01/28 01:44:45 mickey 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 <machine/asm.h> - -ENTRY(ffs) - bsfl %edi,%eax - jz L1 /* ZF is set if all bits are 0 */ - incl %eax /* bits numbered from 1, not 0 */ - ret - - _ALIGN_TEXT -L1: xorl %eax,%eax /* clear result */ - ret diff --git a/lib/libc/arch/x86_64/string/strlen.S b/lib/libc/arch/x86_64/string/strlen.S deleted file mode 100644 index 3afccb8f1ac..00000000000 --- a/lib/libc/arch/x86_64/string/strlen.S +++ /dev/null @@ -1,18 +0,0 @@ -/* $OpenBSD: strlen.S,v 1.1 2004/01/28 01:44:45 mickey 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 <machine/asm.h> - -ENTRY(strlen) - cld /* set search forward */ - xorl %eax,%eax /* set search for null terminator */ - movq $-1,%rcx /* set search for lots of characters */ - repne /* search! */ - scasb - notq %rcx /* get length by taking complement */ - leaq -1(%rcx),%rax /* and subtracting one */ - ret diff --git a/lib/libc/arch/x86_64/sys/Ovfork.S b/lib/libc/arch/x86_64/sys/Ovfork.S deleted file mode 100644 index 865d460014f..00000000000 --- a/lib/libc/arch/x86_64/sys/Ovfork.S +++ /dev/null @@ -1,67 +0,0 @@ -/* $OpenBSD: Ovfork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: Ovfork.S,v 1.2 2002/06/03 18:30:33 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - -/* - * pid = vfork(); - * - * %edx == 0 in parent process, %edx == 1 in child process. - * %eax == pid of child in parent, %eax == pid of parent in child. - * - */ -SYSENTRY(vfork) - popq %r9 /* my rta into r9 */ - SYSTRAP(vfork) - jc err - decl %edx - andl %edx,%eax - jmp *%r9 -err: - pushq %r9 -#ifdef PIC - movq PIC_GOT(CERROR), %rcx - jmp *%rcx -#else - jmp CERROR -#endif diff --git a/lib/libc/arch/x86_64/sys/brk.S b/lib/libc/arch/x86_64/sys/brk.S deleted file mode 100644 index 3c73525096e..00000000000 --- a/lib/libc/arch/x86_64/sys/brk.S +++ /dev/null @@ -1,89 +0,0 @@ -/* $OpenBSD: brk.S,v 1.2 2004/02/10 00:22:51 drahn Exp $ */ -/* $NetBSD: brk.S,v 1.2 2002/06/03 18:30:33 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)brk.s 5.2 (Berkeley) 12/17/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - - .globl _end - .globl _C_LABEL(__minbrk) - .globl _C_LABEL(minbrk) - .globl __curbrk - -#ifdef WEAK_ALIAS -WEAK_ALIAS(brk, _brk) -#endif - - .data -_C_LABEL(minbrk): -_C_LABEL(__minbrk): - .quad _end - .text - -SYSENTRY(_brk) -#ifdef PIC - movq PIC_GOT(_C_LABEL(__minbrk)),%rdx - cmpq %rdi,(%rdx) - jb 1f - movq (%rdx),%rdi -1: - SYSTRAP(break) - jc err - movq PIC_GOT(__curbrk),%rdx # set up GOT addressing - movq %rdi,(%rdx) - xorl %eax,%eax - ret -err: - movq PIC_GOT(CERROR),%rdx - jmp *%rdx -#else - cmpq %rdi,_C_LABEL(__minbrk)(%rip) - jb 1f - movq _C_LABEL(__minbrk)(%rip),%rdi -1: - SYSTRAP(break) - jc err - movq %rdi,__curbrk(%rip) - xorl %eax,%eax - ret -err: - jmp CERROR -#endif diff --git a/lib/libc/arch/x86_64/sys/cerror.S b/lib/libc/arch/x86_64/sys/cerror.S deleted file mode 100644 index 2bd7fb1484f..00000000000 --- a/lib/libc/arch/x86_64/sys/cerror.S +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: cerror.S,v 1.3 2004/02/18 16:51:21 miod Exp $ */ -/* $NetBSD: cerror.S,v 1.2 2002/06/03 18:30:33 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)cerror.s 5.1 (Berkeley) 4/23/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - - .globl _C_LABEL(errno) - -_ENTRY(CERROR) -#ifdef PIC - movq PIC_GOT(_C_LABEL(errno)), %rcx - movl %eax, (%rcx) -#else - movl %eax, _C_LABEL(errno)(%rip) -#endif /* PIC */ - movq $-1,%rax - ret diff --git a/lib/libc/arch/x86_64/sys/exect.S b/lib/libc/arch/x86_64/sys/exect.S deleted file mode 100644 index 31028402b6a..00000000000 --- a/lib/libc/arch/x86_64/sys/exect.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: exect.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: exect.S,v 1.1 2001/06/19 00:25:06 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)exect.s 5.1 (Berkeley) 4/23/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" -#include <machine/psl.h> - -SYSENTRY(exect) - pushfq - orb $(PSL_T>>8),1(%rsp) - popfq - SYSTRAP(execve) -#ifdef PIC - movq PIC_GOT(CERROR), %rcx - jmp *%rcx -#else - jmp CERROR -#endif diff --git a/lib/libc/arch/x86_64/sys/fork.S b/lib/libc/arch/x86_64/sys/fork.S deleted file mode 100644 index 155ee7227d6..00000000000 --- a/lib/libc/arch/x86_64/sys/fork.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: fork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: fork.S,v 1.2 2003/02/13 02:50:51 nathanw 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)fork.s 5.1 (Berkeley) 4/23/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - -SYSCALL(fork) - decl %edx /* from 1 to 0 in child, 0 to -1 in parent */ - andl %edx,%eax - ret /* pid = fork(); */ diff --git a/lib/libc/arch/x86_64/sys/rfork.S b/lib/libc/arch/x86_64/sys/rfork.S deleted file mode 100644 index caedbbd9aff..00000000000 --- a/lib/libc/arch/x86_64/sys/rfork.S +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: rfork.S,v 1.1 2004/01/28 01:44:45 mickey 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)fork.s 5.1 (Berkeley) 4/23/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - -SYSCALL(rfork) - decl %edx /* from 1 to 0 in child, 0 to -1 in parent */ - andl %edx,%eax - ret /* pid = rfork(); */ diff --git a/lib/libc/arch/x86_64/sys/sbrk.S b/lib/libc/arch/x86_64/sys/sbrk.S deleted file mode 100644 index 677068c4978..00000000000 --- a/lib/libc/arch/x86_64/sys/sbrk.S +++ /dev/null @@ -1,82 +0,0 @@ -/* $OpenBSD: sbrk.S,v 1.2 2004/02/10 00:22:51 drahn Exp $ */ -/* $NetBSD: sbrk.S,v 1.1 2001/06/19 00:25:06 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)sbrk.s 5.1 (Berkeley) 4/23/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - - .globl _end - .globl __curbrk - -#ifdef WEAK_ALIAS -WEAK_ALIAS(sbrk, _sbrk) -#endif - - .data -__curbrk: .quad _end - .text - -SYSENTRY(_sbrk) -#ifdef PIC - movq PIC_GOT(__curbrk),%rdx - movq (%rdx),%rax - addq %rax,%rdi - SYSTRAP(break) - jc err - movq PIC_GOT(__curbrk),%rdx - movq (%rdx),%rax - movq %rdi,(%rdx) - ret -err: - mov PIC_GOT(CERROR),%rdx - jmp *%rdx -#else - movq __curbrk(%rip),%rax - movq %rdi,%rsi - addq %rax,%rdi - SYSTRAP(break) - jc err - movq __curbrk(%rip),%rax - addq %rsi,__curbrk(%rip) - ret -err: - jmp CERROR -#endif diff --git a/lib/libc/arch/x86_64/sys/sigpending.S b/lib/libc/arch/x86_64/sys/sigpending.S deleted file mode 100644 index bbebd47c6bf..00000000000 --- a/lib/libc/arch/x86_64/sys/sigpending.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: sigpending.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: sigpending.S,v 1.1 2001/06/19 00:25:06 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)sigpending.s 5.1 (Berkeley) 7/1/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - -SYSCALL(sigpending) - movl %eax,(%rdi) # store old mask - xorl %eax,%eax - ret diff --git a/lib/libc/arch/x86_64/sys/sigprocmask.S b/lib/libc/arch/x86_64/sys/sigprocmask.S deleted file mode 100644 index c5a999582cf..00000000000 --- a/lib/libc/arch/x86_64/sys/sigprocmask.S +++ /dev/null @@ -1,66 +0,0 @@ -/* $OpenBSD: sigprocmask.S,v 1.2 2004/02/09 21:27:21 deraadt Exp $ */ -/* $NetBSD: sigprocmask.S,v 1.1 2001/06/19 00:25:06 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - -SYSENTRY(sigprocmask) - testq %rsi,%rsi # check new sigset pointer - jnz 1f # if not null, indirect - movl $1,%edi # SIG_BLOCK - jmp 2f -1: movl (%rsi),%esi # fetch indirect ... -2: SYSTRAP(sigprocmask) - jc err - testq %rdx,%rdx # test if old mask requested - jz out - movl %eax,(%rdx) # store old mask -out: - xorl %eax,%eax - ret -err: -#ifdef PIC - movq PIC_GOT(CERROR), %rcx - jmp *%rcx -#else - jmp CERROR -#endif diff --git a/lib/libc/arch/x86_64/sys/sigreturn.S b/lib/libc/arch/x86_64/sys/sigreturn.S deleted file mode 100644 index 0faf6942988..00000000000 --- a/lib/libc/arch/x86_64/sys/sigreturn.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $OpenBSD: sigreturn.S,v 1.2 2004/02/22 21:28:22 miod Exp $ */ -/* $NetBSD: __sigreturn14.S,v 1.1 2001/06/19 00:25:06 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90" - */ - -#include <machine/asm.h> - -#include "SYS.h" - -/* - * We must preserve the state of the registers as the user has set them up. - */ -#if 0 /* XXXfvdl fix later, but this one is really low priority */ -#ifdef GPROF -#undef ENTRY -#define MCOUNT_SYMBOL __mcount -#define ENTRY(x) \ - .globl _/**/x; _ALIGN_TEXT; _/**/x: pusha ; \ - .data; 1:; .long 0; .text; movl $1b,%eax; call MCOUNT_SYMBOL; popa ; nop -#endif /* GPROF */ -#endif - -OSYSCALL(sigreturn) - ret diff --git a/lib/libc/arch/x86_64/sys/sigsuspend.S b/lib/libc/arch/x86_64/sys/sigsuspend.S deleted file mode 100644 index 985bf61b99d..00000000000 --- a/lib/libc/arch/x86_64/sys/sigsuspend.S +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: sigsuspend.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ -/* $NetBSD: sigsuspend.S,v 1.1 2001/06/19 00:25:07 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)sigsuspend.s 5.2 (Berkeley) 12/17/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - -SYSENTRY(sigsuspend) - movl (%rdi),%edi # indirect to mask arg - SYSTRAP(sigsuspend) - jc err - xorl %eax,%eax # shouldn t happen - ret -err: -#ifdef PIC - movq PIC_GOT(CERROR), %rcx - jmp *%rcx -#else - jmp CERROR -#endif diff --git a/lib/libc/arch/x86_64/sys/syscall.S b/lib/libc/arch/x86_64/sys/syscall.S deleted file mode 100644 index ca64daf7ccf..00000000000 --- a/lib/libc/arch/x86_64/sys/syscall.S +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: syscall.S,v 1.2 2004/02/11 07:09:22 deraadt Exp $ */ -/* $NetBSD: syscall.S,v 1.2 2002/06/03 18:30:33 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)syscall.s 5.1 (Berkeley) 4/23/90 - */ - -#include <machine/asm.h> - -#include "SYS.h" - -SYSENTRY(syscall) - movq $0,%rax - movq %rcx,%r10 - syscall - jc err - ret -err: -#ifdef PIC - movq PIC_GOT(CERROR), %rcx - jmp *%rcx -#else - jmp CERROR -#endif diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c new file mode 100644 index 00000000000..d8e27c4c94e --- /dev/null +++ b/lib/libkvm/kvm_amd64.c @@ -0,0 +1,209 @@ +/* $OpenBSD: kvm_amd64.c,v 1.1 2004/02/27 17:36:13 deraadt Exp $ */ +/* $NetBSD: kvm_x86_64.c,v 1.3 2002/06/05 22:01:55 fvdl Exp $ */ + +/*- + * Copyright (c) 1989, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 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 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/cdefs.h> + +/* + * x86-64 machine dependent routines for kvm. + */ + +#include <sys/param.h> +#include <sys/user.h> +#include <sys/proc.h> +#include <sys/stat.h> +#include <sys/kcore.h> +#include <machine/kcore.h> +#include <stdlib.h> +#include <unistd.h> +#include <nlist.h> +#include <kvm.h> + +#include <uvm/uvm_extern.h> + +#include <limits.h> +#include <db.h> + +#include "kvm_private.h" + +#include <machine/pmap.h> +#include <machine/pte.h> +#include <machine/vmparam.h> + +void +_kvm_freevtop(kd) + kvm_t *kd; +{ + + /* Not actually used for anything right now, but safe. */ + if (kd->vmst != 0) + free(kd->vmst); +} + +/*ARGSUSED*/ +int +_kvm_initvtop(kd) + kvm_t *kd; +{ + + return (0); +} + +/* + * Translate a kernel virtual address to a physical address. + */ +int +_kvm_kvatop(kd, va, pa) + kvm_t *kd; + u_long va; + u_long *pa; +{ + cpu_kcore_hdr_t *cpu_kh; + u_long page_off; + pd_entry_t pde; + pt_entry_t pte; + paddr_t pde_pa, pte_pa; + + if (ISALIVE(kd)) { + _kvm_err(kd, 0, "vatop called in live kernel!"); + return (0); + } + + cpu_kh = kd->cpu_data; + page_off = va & PGOFSET; + + /* + * Find and read all entries to get to the pa. + */ + + /* + * Level 4. + */ + pde_pa = cpu_kh->ptdpaddr + (pl4_i(va) * sizeof(pd_entry_t)); + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { + _kvm_syserr(kd, 0, "could not read PT level 4 entry"); + goto lose; + } + if ((pde & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid level 4 PDE)"); + goto lose; + } + + /* + * Level 3. + */ + pde_pa = (pde_pa + PG_FRAME) + (pl3_i(va) * sizeof(pd_entry_t)); + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { + _kvm_syserr(kd, 0, "could not read PT level 3 entry"); + goto lose; + } + if ((pde & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid level 3 PDE)"); + goto lose; + } + + /* + * Level 2. + */ + pde_pa = (pde_pa & PG_FRAME) + (pl2_i(va) * sizeof(pd_entry_t)); + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { + _kvm_syserr(kd, 0, "could not read PT level 2 entry"); + goto lose; + } + if ((pde & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid level 2 PDE)"); + goto lose; + } + + + /* + * Level 1. + */ + pte_pa = (pde_pa & PG_FRAME) + (pl1_i(va) * sizeof(pt_entry_t)); + if (pread(kd->pmfd, (void *) &pte, sizeof(pte), + _kvm_pa2off(kd, pte_pa)) != sizeof(pte)) { + _kvm_syserr(kd, 0, "could not read PTE"); + goto lose; + } + /* + * Validate the PTE and return the physical address. + */ + if ((pte & PG_V) == 0) { + _kvm_err(kd, 0, "invalid translation (invalid PTE)"); + goto lose; + } + *pa = (pte & PG_FRAME) + page_off; + return (int)(NBPG - page_off); + + lose: + *pa = (u_long)~0L; + return (0); +} + +/* + * Translate a physical address to a file-offset in the crash dump. + */ +off_t +_kvm_pa2off(kd, pa) + kvm_t *kd; + u_long pa; +{ + cpu_kcore_hdr_t *cpu_kh; + phys_ram_seg_t *ramsegs; + off_t off; + int i; + + cpu_kh = kd->cpu_data; + ramsegs = (void *)((char *)(void *)cpu_kh + ALIGN(sizeof *cpu_kh)); + + off = 0; + for (i = 0; i < cpu_kh->nmemsegs; i++) { + if (pa >= ramsegs[i].start && + (pa - ramsegs[i].start) < ramsegs[i].size) { + off += (pa - ramsegs[i].start); + break; + } + off += ramsegs[i].size; + } + + return (kd->dump_off + off); +} diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 758eb08eb4a..992a3ed424d 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,5 +1,5 @@ # $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $ -# $OpenBSD: Makefile,v 1.31 2004/02/08 18:03:48 deraadt Exp $ +# $OpenBSD: Makefile,v 1.32 2004/02/27 17:36:13 deraadt Exp $ # # @(#)Makefile 5.1beta 93/09/24 # @@ -63,7 +63,7 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \ s_ilogb.S s_ilogbf.S s_log1p.S s_log1pf.S s_logb.S s_logbf.S \ s_rint.S s_rintf.S s_scalbn.S s_scalbnf.S s_significand.S \ s_significandf.S s_sin.S s_sinf.S s_tan.S s_tanf.S -.elif (${MACHINE_ARCH} == "x86_64") +.elif (${MACHINE_ARCH} == "amd64") .PATH: ${.CURDIR}/arch/x86_64 CPPFLAGS+=-I${.CURDIR}/arch/x86_64 ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \ diff --git a/lib/libpthread/arch/x86_64/_atomic_lock.c b/lib/libpthread/arch/x86_64/_atomic_lock.c deleted file mode 100644 index 0d187dee87d..00000000000 --- a/lib/libpthread/arch/x86_64/_atomic_lock.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $OpenBSD: _atomic_lock.c,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* David Leonard, <d@csee.uq.edu.au>. Public domain. */ - -/* - * Atomic lock for amd64 -- taken from i386 code. - */ - -#include "spinlock.h" - -int -_atomic_lock(volatile _spinlock_lock_t *lock) -{ - _spinlock_lock_t old; - - /* - * Use the eXCHanGe instruction to swap the lock value with - * a local variable containing the locked state. - */ - old = _SPINLOCK_LOCKED; - __asm__("xchg %0,%1" - : "=r" (old), "=m" (*lock) - : "0" (old), "1" (*lock)); - - return (old != _SPINLOCK_UNLOCKED); -} diff --git a/lib/libpthread/arch/x86_64/uthread_machdep.c b/lib/libpthread/arch/x86_64/uthread_machdep.c deleted file mode 100644 index c827a35a10c..00000000000 --- a/lib/libpthread/arch/x86_64/uthread_machdep.c +++ /dev/null @@ -1,108 +0,0 @@ -/* $OpenBSD: uthread_machdep.c,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Theo de Raadt - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#include <machine/param.h> -#include <pthread.h> -#include "pthread_private.h" - -struct frame { - long fr_gs; - long fr_fs; - long fr_es; - long fr_ds; - - long flag; - long fr_r15; - long fr_r14; - long fr_r13; - long fr_r12; - - long fr_r11; - long fr_r10; - long fr_r9; - long fr_r8; - - long fr_rdi; - long fr_rsi; - long fr_rbp; - - long fr_rbx; - long fr_rdx; - long fr_rcx; - long fr_rax; - - long fr_rip; - int fr_cs; /* XXX unreachable? */ - int pad; -}; - -#define copyreg(reg, lval) \ - __asm__("mov %%" #reg ", %0" : "=g"(lval)) - -/* - * Given a stack and an entry function, initialise a state - * structure that can be later switched to. - */ -void -_thread_machdep_init(struct _machdep_state* statep, void *base, int len, - void (*entry)(void)) -{ - struct frame *f; - int foo; - - /* Locate the initial frame, aligned at the top of the stack */ - f = (struct frame *)(((long)base + len - sizeof *f) & ~ALIGNBYTES); - - copyreg(cs, foo); - f->fr_cs = foo; - copyreg(ds, foo); - f->fr_ds = foo; - copyreg(es, foo); - f->fr_es = foo; - copyreg(fs, foo); - f->fr_fs = foo; - copyreg(gs, foo); - f->fr_gs = foo; - - f->fr_rbp = (long)-1; - f->fr_rip = (long)entry; - - statep->rsp = (long)f; - - _thread_machdep_save_float_state(statep); -} - -#define fxsave(addr) __asm("fxsave %0" : "=m" (*addr)) -#define fxrstor(addr) __asm("fxrstor %0" : : "m" (*addr)) -#define fwait() __asm("fwait") -#define fninit() __asm("fninit") - -void -_thread_machdep_save_float_state(struct _machdep_state *ms) -{ - fxsave(&ms->fpreg); - fninit(); - fwait(); -} - -void -_thread_machdep_restore_float_state(struct _machdep_state *ms) -{ - fxrstor(&ms->fpreg); -} diff --git a/lib/libpthread/arch/x86_64/uthread_machdep.h b/lib/libpthread/arch/x86_64/uthread_machdep.h deleted file mode 100644 index 34532db8b48..00000000000 --- a/lib/libpthread/arch/x86_64/uthread_machdep.h +++ /dev/null @@ -1,26 +0,0 @@ -/* $OpenBSD: uthread_machdep.h,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Theo de Raadt - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> -#include <machine/fpu.h> - -struct _machdep_state { - long rsp; - /* must be 128-bit aligned */ - struct savefpu fpreg __attribute__ ((aligned (16))); -}; diff --git a/lib/libpthread/arch/x86_64/uthread_machdep_asm.S b/lib/libpthread/arch/x86_64/uthread_machdep_asm.S deleted file mode 100644 index 818d157de93..00000000000 --- a/lib/libpthread/arch/x86_64/uthread_machdep_asm.S +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: uthread_machdep_asm.S,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Theo de Raadt - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <machine/asm.h> - -/* - * Switch stacks - */ - -/* void _thread_machdep_switch(new, oldsave); */ -ENTRY(_thread_machdep_switch) - pushq %rax - pushq %rcx - pushq %rdx - pushq %rbx - - pushq %rbp - pushq %rsi - pushq %rdi - - pushq %r8 - pushq %r9 - pushq %r10 - pushq %r11 - - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - movq $0xdeaf12345678beaf, %r15 - pushq %r15 - - movl %ds,%eax - pushq %rax - movl %es,%eax - pushq %rax - movl %fs,%eax - pushq %rax - movl %gs,%eax - pushq %rax - - movq %rsp, 0(%rsi) /* *arg2 = %rsp */ - movq 0(%rdi), %rsp /* %rsp = *arg1 */ - - popq %rax - movl %eax,%gs - popq %rax - movl %eax,%fs - popq %rax - movl %eax,%es - popq %rax - movl %eax,%ds - - popq %r15 # flag word. - popq %r15 - popq %r14 - popq %r13 - popq %r12 - - popq %r11 - popq %r10 - popq %r9 - popq %r8 - - popq %rdi - popq %rsi - popq %rbp - - popq %rbx - popq %rdx - popq %rcx - popq %rax - ret diff --git a/lib/libssl/crypto/Makefile b/lib/libssl/crypto/Makefile index 5179b85de77..9baf729b5b9 100644 --- a/lib/libssl/crypto/Makefile +++ b/lib/libssl/crypto/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.35 2004/01/29 03:05:33 deraadt Exp $ +# $OpenBSD: Makefile,v 1.36 2004/02/27 17:36:13 deraadt Exp $ LIB= crypto @@ -7,7 +7,7 @@ SSL_SRC= ${.CURDIR}/../${SSLEAYDIST} LCRYPTO_SRC= ${SSL_SRC}/crypto .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "arm" || \ - ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "x86_64" || \ + ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "amd64" || \ ${MACHINE_ARCH} == "alpha" CFLAGS+= -DL_ENDIAN .else diff --git a/lib/libssl/crypto/arch/x86_64/opensslconf.h b/lib/libssl/crypto/arch/x86_64/opensslconf.h deleted file mode 100644 index c33ccc8a0f9..00000000000 --- a/lib/libssl/crypto/arch/x86_64/opensslconf.h +++ /dev/null @@ -1,180 +0,0 @@ -/* opensslconf.h */ -/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ - -/* OpenSSL was configured with the following options: */ -#ifndef OPENSSL_DOING_MAKEDEPEND - -#ifndef OPENSSL_NO_KRB5 -# define OPENSSL_NO_KRB5 -#endif - -#endif /* OPENSSL_DOING_MAKEDEPEND */ - -/* The OPENSSL_NO_* macros are also defined as NO_* if the application - asks for it. This is a transient feature that is provided for those - who haven't had the time to do the appropriate changes in their - applications. */ -#ifdef OPENSSL_ALGORITHM_DEFINES -# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) -# define NO_KRB5 -# endif -#endif - -/* crypto/opensslconf.h.in */ - -/* Generate 80386 code? */ -#undef I386_ONLY - -#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ -#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) -#define OPENSSLDIR "/etc/ssl" -#endif -#endif - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD <unistd.h> - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) -#define IDEA_INT unsigned int -#endif - -#if defined(HEADER_MD2_H) && !defined(MD2_INT) -#define MD2_INT unsigned int -#endif - -#if defined(HEADER_RC2_H) && !defined(RC2_INT) -/* I need to put in a mod for the alpha - eay */ -#define RC2_INT unsigned int -#endif - -#if defined(HEADER_RC4_H) -#if !defined(RC4_INT) -/* using int types make the structure larger but make the code faster - * on most boxes I have tested - up to %20 faster. */ -/* - * I don't know what does "most" mean, but declaring "int" is a must on: - * - Intel P6 because partial register stalls are very expensive; - * - elder Alpha because it lacks byte load/store instructions; - */ -#define RC4_INT unsigned int -#endif -#if !defined(RC4_CHUNK) -/* - * This enables code handling data aligned at natural CPU word - * boundary. See crypto/rc4/rc4_enc.c for further details. - */ -#undef RC4_CHUNK -#endif -#endif - -#if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) -/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a - * %20 speed up (longs are 8 bytes, int's are 4). */ -#ifndef DES_LONG -#define DES_LONG unsigned int -#endif -#endif - -#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) -#define CONFIG_HEADER_BN_H -#undef BN_LLONG - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -/* The prime number generation stuff may not work when - * EIGHT_BIT but I don't care since I've only used this mode - * for debuging the bignum libraries */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_BIT -#undef SIXTEEN_BIT -#undef EIGHT_BIT -#endif - -#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) -#define CONFIG_HEADER_RC4_LOCL_H -/* if this is defined data[i] is used instead of *data, this is a %20 - * speedup on x86 */ -#undef RC4_INDEX -#endif - -#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) -#define CONFIG_HEADER_BF_LOCL_H -#undef BF_PTR -#endif /* HEADER_BF_LOCL_H */ - -#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) -#define CONFIG_HEADER_DES_LOCL_H -#ifndef DES_DEFAULT_OPTIONS -/* the following is tweaked from a config script, that is why it is a - * protected undef/define */ -#ifndef DES_PTR -#define DES_PTR -#endif - -/* This helps C compiler generate the correct code for multiple functional - * units. It reduces register dependancies at the expense of 2 more - * registers */ -#ifndef DES_RISC1 -#undef DES_RISC1 -#endif - -#ifndef DES_RISC2 -#define DES_RISC2 -#endif - -#if defined(DES_RISC1) && defined(DES_RISC2) -YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! -#endif - -/* Unroll the inner loop, this sometimes helps, sometimes hinders. - * Very mucy CPU dependant */ -#ifndef DES_UNROLL -#undef DES_UNROLL -#endif - -/* These default values were supplied by - * Peter Gutman <pgut001@cs.auckland.ac.nz> - * They are only used if nothing else has been defined */ -#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) -/* Special defines which change the way the code is built depending on the - CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find - even newer MIPS CPU's, but at the moment one size fits all for - optimization options. Older Sparc's work better with only UNROLL, but - there's no way to tell at compile time what it is you're running on */ - -#if defined( sun ) /* Newer Sparc's */ -# define DES_PTR -# define DES_RISC1 -# define DES_UNROLL -#elif defined( __ultrix ) /* Older MIPS */ -# define DES_PTR -# define DES_RISC2 -# define DES_UNROLL -#elif defined( __osf1__ ) /* Alpha */ -# define DES_PTR -# define DES_RISC2 -#elif defined ( _AIX ) /* RS6000 */ - /* Unknown */ -#elif defined( __hpux ) /* HP-PA */ - /* Unknown */ -#elif defined( __aux ) /* 68K */ - /* Unknown */ -#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ -# define DES_UNROLL -#elif defined( __sgi ) /* Newer MIPS */ -# define DES_PTR -# define DES_RISC2 -# define DES_UNROLL -#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ -# define DES_PTR -# define DES_RISC1 -# define DES_UNROLL -#endif /* Systems-specific speed defines */ -#endif - -#endif /* DES_DEFAULT_OPTIONS */ -#endif /* HEADER_DES_LOCL_H */ diff --git a/libexec/ld.so/amd64/archdep.h b/libexec/ld.so/amd64/archdep.h index d8e729b9b68..a3f14cf5215 100644 --- a/libexec/ld.so/amd64/archdep.h +++ b/libexec/ld.so/amd64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.1 2004/02/10 14:18:14 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.2 2004/02/27 17:36:15 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -31,7 +31,7 @@ #define DL_MALLOC_ALIGN 8 /* Arch constraint or otherwise */ -#define MACHID EM_X86_64 /* ELF e_machine ID value checked */ +#define MACHID EM_AMD64 /* ELF e_machine ID value checked */ #define RELTYPE Elf32_Rela #define RELSIZE sizeof(Elf32_Rela) diff --git a/libexec/ld.so/x86_64/Makefile.inc b/libexec/ld.so/x86_64/Makefile.inc deleted file mode 100644 index 8f7d51179b4..00000000000 --- a/libexec/ld.so/x86_64/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.1 2004/02/10 14:18:14 drahn Exp $ - -CFLAGS += -fPIC -fno-stack-protector -AFLAGS += -fpic diff --git a/libexec/ld.so/x86_64/archdep.h b/libexec/ld.so/x86_64/archdep.h deleted file mode 100644 index d8e729b9b68..00000000000 --- a/libexec/ld.so/x86_64/archdep.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $OpenBSD: archdep.h,v 1.1 2004/02/10 14:18:14 drahn Exp $ */ - -/* - * Copyright (c) 1998 Per Fogelstrom, Opsycon AB - * - * 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. - * - */ - -#ifndef _X86_64_ARCHDEP_H_ -#define _X86_64_ARCHDEP_H_ - -#define DL_MALLOC_ALIGN 8 /* Arch constraint or otherwise */ - -#define MACHID EM_X86_64 /* ELF e_machine ID value checked */ - -#define RELTYPE Elf32_Rela -#define RELSIZE sizeof(Elf32_Rela) - -#include <sys/mman.h> -#include <elf_abi.h> -#include <machine/reloc.h> -#include "syscall.h" -#include "util.h" - -#define RTLD_TEXT_PLT - -static inline void * -_dl_mmap(void *addr, unsigned int len, unsigned int prot, - unsigned int flags, int fd, off_t offset) -{ - return((void *)_dl__syscall((quad_t)SYS_mmap, addr, len, prot, - flags, fd, 0, offset)); -} - -static inline void * -_dl_mquery(void *addr, unsigned int len, unsigned int prot, - unsigned int flags, int fd, off_t offset) -{ - return((void *)_dl__syscall((quad_t)SYS_mquery, addr, len, prot, - flags, fd, 0, offset)); -} - - -static inline void -RELOC_REL(Elf64_Rel *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v) -{ - /* AMD64 is a rela architecture */ -} - -static inline void -RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v) -{ - if (ELF64_R_TYPE(r->r_info) == R_X86_64_RELATIVE) { - *p = v + r->r_addend; - } else if (ELF64_R_TYPE(r->r_info) == R_X86_64_GLOB_DAT) { - *p = v + s->st_value + r->r_addend; - } else { - _dl_printf("unknown bootstrap relocation\n"); - _dl_exit(6); - } -} - -#define RELOC_GOT(obj, offs) - -#define GOT_PERMS PROT_READ - -#endif /* _X86_64_ARCHDEP_H_ */ diff --git a/libexec/ld.so/x86_64/ldasm.S b/libexec/ld.so/x86_64/ldasm.S deleted file mode 100644 index 15128e99706..00000000000 --- a/libexec/ld.so/x86_64/ldasm.S +++ /dev/null @@ -1,152 +0,0 @@ -/* $OpenBSD: ldasm.S,v 1.3 2004/02/23 20:52:04 deraadt Exp $ */ - -/* - * Copyright (c) 2002,2004 Dale Rahn - * 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 ``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. - * - */ - - -#define DL_DATA_SIZE (16*8) /* 16 * sizeof(ELF_Addr) */ -#define DL_LOFF_OFFSET (7*8) /* index 7 */ -#include <sys/syscall.h> -#include <machine/asm.h> - - .text - .align 4 - .globl _dl_start - .type _dl_start,@function -_dl_start: - movq %rsp, %r12 # save stack pointer for _rtld - pushq %rbx # save ps_strings - subq $DL_DATA_SIZE, %rsp # allocate dl_data - - leaq _DYNAMIC(%rip),%rdx # &_DYNAMIC - movq %rsp, %rsi # dl_data for dl_boot_bind - movq %r12, %rdi # load saved SP for dl_boot_bind - call _dl_boot_bind@PLT # _dl_boot_bind(sp,dl_data,dynamicp) - - movq %rsi, %rcx # dl_data - movq DL_LOFF_OFFSET(%rsi), %rdx # loff from dl_data - - movq (%r12), %rdi - leaq 16(%r12,%rdi,8), %rsi # envp - movq %r12, %rdi - addq $8,%rdi # argv - call _dl_boot@PLT # _dl_boot(argv,envp,loff,dl_data) - - addq $DL_DATA_SIZE,%rsp # return dl_data - -# popq %rbx # %rbx = ps_strings - XXXDSR -# popq %rdx # %rdx = cleanup - XXXDSR -# popq %rcx # %rcx = obj_main - XXXDSR - movq %r12, %rsp - jmp *%rax - - .section ".text" - -#define DL_SYSCALL(n) DL_SYSCALL2(n,n) -#define DL_SYSCALL2(n,c) \ - .global __CONCAT(_dl_,n) ;\ - .type __CONCAT(_dl_,n), @function ;\ - .align 4 ;\ -__CONCAT(_dl_,n): ;\ - movl $(__CONCAT(SYS_,c)), %eax ;\ - movq %rcx, %r10 ;\ - syscall ;\ - jb 1f ;\ - ret - -DL_SYSCALL(open) -DL_SYSCALL(fcntl) -DL_SYSCALL(fstat) -DL_SYSCALL(stat) -DL_SYSCALL(read) -DL_SYSCALL(write) -DL_SYSCALL(close) -DL_SYSCALL(issetugid) -DL_SYSCALL(getdirentries) -DL_SYSCALL(mprotect) -DL_SYSCALL(munmap) -DL_SYSCALL(exit) -DL_SYSCALL2(_syscall,__syscall) -DL_SYSCALL2(sysctl,__sysctl) - -1: - /* error: result = -errno; - handled here. */ - neg %rax - ret - - - /* _dl_sigprocmask: does not handle NULL new set */ - - .align 4 - .global _dl_sigprocmask - .type _dl_sigprocmask,@function -_dl_sigprocmask: - movq (%rsi),%rsi # fetch indirect... - movl $SYS_sigprocmask, %eax - movq %rcx, %r10 - syscall - jc 1b /* error: result = -errno */ - testq %rdx,%rdx # test if old mask requested - jz 2f - movq %rax,(%rdx) # store old mask - xorq %rax,%rax -2: ret - - .align 4 - .global _dl_bind_start - .type _dl_bind_start,@function -_dl_bind_start: - pushfq # save registers - pushq %rax - pushq %rcx - pushq %rdx - pushq %rsi - pushq %rdi - pushq %r8 - pushq %r9 - pushq %r10 - pushq %r11 - - movq 80(%rsp), %rdi # Copy of reloff - movq 88(%rsp), %rsi # Copy of obj - call _dl_bind@PLT # Call the binder - movq %rax,88(%rsp) # Store function to be called in obj - - popq %r11 # restore registers - popq %r10 - popq %r9 - popq %r8 - popq %rdi - popq %rsi - popq %rdx - popq %rcx - popq %rax - popfq - - leaq 8(%rsp),%rsp # Discard reloff, do not change eflags - ret - diff --git a/libexec/ld.so/x86_64/rtld_machine.c b/libexec/ld.so/x86_64/rtld_machine.c deleted file mode 100644 index d930b21b94c..00000000000 --- a/libexec/ld.so/x86_64/rtld_machine.c +++ /dev/null @@ -1,454 +0,0 @@ -/* $OpenBSD: rtld_machine.c,v 1.5 2004/02/23 20:52:04 deraadt Exp $ */ - -/* - * Copyright (c) 2002,2004 Dale Rahn - * Copyright (c) 2001 Niklas Hallqvist - * Copyright (c) 2001 Artur Grabowski - * - * 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. - */ -/*- - * Copyright (c) 2000 Eduardo Horvath. - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. - * - * 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. - */ - -#define _DYN_LOADER - -#include <sys/types.h> -#include <sys/cdefs.h> -#include <sys/mman.h> - -#include <nlist.h> -#include <link.h> -#include <signal.h> - -#include "syscall.h" -#include "archdep.h" -#include "resolve.h" - -void -_dl_bcopy(const void *src, void *dest, int size) -{ - const unsigned char *psrc = src; - unsigned char *pdest = dest; - int i; - - for (i = 0; i < size; i++) - pdest[i] = psrc[i]; -} - -/* - * The following table holds for each relocation type: - * - the width in bits of the memory location the relocation - * applies to (not currently used) - * - the number of bits the relocation value must be shifted to the - * right (i.e. discard least significant bits) to fit into - * the appropriate field in the instruction word. - * - flags indicating whether - * * the relocation involves a symbol - * * the relocation is relative to the current position - * * the relocation is for a GOT entry - * * the relocation is relative to the load address - * - */ -#define _RF_S 0x80000000 /* Resolve symbol */ -#define _RF_A 0x40000000 /* Use addend */ -#define _RF_P 0x20000000 /* Location relative */ -#define _RF_G 0x10000000 /* GOT offset */ -#define _RF_B 0x08000000 /* Load address relative */ -#define _RF_U 0x04000000 /* Unaligned */ -#define _RF_E 0x02000000 /* ERROR */ -#define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ -#define _RF_RS(s) ((s) & 0xff) /* right shift */ -static int reloc_target_flags[] = { - 0, /* 0 NONE */ - _RF_S|_RF_A| _RF_SZ(64) | _RF_RS(0), /* 1 _64*/ - _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(0), /* 2 PC32 */ - _RF_G|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 3 GOT32 */ - _RF_E|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 4 PLT32 */ - _RF_S| _RF_SZ(32) | _RF_RS(0), /* 5 COPY */ - _RF_S| _RF_SZ(64) | _RF_RS(0), /* 6 GLOB_DAT*/ - _RF_S| _RF_SZ(64) | _RF_RS(0), /* 7 JUMP_SLOT*/ - _RF_A| _RF_B| _RF_SZ(64) | _RF_RS(0), /* 8 RELATIVE*/ - _RF_E, /* 9 GOTPCREL*/ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 10 32 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 11 32S */ - _RF_S|_RF_A| _RF_SZ(16) | _RF_RS(0), /* 12 16 */ - _RF_S|_RF_A|_RF_P| _RF_SZ(16) | _RF_RS(0), /* 13 PC16 */ - _RF_S|_RF_A| _RF_SZ(8) | _RF_RS(0), /* 14 8 */ - _RF_S|_RF_A|_RF_P| _RF_SZ(8) | _RF_RS(0), /* 15 PC8 */ - _RF_E, /* 16 DPTMOD64*/ - _RF_E, /* 17 DTPOFF64*/ - _RF_E, /* 18 TPOFF64 */ - _RF_E, /* 19 TLSGD */ - _RF_E, /* 20 TLSLD */ - _RF_E, /* 21 DTPOFF32*/ - _RF_E, /* 22 GOTTPOFF*/ - _RF_E /* 23 TPOFF32*/ -}; - -#define RELOC_RESOLVE_SYMBOL(t) ((reloc_target_flags[t] & _RF_S) != 0) -#define RELOC_PC_RELATIVE(t) ((reloc_target_flags[t] & _RF_P) != 0) -#define RELOC_BASE_RELATIVE(t) ((reloc_target_flags[t] & _RF_B) != 0) -#define RELOC_UNALIGNED(t) ((reloc_target_flags[t] & _RF_U) != 0) -#define RELOC_USE_ADDEND(t) ((reloc_target_flags[t] & _RF_A) != 0) -#define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) -#define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) -#define RELOC_ERROR(t) (reloc_target_flags[t] & _RF_E) - -static long reloc_target_bitmask[] = { -#define _BM(x) (x == 64? ~0 : ~(-(1UL << (x)))) - 0, /* 0 NONE */ - _BM(64), /* 1 _64*/ - _BM(32), /* 2 PC32 */ - _BM(32), /* 3 GOT32 */ - _BM(32), /* 4 PLT32 */ - _BM(0), /* 5 COPY */ - _BM(64), /* 6 GLOB_DAT*/ - _BM(64), /* 7 JUMP_SLOT*/ - _BM(64), /* 8 RELATIVE*/ - _BM(32), /* 9 GOTPCREL*/ - _BM(32), /* 10 32 */ - _BM(32), /* 11 32S */ - _BM(16), /* 12 16 */ - _BM(16), /* 13 PC16 */ - _BM(8), /* 14 8 */ - _BM(8), /* 15 PC8 */ - 0, /* 16 DPTMOD64*/ - 0, /* 17 DTPOFF64*/ - 0, /* 18 TPOFF64 */ - 0, /* 19 TLSGD */ - 0, /* 20 TLSLD */ - 0, /* 21 DTPOFF32*/ - 0, /* 22 GOTTPOFF*/ - 0 /* 23 TPOFF32*/ -#undef _BM -}; -#define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t]) - -void _dl_reloc_plt(Elf_Addr *where, Elf_Addr value); - -int -_dl_md_reloc(elf_object_t *object, int rel, int relsz) -{ - long i; - long numrel; - long fails = 0; - Elf_Addr loff; - Elf_RelA *rels; - struct load_list *llist; - - loff = object->load_offs; - numrel = object->Dyn.info[relsz] / sizeof(Elf_RelA); - rels = (Elf_RelA *)(object->Dyn.info[rel]); - if (rels == NULL) - return(0); - - /* - * unprotect some segments if we need it. - */ - if ((rel == DT_REL || rel == DT_RELA)) { - for (llist = object->load_list; llist != NULL; llist = llist->next) { - if (!(llist->prot & PROT_WRITE)) - _dl_mprotect(llist->start, llist->size, - llist->prot|PROT_WRITE); - } - } - - for (i = 0; i < numrel; i++, rels++) { - Elf_Addr *where, value, ooff, mask; - Elf_Word type; - const Elf_Sym *sym, *this; - const char *symn; - - type = ELF_R_TYPE(rels->r_info); - - if (RELOC_ERROR(type)) { - _dl_printf("relocation error %d idx %d\n", type, i); - _dl_exit(20); - } - - if (type == R_TYPE(NONE)) - continue; - - if (type == R_TYPE(JUMP_SLOT) && rel != DT_JMPREL) - continue; - - where = (Elf_Addr *)(rels->r_offset + loff); - - if (RELOC_USE_ADDEND(type)) - value = rels->r_addend; - else - value = 0; - - sym = NULL; - symn = NULL; - if (RELOC_RESOLVE_SYMBOL(type)) { - sym = object->dyn.symtab; - sym += ELF_R_SYM(rels->r_info); - symn = object->dyn.strtab + sym->st_name; - - if (sym->st_shndx != SHN_UNDEF && - ELF_ST_BIND(sym->st_info) == STB_LOCAL) { - value += loff; - } else { - this = NULL; - ooff = _dl_find_symbol_bysym(object, - ELF_R_SYM(rels->r_info), _dl_objects, - &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND| - ((type == R_TYPE(JUMP_SLOT))? - SYM_PLT:SYM_NOTPLT), - sym->st_size); - if (this == NULL) { -resolve_failed: - _dl_printf("%s: %s: can't resolve " - "reference '%s'\n", - _dl_progname, object->load_name, - symn); - fails++; - continue; - } - value += (Elf_Addr)(ooff + this->st_value); - } - } - - if (type == R_TYPE(JUMP_SLOT)) { - _dl_reloc_plt(where, value); - continue; - } - - if (type == R_TYPE(COPY)) { - void *dstaddr = where; - const void *srcaddr; - const Elf_Sym *dstsym = sym, *srcsym = NULL; - size_t size = dstsym->st_size; - Elf_Addr soff; - - soff = _dl_find_symbol(symn, object->next, &srcsym, - SYM_SEARCH_ALL|SYM_WARNNOTFOUND| - ((type == R_TYPE(JUMP_SLOT)) ? SYM_PLT:SYM_NOTPLT), - size, object); - if (srcsym == NULL) - goto resolve_failed; - - srcaddr = (void *)(soff + srcsym->st_value); - _dl_bcopy(srcaddr, dstaddr, size); - continue; - } - - if (RELOC_PC_RELATIVE(type)) - value -= (Elf_Addr)where; - if (RELOC_BASE_RELATIVE(type)) - value += loff; - - mask = RELOC_VALUE_BITMASK(type); - value >>= RELOC_VALUE_RIGHTSHIFT(type); - value &= mask; - - if (RELOC_UNALIGNED(type)) { - /* Handle unaligned relocations. */ - Elf_Addr tmp = 0; - char *ptr = (char *)where; - int i, size = RELOC_TARGET_SIZE(type)/8; - - /* Read it in one byte at a time. */ - for (i=0; i<size; i++) - tmp = (tmp << 8) | ptr[i]; - - tmp &= ~mask; - tmp |= value; - - /* Write it back out. */ - for (i=0; i<size; i++) - ptr[i] = ((tmp >> (8*i)) & 0xff); - } else if (RELOC_TARGET_SIZE(type) > 32) { - *where &= ~mask; - *where |= value; - } else { - Elf32_Addr *where32 = (Elf32_Addr *)where; - - *where32 &= ~mask; - *where32 |= value; - } - } - - /* reprotect the unprotected segments */ - if ((rel == DT_REL || rel == DT_RELA)) { - for (llist = object->load_list; llist != NULL; llist = llist->next) { - if (!(llist->prot & PROT_WRITE)) - _dl_mprotect(llist->start, llist->size, - llist->prot); - } - } - - return (fails); -} - -void -_dl_reloc_plt(Elf_Addr *where, Elf_Addr value) -{ - *where = value; -} - -/* - * Resolve a symbol at run-time. - */ -Elf_Addr -_dl_bind(elf_object_t *object, int index) -{ - Elf_RelA *rel; - Elf_Word *addr; - const Elf_Sym *sym, *this; - const char *symn; - Elf_Addr ooff, newval; - sigset_t omask, nmask; - - rel = (Elf_RelA *)(object->Dyn.info[DT_JMPREL]); - - rel += index; - - sym = object->dyn.symtab; - sym += ELF_R_SYM(rel->r_info); - symn = object->dyn.strtab + sym->st_name; - - addr = (Elf_Word *)(object->load_offs + rel->r_offset); - this = NULL; - ooff = _dl_find_symbol(symn, _dl_objects, &this, - SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym->st_size, object); - if (this == NULL) { - _dl_printf("lazy binding failed!\n"); - *((int *)0) = 0; /* XXX */ - } - - newval = ooff + this->st_value + rel->r_addend; - - /* if GOT is protected, allow the write */ - if (object->got_size != 0) { - sigfillset(&nmask); - _dl_sigprocmask(SIG_BLOCK, &nmask, &omask); - _dl_mprotect((void*)object->got_start, object->got_size, - PROT_READ|PROT_WRITE); - } - - _dl_reloc_plt((Elf_Addr *)addr, newval); - - /* put the GOT back to RO */ - if (object->got_size != 0) { - _dl_mprotect((void*)object->got_start, object->got_size, - PROT_READ); - _dl_sigprocmask(SIG_SETMASK, &omask, NULL); - } - - return(newval); -} - -void -_dl_md_reloc_got(elf_object_t *object, int lazy) -{ - extern void _dl_bind_start(void); /* XXX */ - Elf_Addr *pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT]; - int i, num; - Elf_RelA *rel; - Elf_Addr ooff; - const Elf_Sym *this; - - if (pltgot == NULL) - return; /* it is possible to have no PLT/GOT relocations */ - - pltgot[1] = (Elf_Addr)object; - pltgot[2] = (Elf_Addr)&_dl_bind_start; - - if (object->Dyn.info[DT_PLTREL] != DT_RELA) - return; - - object->got_addr = NULL; - object->got_size = 0; - this = NULL; - ooff = _dl_find_symbol("__got_start", object, &this, - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); - if (this != NULL) - object->got_addr = ooff + this->st_value; - - this = NULL; - ooff = _dl_find_symbol("__got_end", object, &this, - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); - if (this != NULL) - object->got_size = ooff + this->st_value - object->got_addr; - - if (object->got_addr == NULL) - object->got_start = NULL; - else { - object->got_start = ELF_TRUNC(object->got_addr, _dl_pagesz); - object->got_size += object->got_addr - object->got_start; - object->got_size = ELF_ROUND(object->got_size, _dl_pagesz); - } - - if (!lazy) { - _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ); - } else { - rel = (Elf_RelA *)(object->Dyn.info[DT_JMPREL]); - num = (object->Dyn.info[DT_PLTRELSZ]); - for (i = 0; i < num/sizeof(Elf_RelA); i++, rel++) { - Elf_Addr *where; - where = (Elf_Addr *)(rel->r_offset + object->load_offs); - *where += object->load_offs; - } - - } - - /* PLT is already RO on i386, no point in mprotecting it, just GOT */ - if (object->got_size != 0) - _dl_mprotect((void*)object->got_start, object->got_size, - PROT_READ); -} diff --git a/libexec/ld.so/x86_64/syscall.h b/libexec/ld.so/x86_64/syscall.h deleted file mode 100644 index 0656c00f685..00000000000 --- a/libexec/ld.so/x86_64/syscall.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $OpenBSD: syscall.h,v 1.2 2004/02/23 20:52:05 deraadt Exp $ */ - -/* - * Copyright (c) 2001 Niklas Hallqvist - * - * 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. - * - */ - -#ifndef __DL_SYSCALL_H__ -#define __DL_SYSCALL_H__ - -#include <sys/syscall.h> -#include <sys/stat.h> -#include <sys/signal.h> - -#ifndef _dl_MAX_ERRNO -#define _dl_MAX_ERRNO 4096 -#endif -#define _dl_check_error(__res) \ - ((int) __res < 0 && (int) __res >= -_dl_MAX_ERRNO) - -int _dl_close(int); -int _dl_exit(int); -int _dl_issetugid(void); -long _dl__syscall(quad_t, ...); -int _dl_mprotect(const void *, int, int); -int _dl_munmap(const void *, unsigned int); -int _dl_open(const char *, unsigned int); -int _dl_read(int, const char *, int); -int _dl_stat(const char *, struct stat *); -int _dl_fstat(int, struct stat *); -int _dl_fcntl(int, int, ...); -int _dl_getdirentries(int, char*, int, long *); -int _dl_sigprocmask(int, const sigset_t *, sigset_t *); -int _dl_sysctl(int *, u_int, void *, size_t *, void *, size_t); - -static inline off_t -_dl_lseek(int fildes, off_t offset, int whence) -{ - return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence); -} - -#endif /*__DL_SYSCALL_H__*/ diff --git a/regress/sys/kern/noexec/Makefile b/regress/sys/kern/noexec/Makefile index a5170eeb90d..768d58dbd3e 100644 --- a/regress/sys/kern/noexec/Makefile +++ b/regress/sys/kern/noexec/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.7 2004/02/23 08:06:56 deraadt Exp $ +# $OpenBSD: Makefile,v 1.8 2004/02/27 17:36:15 deraadt Exp $ .if ${MACHINE} == "sparc64" || ${MACHINE} == "sparc" || \ ${MACHINE} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \ - ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "i386" || \ + ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" || \ ${MACHINE} == "hppa" PROG= noexec diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 42c404c4e2b..ba7430a00cd 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.own.mk,v 1.79 2004/02/21 03:04:18 deraadt Exp $ +# $OpenBSD: bsd.own.mk,v 1.80 2004/02/27 17:36:16 deraadt Exp $ # $NetBSD: bsd.own.mk,v 1.24 1996/04/13 02:08:09 thorpej Exp $ # Host-specific overrides @@ -31,7 +31,8 @@ DEBUGLIBS?= no .if ( ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "arm" || \ ${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "i386" || \ ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc" || \ - ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64") + ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64") || \ + ${MACHINE} == "amd64" ELF_TOOLCHAIN?= yes .else ELF_TOOLCHAIN?= no @@ -39,7 +40,8 @@ ELF_TOOLCHAIN?= no # do the dew .if (${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "hppa64" || \ - ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64") + ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64") || \ + ${MACHINE} == "amd64" USE_GCC3?=yes .else USE_GCC3?=no diff --git a/sys/compat/common/Makefile b/sys/compat/common/Makefile index 2fdb75cea90..cd44db92fb3 100644 --- a/sys/compat/common/Makefile +++ b/sys/compat/common/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2004/01/28 01:39:39 mickey Exp $ +# $OpenBSD: Makefile,v 1.16 2004/02/27 17:36:16 deraadt Exp $ # $NetBSD: Makefile,v 1.8 1996/05/18 15:52:19 christos Exp $ LIB= compat @@ -15,7 +15,7 @@ SRCS= compat_exec.c compat_util.c compat_dir.c compat_vm.c \ vfs_syscalls_25.c vfs_syscalls_43.c vm_43.c # really, all machines where sizeof(int) != sizeof(long) -.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "x86_64") && \ +.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "amd64") && \ (${MACHINE_ARCH} != "sparc64") SRCS+= kern_ipc_10.c .endif diff --git a/sys/lib/libkern/arch/x86_64/Makefile.inc b/sys/lib/libkern/arch/x86_64/Makefile.inc deleted file mode 100644 index ed61f7015e9..00000000000 --- a/sys/lib/libkern/arch/x86_64/Makefile.inc +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.2 2002/11/25 00:55:22 fvdl Exp $ - -SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ - byte_swap_2.S byte_swap_4.S \ - bcmp.S bcopy.S bzero.S ffs.S \ - memchr.S memcmp.S memcpy.S memmove.S memset.S \ - ovbcopy.S \ - strcat.S strchr.S strcmp.S \ - strcpy.S strlcpy.c strlcat.c strlen.S \ - strncasecmp.c strncmp.c strncpy.c strrchr.S \ - scanc.S skpc.S random.c -# bswap64.c strcasecmp.c strncasecmp.c \ strtoul.c \ - -CFLAGS+=-mcmodel=kernel diff --git a/sys/lib/libkern/arch/x86_64/bcmp.S b/sys/lib/libkern/arch/x86_64/bcmp.S deleted file mode 100644 index 5cee3afe74b..00000000000 --- a/sys/lib/libkern/arch/x86_64/bcmp.S +++ /dev/null @@ -1,24 +0,0 @@ -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: bcmp.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") -#endif - -ENTRY(bcmp) - xorl %eax,%eax /* clear return value */ - cld /* set compare direction forward */ - - movq %rdx,%rcx /* compare by words */ - shrq $3,%rcx - repe - cmpsq - jne L1 - - movq %rdx,%rcx /* compare remainder by bytes */ - andq $7,%rcx - repe - cmpsb - je L2 - -L1: incl %eax -L2: ret diff --git a/sys/lib/libkern/arch/x86_64/bcopy.S b/sys/lib/libkern/arch/x86_64/bcopy.S deleted file mode 100644 index c741cd66ca1..00000000000 --- a/sys/lib/libkern/arch/x86_64/bcopy.S +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from locore.s. - * - * 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 University of - * California, Berkeley and its contributors. - * 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 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> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: bcopy.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") -#endif - - /* - * (ov)bcopy (src,dst,cnt) - * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 - */ - -#ifdef MEMCOPY -ENTRY(memcpy) -#else -#ifdef MEMMOVE -ENTRY(memmove) -#else -#ifdef OVBCOPY -ENTRY(ovbcopy) -#else -ENTRY(bcopy) -#endif -#endif -#endif -#if defined(MEMCOPY) || defined(MEMMOVE) - movq %rdi,%r11 /* save dest */ -#else - xchgq %rdi,%rsi -#endif - movq %rdx,%rcx - movq %rdi,%rax - subq %rsi,%rax - cmpq %rcx,%rax /* overlapping? */ - jb 1f - cld /* nope, copy forwards. */ - shrq $3,%rcx /* copy by words */ - rep - movsq - movq %rdx,%rcx - andq $7,%rcx /* any bytes left? */ - rep - movsb -#if defined(MEMCOPY) || defined(MEMMOVE) - movq %r11,%rax -#endif - ret -1: - addq %rcx,%rdi /* copy backwards. */ - addq %rcx,%rsi - std - andq $7,%rcx /* any fractional bytes? */ - decq %rdi - decq %rsi - rep - movsb - movq %rdx,%rcx /* copy remainder by words */ - shrq $3,%rcx - subq $7,%rsi - subq $7,%rdi - rep - movsq -#if defined(MEMCOPY) || defined(MEMMOVE) - movq %r11,%rax -#endif - cld - ret diff --git a/sys/lib/libkern/arch/x86_64/byte_swap_2.S b/sys/lib/libkern/arch/x86_64/byte_swap_2.S deleted file mode 100644 index 19ed5e27812..00000000000 --- a/sys/lib/libkern/arch/x86_64/byte_swap_2.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.1 2001/06/19 00:22:45 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)htons.s 5.2 (Berkeley) 12/17/90 - */ - -#include <machine/asm.h> -#if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_2.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") -#endif - -_ENTRY(_C_LABEL(bswap16)) -_ENTRY(_C_LABEL(ntohs)) -_ENTRY(_C_LABEL(htons)) -_PROF_PROLOGUE - movl %edi,%eax - xchgb %ah,%al - ret diff --git a/sys/lib/libkern/arch/x86_64/byte_swap_4.S b/sys/lib/libkern/arch/x86_64/byte_swap_4.S deleted file mode 100644 index f6a961e38f5..00000000000 --- a/sys/lib/libkern/arch/x86_64/byte_swap_4.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.1 2001/06/19 00:22:45 fvdl 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 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 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: @(#)htonl.s 5.3 (Berkeley) 12/17/90 - */ - -#include <machine/asm.h> -#if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_4.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") -#endif - -_ENTRY(_C_LABEL(bswap32)) -_ENTRY(_C_LABEL(ntohl)) -_ENTRY(_C_LABEL(htonl)) -_PROF_PROLOGUE - movl %edi,%eax - bswap %eax - ret diff --git a/sys/lib/libkern/arch/x86_64/bzero.S b/sys/lib/libkern/arch/x86_64/bzero.S deleted file mode 100644 index 6e4fe834d1a..00000000000 --- a/sys/lib/libkern/arch/x86_64/bzero.S +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: bzero.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") -#endif - -ENTRY(bzero) - movq %rsi,%rdx - - cld /* set fill direction forward */ - xorq %rax,%rax /* set fill data to 0 */ - - /* - * if the string is too short, it's really not worth the overhead - * of aligning to word boundries, etc. So we jump to a plain - * unaligned set. - */ - cmpq $16,%rdx - jb L1 - - movq %rdi,%rcx /* compute misalignment */ - negq %rcx - andq $7,%rcx - subq %rcx,%rdx - rep /* zero until word aligned */ - stosb - - movq %rdx,%rcx /* zero by words */ - shrq $3,%rcx - andq $7,%rdx - rep - stosq - -L1: movq %rdx,%rcx /* zero remainder by bytes */ - rep - stosb - - ret diff --git a/sys/lib/libkern/arch/x86_64/ffs.S b/sys/lib/libkern/arch/x86_64/ffs.S deleted file mode 100644 index c74c7010f54..00000000000 --- a/sys/lib/libkern/arch/x86_64/ffs.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: ffs.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") -#endif - -ENTRY(ffs) - bsfl %edi,%eax - jz L1 /* ZF is set if all bits are 0 */ - incl %eax /* bits numbered from 1, not 0 */ - ret - - _ALIGN_TEXT -L1: xorl %eax,%eax /* clear result */ - ret diff --git a/sys/lib/libkern/arch/x86_64/index.S b/sys/lib/libkern/arch/x86_64/index.S deleted file mode 100644 index 60754f266f0..00000000000 --- a/sys/lib/libkern/arch/x86_64/index.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: index.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") -#endif - -#ifdef STRCHR -ENTRY(strchr) -#else -ENTRY(index) -#endif - movq %rdi,%rax - movb %sil,%cl -L1: - movb (%rax),%dl - cmpb %dl,%cl /* found char? */ - je L2 - incq %rax - testb %dl,%dl /* null terminator? */ - jnz L1 - xorq %rax,%rax -L2: - ret diff --git a/sys/lib/libkern/arch/x86_64/memchr.S b/sys/lib/libkern/arch/x86_64/memchr.S deleted file mode 100644 index f978e760220..00000000000 --- a/sys/lib/libkern/arch/x86_64/memchr.S +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memchr.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") -#endif - -ENTRY(memchr) - movb %sil,%al /* set character to search for */ - movq %rdx,%rcx /* set length of search */ - testq %rcx,%rcx /* test for len == 0 */ - jz L1 - cld /* set search forward */ - repne /* search! */ - scasb - jne L1 /* scan failed, return null */ - leaq -1(%rdi),%rax /* adjust result of scan */ - ret -L1: xorq %rax,%rax - ret diff --git a/sys/lib/libkern/arch/x86_64/memcmp.S b/sys/lib/libkern/arch/x86_64/memcmp.S deleted file mode 100644 index 722a2a2c304..00000000000 --- a/sys/lib/libkern/arch/x86_64/memcmp.S +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memcmp.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") -#endif - -ENTRY(memcmp) - cld /* set compare direction forward */ - movq %rdx,%rcx /* compare by longs */ - shrq $3,%rcx - repe - cmpsq - jne L5 /* do we match so far? */ - - movq %rdx,%rcx /* compare remainder by bytes */ - andq $7,%rcx - repe - cmpsb - jne L6 /* do we match? */ - - xorl %eax,%eax /* we match, return zero */ - ret - -L5: movl $8,%ecx /* We know that one of the next */ - subq %rcx,%rdi /* eight pairs of bytes do not */ - subq %rcx,%rsi /* match. */ - repe - cmpsb -L6: xorl %eax,%eax /* Perform unsigned comparison */ - movb -1(%rdi),%al - xorl %edx,%edx - movb -1(%rsi),%dl - subl %edx,%eax - ret diff --git a/sys/lib/libkern/arch/x86_64/memcpy.S b/sys/lib/libkern/arch/x86_64/memcpy.S deleted file mode 100644 index c39caa328a3..00000000000 --- a/sys/lib/libkern/arch/x86_64/memcpy.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $ */ - -#define MEMCOPY -#include "bcopy.S" diff --git a/sys/lib/libkern/arch/x86_64/memmove.S b/sys/lib/libkern/arch/x86_64/memmove.S deleted file mode 100644 index f5b81357afa..00000000000 --- a/sys/lib/libkern/arch/x86_64/memmove.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $ */ - -#define MEMMOVE -#include "bcopy.S" diff --git a/sys/lib/libkern/arch/x86_64/memset.S b/sys/lib/libkern/arch/x86_64/memset.S deleted file mode 100644 index 2d92dc66534..00000000000 --- a/sys/lib/libkern/arch/x86_64/memset.S +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memset.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") -#endif - -ENTRY(memset) - movq %rsi,%rax - movq %rdx,%rcx - movq %rdi,%r11 - - cld /* set fill direction forward */ - - /* - * if the string is too short, it's really not worth the overhead - * of aligning to word boundries, etc. So we jump to a plain - * unaligned set. - */ - cmpq $0x0f,%rcx - jle L1 - - movb %al,%ah /* copy char to all bytes in word */ - movl %eax,%edx - sall $16,%eax - orl %edx,%eax - - movl %eax,%edx - salq $32,%rax - orq %rdx,%rax - - movq %rdi,%rdx /* compute misalignment */ - negq %rdx - andq $7,%rdx - movq %rcx,%r8 - subq %rdx,%r8 - - movq %rdx,%rcx /* set until word aligned */ - rep - stosb - - movq %r8,%rcx - shrq $3,%rcx /* set by words */ - rep - stosq - - movq %r8,%rcx /* set remainder by bytes */ - andq $7,%rcx -L1: rep - stosb - movq %r11,%rax - - ret diff --git a/sys/lib/libkern/arch/x86_64/ovbcopy.S b/sys/lib/libkern/arch/x86_64/ovbcopy.S deleted file mode 100644 index 71f2c9c8ddc..00000000000 --- a/sys/lib/libkern/arch/x86_64/ovbcopy.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $ */ - -#define OVBCOPY -#include "bcopy.S" diff --git a/sys/lib/libkern/arch/x86_64/rindex.S b/sys/lib/libkern/arch/x86_64/rindex.S deleted file mode 100644 index 6ba7c52a11f..00000000000 --- a/sys/lib/libkern/arch/x86_64/rindex.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: rindex.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") -#endif - -#ifdef STRRCHR -ENTRY(strrchr) -#else -ENTRY(rindex) -#endif - movb %sil,%cl - xorq %rax,%rax /* init pointer to null */ -L1: - movb (%rdi),%dl - cmpb %dl,%cl - jne L2 - movq %rdi,%rax -L2: - incq %rdi - testb %dl,%dl /* null terminator??? */ - jnz L1 - ret diff --git a/sys/lib/libkern/arch/x86_64/scanc.S b/sys/lib/libkern/arch/x86_64/scanc.S deleted file mode 100644 index fd4fd31e129..00000000000 --- a/sys/lib/libkern/arch/x86_64/scanc.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: scanc.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ - -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum. - * - * 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. - */ - -/* - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -ENTRY(scanc) - movq %rdx,%r11 - movb %cl,%dl - movl %edi,%ecx - testl %ecx,%ecx - jz 2f - movq %r11,%rdi - xorq %rax,%rax - cld -1: - lodsb - testb %dl,(%rax,%rdi) - jnz 2f - decl %ecx - jnz 1b -2: - movl %ecx,%eax - ret diff --git a/sys/lib/libkern/arch/x86_64/skpc.S b/sys/lib/libkern/arch/x86_64/skpc.S deleted file mode 100644 index f037d98b66a..00000000000 --- a/sys/lib/libkern/arch/x86_64/skpc.S +++ /dev/null @@ -1,56 +0,0 @@ -/* $NetBSD: skpc.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ - -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum. - * - * 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. - */ - -/* - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -ENTRY(skpc) - movl %edi,%eax - movq %rsi,%rcx - movq %rdx,%rdi - cld - repe - scasb - je 1f - incq %rcx -1: - movl %ecx,%eax - ret diff --git a/sys/lib/libkern/arch/x86_64/strcat.S b/sys/lib/libkern/arch/x86_64/strcat.S deleted file mode 100644 index 7dc71244312..00000000000 --- a/sys/lib/libkern/arch/x86_64/strcat.S +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcat.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") -#endif - -/* - * NOTE: I've unrolled the loop eight times: large enough to make a - * significant difference, and small enough not to totally trash the - * cache. - */ - -ENTRY(strcat) - movq %rdi,%r11 - - cld /* set search forward */ - xorl %eax,%eax /* set search for null terminator */ - movq $-1,%rcx /* set search for lots of characters */ - repne /* search! */ - scasb - - decq %rdi - -L1: movb (%rsi),%al /* unroll loop, but not too much */ - movb %al,(%rdi) - testb %al,%al - jz L2 - movb 1(%rsi),%al - movb %al,1(%rdi) - testb %al,%al - jz L2 - movb 2(%rsi),%al - movb %al,2(%rdi) - testb %al,%al - jz L2 - movb 3(%rsi),%al - movb %al,3(%rdi) - testb %al,%al - jz L2 - movb 4(%rsi),%al - movb %al,4(%rdi) - testb %al,%al - jz L2 - movb 5(%rsi),%al - movb %al,5(%rdi) - testb %al,%al - jz L2 - movb 6(%rsi),%al - movb %al,6(%rdi) - testb %al,%al - jz L2 - movb 7(%rsi),%al - movb %al,7(%rdi) - addq $8,%rsi - addq $8,%rdi - testb %al,%al - jnz L1 -L2: movq %r11,%rax - ret diff --git a/sys/lib/libkern/arch/x86_64/strchr.S b/sys/lib/libkern/arch/x86_64/strchr.S deleted file mode 100644 index 91fd708891f..00000000000 --- a/sys/lib/libkern/arch/x86_64/strchr.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: strchr.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ - -#define STRCHR -#include "index.S" diff --git a/sys/lib/libkern/arch/x86_64/strcmp.S b/sys/lib/libkern/arch/x86_64/strcmp.S deleted file mode 100644 index 559563666d4..00000000000 --- a/sys/lib/libkern/arch/x86_64/strcmp.S +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcmp.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") -#endif - -/* - * NOTE: I've unrolled the loop eight times: large enough to make a - * significant difference, and small enough not to totally trash the - * cache. - */ - -ENTRY(strcmp) - jmp L2 /* Jump into the loop. */ - -L1: incq %rdi - incq %rsi -L2: movb (%rdi),%cl - testb %cl,%cl /* null terminator */ - jz L3 - cmpb %cl,(%rsi) /* chars match */ - jne L3 - - incq %rdi - incq %rsi - movb (%rdi),%cl - testb %cl,%cl - jz L3 - cmpb %cl,(%rsi) - jne L3 - - incq %rdi - incq %rsi - movb (%rdi),%cl - testb %cl,%cl - jz L3 - cmpb %cl,(%rsi) - jne L3 - - incq %rdi - incq %rsi - movb (%rdi),%cl - testb %cl,%cl - jz L3 - cmpb %cl,(%rsi) - jne L3 - - incq %rdi - incq %rsi - movb (%rdi),%cl - testb %cl,%cl - jz L3 - cmpb %cl,(%rsi) - jne L3 - - incq %rdi - incq %rsi - movb (%rdi),%cl - testb %cl,%cl - jz L3 - cmpb %cl,(%rsi) - jne L3 - - incq %rdi - incq %rsi - movb (%rdi),%cl - testb %cl,%cl - jz L3 - cmpb %cl,(%rsi) - jne L3 - - incq %rdi - incq %rsi - movb (%rdi),%cl - testb %cl,%cl - jz L3 - cmpb %cl,(%rsi) - je L1 -L3: movzbl (%rdi),%eax /* unsigned comparison */ - movzbl (%rsi),%edx - subl %edx,%eax - ret diff --git a/sys/lib/libkern/arch/x86_64/strcpy.S b/sys/lib/libkern/arch/x86_64/strcpy.S deleted file mode 100644 index 924dfffd5be..00000000000 --- a/sys/lib/libkern/arch/x86_64/strcpy.S +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcpy.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") -#endif - -/* - * NOTE: I've unrolled the loop eight times: large enough to make a - * significant difference, and small enough not to totally trash the - * cache. - */ - -ENTRY(strcpy) - movq %rdi,%r11 - -L1: movb (%rsi),%al /* unroll loop, but not too much */ - movb %al,(%rdi) - testb %al,%al - jz L2 - movb 1(%rsi),%al - movb %al,1(%rdi) - testb %al,%al - jz L2 - movb 2(%rsi),%al - movb %al,2(%rdi) - testb %al,%al - jz L2 - movb 3(%rsi),%al - movb %al,3(%rdi) - testb %al,%al - jz L2 - movb 4(%rsi),%al - movb %al,4(%rdi) - testb %al,%al - jz L2 - movb 5(%rsi),%al - movb %al,5(%rdi) - testb %al,%al - jz L2 - movb 6(%rsi),%al - movb %al,6(%rdi) - testb %al,%al - jz L2 - movb 7(%rsi),%al - movb %al,7(%rdi) - addq $8,%rsi - addq $8,%rdi - testb %al,%al - jnz L1 -L2: movq %r11,%rax - ret diff --git a/sys/lib/libkern/arch/x86_64/strlen.S b/sys/lib/libkern/arch/x86_64/strlen.S deleted file mode 100644 index 3c85659391a..00000000000 --- a/sys/lib/libkern/arch/x86_64/strlen.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> - */ - -#include <machine/asm.h> - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strlen.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") -#endif - -ENTRY(strlen) - cld /* set search forward */ - xorl %eax,%eax /* set search for null terminator */ - movq $-1,%rcx /* set search for lots of characters */ - repne /* search! */ - scasb - notq %rcx /* get length by taking complement */ - leaq -1(%rcx),%rax /* and subtracting one */ - ret diff --git a/sys/lib/libkern/arch/x86_64/strrchr.S b/sys/lib/libkern/arch/x86_64/strrchr.S deleted file mode 100644 index 9b23edfb435..00000000000 --- a/sys/lib/libkern/arch/x86_64/strrchr.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: strrchr.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ - -#define STRRCHR -#include "rindex.S" diff --git a/sys/sys/exec_aout.h b/sys/sys/exec_aout.h index 24cd715d431..cbfcc8cc46b 100644 --- a/sys/sys/exec_aout.h +++ b/sys/sys/exec_aout.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_aout.h,v 1.18 2004/02/19 23:45:08 deraadt Exp $ */ +/* $OpenBSD: exec_aout.h,v 1.19 2004/02/27 17:36:16 deraadt Exp $ */ /* $NetBSD: exec_aout.h,v 1.15 1996/05/18 17:20:54 christos Exp $ */ /* @@ -82,7 +82,7 @@ struct exec { #define MID_MIPS2 152 /* MIPS2 */ #define MID_M88K 153 /* m88k BSD binary */ #define MID_HPPA 154 /* hppa */ -#define MID_X86_64 157 /* AMD x86-64 */ +#define MID_AMD64 157 /* AMD64 */ #define MID_HP200 200 /* hp200 (68010) BSD binary */ #define MID_HP300 300 /* hp300 (68020+68881) BSD binary */ #define MID_HPUX 0x20C /* hp200/300 HP-UX binary */ diff --git a/sys/sys/exec_elf.h b/sys/sys/exec_elf.h index b8b34374616..a936e15d087 100644 --- a/sys/sys/exec_elf.h +++ b/sys/sys/exec_elf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.h,v 1.38 2004/01/29 23:15:53 drahn Exp $ */ +/* $OpenBSD: exec_elf.h,v 1.39 2004/02/27 17:36:16 deraadt Exp $ */ /* * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved. * @@ -191,7 +191,7 @@ typedef struct { #define EM_ALPHA 41 /* DEC ALPHA */ #define EM_SPARCV9 43 /* SPARC version 9 */ #define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */ -#define EM_X86_64 62 /* AMD x86-64 architecture */ +#define EM_AMD64 62 /* AMD64 architecture */ #define EM_VAX 75 /* DEC VAX */ #define EM_NUM 15 /* number of machine types */ diff --git a/usr.bin/gprof/amd64.c b/usr.bin/gprof/amd64.c new file mode 100644 index 00000000000..4586923c014 --- /dev/null +++ b/usr.bin/gprof/amd64.c @@ -0,0 +1,7 @@ +#include "gprof.h" + +void +findcall(nltype *parentp, unsigned long p_lowpc, unsigned long p_highpc) +{ + /* not supported. */ +} diff --git a/lib/libc/arch/x86_64/gen/isinf.c b/usr.bin/gprof/amd64.h index 6d29660d7f2..0b2f9be56d5 100644 --- a/lib/libc/arch/x86_64/gen/isinf.c +++ b/usr.bin/gprof/amd64.h @@ -1,6 +1,6 @@ -/* $OpenBSD: isinf.c,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $OpenBSD: amd64.h,v 1.1 2004/02/27 17:36:17 deraadt Exp $ */ -/* +/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * @@ -31,21 +31,16 @@ * 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. + * + * @(#)sparc.h 8.1 (Berkeley) 6/6/93 */ -#if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: isinf.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <machine/ieee.h> - -int -isinf(d) - double d; -{ - struct ieee_double *p = (struct ieee_double *)&d; +/* + * offset (in bytes) of the code from the entry address of a routine. + * (see asgnsamples for use and explanation.) + */ +#define OFFSET_OF_CODE 0 +#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) - return (p->dbl_exp == DBL_EXP_INFNAN && - p->dbl_frach == 0 && p->dbl_fracl == 0); -} +enum opermodes { dummy }; +typedef enum opermodes operandenum; diff --git a/usr.bin/pmdb/arch/x86_64/Makefile.inc b/usr.bin/pmdb/arch/x86_64/Makefile.inc deleted file mode 100644 index f08e807d82d..00000000000 --- a/usr.bin/pmdb/arch/x86_64/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.1 2004/01/29 12:44:40 mickey Exp $ - -SRCS+= x86_64.c diff --git a/usr.bin/pmdb/arch/x86_64/pmdb_machdep.h b/usr.bin/pmdb/arch/x86_64/pmdb_machdep.h deleted file mode 100644 index 48c77bda09a..00000000000 --- a/usr.bin/pmdb/arch/x86_64/pmdb_machdep.h +++ /dev/null @@ -1,29 +0,0 @@ -/* $OpenBSD: pmdb_machdep.h,v 1.1 2004/01/29 12:44:40 mickey Exp $ */ -/* - * Copyright (c) 2002 Artur Grabowski <art@openbsd.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. 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 ``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. - */ - -#define BREAKPOINT { 0xcc } -#define BREAKPOINT_LEN 1 -#define BREAKPOINT_DECR_PC 1 diff --git a/usr.bin/pmdb/arch/x86_64/x86_64.c b/usr.bin/pmdb/arch/x86_64/x86_64.c deleted file mode 100644 index 4c27232328c..00000000000 --- a/usr.bin/pmdb/arch/x86_64/x86_64.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $OpenBSD: x86_64.c,v 1.2 2004/02/10 23:36:02 mickey Exp $ */ - -/* - * Copyright (c) 2002 Federico Schwindt <fgsch@openbsd.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. 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 ``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/param.h> -#include <sys/ptrace.h> -#include <machine/reg.h> -#include <machine/frame.h> -#include <string.h> -#include "pmdb.h" - -/* - * No frame for x86? - */ -struct frame { - long fp; - long pc; -}; - -static const char *md_reg_names[] = { - "%rdi", "%rsi", "%rdx", "%rcx", "%r8", "%r9", "%r10", "%r11", - "%r12", "%r13", "%r14", "%r15", "%rbp", "%rbx", "%rax", "%rsp", - "%rip", "%rflags", "%cs", "%ss", "%ds", "%es", "%fs", "%gs", -}; - -struct md_def md_def = { md_reg_names, 16, 8 }; - -void -md_def_init(void) -{ - /* no need to do anything */ -} - -int -md_getframe(struct pstate *ps, int frame, struct md_frame *fram) -{ - struct frame fr; - struct reg r; - int count; - - if (process_getregs(ps, &r) != 0) - return (-1); - - fr.fp = r.r_rbp; - fr.pc = r.r_rip; - for (count = 0; count < frame; count++) { - if (process_read(ps, fr.fp, &fr, sizeof(fr)) < 0) - return (-1); - - if (fr.pc < 0x1000) - return (-1); - } - - fram->pc = fr.pc; - fram->fp = fr.fp; - - return (0); -} - -int -md_getregs(struct pstate *ps, reg *regs) -{ - struct reg r; - - if (process_getregs(ps, &r) != 0) - return (-1); - - memcpy(regs, &r, sizeof(r)); - - return (0); -} diff --git a/usr.sbin/afs/lib/libarla/Makefile.lwp.inc b/usr.sbin/afs/lib/libarla/Makefile.lwp.inc index 3c83e8b30a8..46f3beb5858 100644 --- a/usr.sbin/afs/lib/libarla/Makefile.lwp.inc +++ b/usr.sbin/afs/lib/libarla/Makefile.lwp.inc @@ -20,7 +20,7 @@ process.S: HOST_CPU=${MACHINE_ARCH}; \ case "$$HOST_CPU" in \ arm) PROCESS_S="process.arm.S" ;; \ - x86_64) PROCESS_S="process.x86_64.S" ;; \ + amd64) PROCESS_S="process.x86_64.S" ;; \ sparc64) PROCESS_S="process.sparc.S" ;; \ sparc) PROCESS_S="process.sparc.S" ;; \ i*86*) PROCESS_S="process.i386.S" ;; \ diff --git a/usr.sbin/httpd/Makefile.bsd-wrapper b/usr.sbin/httpd/Makefile.bsd-wrapper index c9c41f6e69d..8da42cb6dd0 100644 --- a/usr.sbin/httpd/Makefile.bsd-wrapper +++ b/usr.sbin/httpd/Makefile.bsd-wrapper @@ -1,5 +1,5 @@ # Build wrapper for Apache -# $OpenBSD: Makefile.bsd-wrapper,v 1.45 2004/02/11 23:15:50 deraadt Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.46 2004/02/27 17:36:18 deraadt Exp $ # Our lndir is hacked; specify a full path to avoid potential conflicts # with the one installed with X11. @@ -100,7 +100,7 @@ INSTALL_MODULES= .if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "arm" || \ ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "m68k" || \ ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc" || \ - ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64" + ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64" CONFIG_ARGS+= ${DSO_MODULE_ARGS} INSTALL_MODULES= \ src/modules/experimental/mod_mmap_static.so \ diff --git a/usr.sbin/openssl/Makefile b/usr.sbin/openssl/Makefile index 0acdf585948..0413ca31177 100644 --- a/usr.sbin/openssl/Makefile +++ b/usr.sbin/openssl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2004/01/28 17:46:05 deraadt Exp $ +# $OpenBSD: Makefile,v 1.16 2004/02/27 17:36:18 deraadt Exp $ PROG= openssl LDADD= -lssl -lcrypto @@ -9,8 +9,8 @@ SSLEAYDIST= lib/libssl/src SSLEAY_SRC= ${.CURDIR}/../../${SSLEAYDIST}/apps SSLEAY_SRC_TOP= ${.CURDIR}/../../${SSLEAYDIST} -.if (${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "x86_64") || \ - (${MACHINE_ARCH} == "vax") +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "vax" || \ + ${MACHINE_ARCH} == "amd64" CFLAGS+= -DL_ENDIAN .else |