jcs's openbsd hax
openbsd

change amd64's MACHINE_ARCH from x86_64 to amd64. There are many many reasons for this, quite a few of them technical, and not all of them in response to Intel's broken ia32e crud. The gcc toolchain stays at x86_64 for now.

deraadt 77fd8a68 a55fba47

+270 -4307
+2 -4
Makefile
··· 1 - # $OpenBSD: Makefile,v 1.99 2004/02/01 06:16:50 brad Exp $ 1 + # $OpenBSD: Makefile,v 1.100 2004/02/27 17:36:11 deraadt Exp $ 2 2 3 3 # 4 4 # For more information on building in tricky environments, please see ··· 128 128 ${CROSSDIRS}: 129 129 @-mkdir -p ${CROSSDIR} 130 130 @case ${TARGET} in \ 131 - alpha|hppa|i386|m68k|m88k|powerpc|sparc|sparc64|vax) \ 131 + alpha|hppa|i386|m68k|m88k|powerpc|sparc|sparc64|vax|amd64) \ 132 132 echo ${TARGET} ;;\ 133 133 amiga|hp300|mac68k|mvme68k) \ 134 134 echo m68k ;;\ ··· 138 138 echo powerpc ;;\ 139 139 sgi) \ 140 140 echo mips ;;\ 141 - amd64) \ 142 - echo x86_64 ;;\ 143 141 *) \ 144 142 (echo Unknown arch ${TARGET} >&2) ; exit 1;; \ 145 143 esac > ${CROSSDIR}/TARGET_ARCH
+2 -2
distrib/special/kbd/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.7 2004/02/07 21:07:16 deraadt Exp $ 1 + # $OpenBSD: Makefile,v 1.8 2004/02/27 17:36:14 deraadt Exp $ 2 2 3 3 .if (${MACHINE} == "alpha") || (${MACHINE} == "hppa") || \ 4 4 (${MACHINE} == "i386") || (${MACHINE} == "macppc") || \ 5 5 (${MACHINE} == "sparc") || (${MACHINE} == "sparc64") || \ 6 - (${MACHINE} == "vax") || (${MACHINE_ARCH} == "x86_64") || \ 6 + (${MACHINE} == "vax") || (${MACHINE} == "amd64") || \ 7 7 (${MACHINE} == "cats") || (${MACHINE} == "pegasos") 8 8 PROG= kbd 9 9 COPTS+= -Os
+4 -4
etc/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.199 2004/02/16 19:03:30 miod Exp $ 1 + # $OpenBSD: Makefile,v 1.200 2004/02/27 17:36:13 deraadt Exp $ 2 2 3 3 TZDIR= /usr/share/zoneinfo 4 4 LOCALTIME= Canada/Mountain ··· 25 25 .if ${MACHINE} == "alpha" || ${MACHINE} == "hppa" || \ 26 26 ${MACHINE} == "i386" || ${MACHINE} == "macppc" || \ 27 27 ${MACHINE} == "pegasos" || ${MACHINE} == "sparc" || \ 28 - ${MACHINE} == "sparc64" || ${MACHINE_ARCH} == "x86_64" || \ 29 - ${MACHINE} == "cats" 28 + ${MACHINE} == "sparc64" || ${MACHINE} == "amd64" || \ 29 + ${MACHINE} == "cats" || 30 30 BIN1+= wsconsctl.conf 31 31 .endif 32 32 ··· 377 377 DHSIZE=1024 1536 2048 3072 4096 378 378 update-moduli: 379 379 ( \ 380 - echo '# $$OpenBSD: Makefile,v 1.199 2004/02/16 19:03:30 miod Exp $$'; \ 380 + echo '# $$OpenBSD: Makefile,v 1.200 2004/02/27 17:36:13 deraadt Exp $$'; \ 381 381 echo '# Time Type Tests Tries Size Generator Modulus'; \ 382 382 ( for i in ${DHSIZE}; do \ 383 383 ssh-keygen -b $$i -G /dev/stdout; \
+2 -2
lib/csu/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.11 2004/02/01 07:21:56 drahn Exp $ 1 + # $OpenBSD: Makefile,v 1.12 2004/02/27 17:36:14 deraadt Exp $ 2 2 3 3 .if make(obj) 4 - SUBDIR= alpha arm hppa i386 m68k m88k powerpc sparc sparc64 vax x86_64 4 + SUBDIR= alpha arm hppa i386 m68k m88k powerpc sparc sparc64 vax amd64 5 5 .else 6 6 SUBDIR= ${MACHINE_ARCH} 7 7 .endif
-61
lib/csu/x86_64/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.1 2004/01/28 01:46:17 mickey Exp $ 2 - 3 - CFLAGS+= -DLIBC_SCCS -fno-omit-frame-pointer 4 - OBJS= crt0.o gcrt0.o crtbegin.o crtend.o crtbeginS.o crtendS.o 5 - SRCS= crt0.c crtbegin.c crtbeginS.c crtend.c crtendS.c 6 - 7 - ELFDIR= ${.CURDIR}/../common_elf 8 - .PATH: ${ELFDIR} 9 - CFLAGS+= -I${ELFDIR} -I${.CURDIR} 10 - 11 - PICFLAG?=-fpic 12 - 13 - all: ${OBJS} 14 - 15 - crt0.o: crt0.c 16 - @echo ${COMPILE.c} -DCRT0 ${.CURDIR}/crt0.c -o ${.TARGET} 17 - @${COMPILE.c} -DCRT0 ${.CURDIR}/crt0.c -o ${.TARGET}.o 18 - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o 19 - @rm -f ${.TARGET}.o 20 - 21 - gcrt0.o: crt0.c 22 - @echo ${COMPILE.c} -DMCRT0 ${.CURDIR}/crt0.c -o ${.TARGET} 23 - @${COMPILE.c} -DMCRT0 ${.CURDIR}/crt0.c -o ${.TARGET}.o 24 - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o 25 - @rm -f ${.TARGET}.o 26 - 27 - crtbegin.o: crtbegin.c 28 - @echo ${COMPILE.c} ${ELFDIR}/crtbegin.c -o ${.TARGET} 29 - @${COMPILE.c} ${ELFDIR}/crtbegin.c -o ${.TARGET}.o 30 - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o 31 - @rm -f ${.TARGET}.o 32 - 33 - crtbeginS.o: crtbeginS.c 34 - @echo ${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtbeginS.c -o ${.TARGET} 35 - @${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtbeginS.c -o ${.TARGET}.o 36 - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o 37 - @rm -f ${.TARGET}.o 38 - 39 - crtend.o: crtend.c 40 - @echo ${COMPILE.c} ${ELFDIR}/crtend.c -o ${.TARGET} 41 - @${COMPILE.c} ${ELFDIR}/crtend.c -o ${.TARGET}.o 42 - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o 43 - @rm -f ${.TARGET}.o 44 - 45 - crtendS.o: crtendS.c 46 - @echo ${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtendS.c -o ${.TARGET} 47 - @${COMPILE.c} ${PICFLAG} ${ELFDIR}/crtendS.c -o ${.TARGET}.o 48 - @${LD} -x -r -o ${.TARGET} ${.TARGET}.o 49 - @rm -f ${.TARGET}.o 50 - 51 - realinstall: 52 - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 ${OBJS} \ 53 - ${DESTDIR}/usr/lib 54 - 55 - afterdepend: .depend 56 - @(TMP=/tmp/_depend$$$$; \ 57 - sed -e 's/^\([^\.]*\).o[ ]*:/\1.o g\1.o:/' \ 58 - < .depend > $$TMP; \ 59 - mv $$TMP .depend) 60 - 61 - .include <bsd.prog.mk>
-128
lib/csu/x86_64/crt0.c
··· 1 - /* $OpenBSD: crt0.c,v 1.1 2004/01/28 01:46:17 mickey Exp $ */ 2 - /* 3 - * Copyright (c) 1995 Christopher G. Demetriou 4 - * All rights reserved. 5 - * 6 - * Redistribution and use in source and binary forms, with or without 7 - * modification, are permitted provided that the following conditions 8 - * are met: 9 - * 1. Redistributions of source code must retain the above copyright 10 - * notice, this list of conditions and the following disclaimer. 11 - * 2. Redistributions in binary form must reproduce the above copyright 12 - * notice, this list of conditions and the following disclaimer in the 13 - * documentation and/or other materials provided with the distribution. 14 - * 3. All advertising materials mentioning features or use of this software 15 - * must display the following acknowledgement: 16 - * This product includes software developed by Christopher G. Demetriou 17 - * for the NetBSD Project. 18 - * 4. The name of the author may not be used to endorse or promote products 19 - * derived from this software without specific prior written permission 20 - * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 - */ 32 - 33 - #if defined(LIBC_SCCS) && !defined(lint) 34 - static char rcsid[] = "$OpenBSD: crt0.c,v 1.1 2004/01/28 01:46:17 mickey Exp $"; 35 - #endif /* LIBC_SCCS and not lint */ 36 - 37 - #include <sys/param.h> 38 - #include <stdlib.h> 39 - 40 - static char *_strrchr(char *, char); 41 - 42 - char **environ; 43 - char *__progname = ""; 44 - 45 - char __progname_storage[NAME_MAX+1]; 46 - 47 - #ifdef MCRT0 48 - extern void monstartup(u_long, u_long); 49 - extern void _mcleanup(void); 50 - extern unsigned char _etext, _eprol; 51 - #endif /* MCRT0 */ 52 - 53 - __asm(" .text ;\ 54 - .align 8 ;\ 55 - .globl __start ;\ 56 - .globl _start ;\ 57 - _start: ;\ 58 - __start: ;\ 59 - movq %rbx,%r9 ;\ 60 - movq %rcx,%r8 ;\ 61 - movq %rdx,%rcx ;\ 62 - movq (%rsp),%rdi ;\ 63 - leaq 16(%rsp,%rdi,8),%rdx ;\ 64 - leaq 8(%rsp),%rsi ;\ 65 - subq $8,%rsp ;\ 66 - andq $~15,%rsp ;\ 67 - addq $8,%rsp ;\ 68 - jmp ___start ;\ 69 - "); 70 - 71 - void 72 - ___start(argc, argv, envp, cleanup, obj, ps_strings) 73 - int argc; 74 - char **argv; 75 - char ** envp; 76 - void (*cleanup)(void); /* from shared loader */ 77 - const void *obj; /* from shared loader */ 78 - struct ps_strings *ps_strings; 79 - { 80 - char *namep; 81 - register struct kframe *kfp; 82 - char *s; 83 - 84 - environ = envp; 85 - 86 - if ((namep = argv[0]) != NULL) { /* NULL ptr if argc = 0 */ 87 - if ((__progname = _strrchr(namep, '/')) == NULL) 88 - __progname = namep; 89 - else 90 - ++__progname; 91 - for (s = __progname_storage; *__progname && 92 - s < &__progname_storage[sizeof __progname_storage - 1]; ) 93 - *s++ = *__progname++; 94 - *s = '\0'; 95 - __progname = __progname_storage; 96 - } 97 - 98 - #ifdef MCRT0 99 - atexit(_mcleanup); 100 - monstartup((u_long)&_eprol, (u_long)&_etext); 101 - #endif 102 - 103 - __init(); 104 - 105 - exit(main(argc, argv, environ)); 106 - } 107 - 108 - 109 - static char * 110 - _strrchr(p, ch) 111 - register char *p, ch; 112 - { 113 - register char *save; 114 - 115 - for (save = NULL;; ++p) { 116 - if (*p == ch) 117 - save = (char *)p; 118 - if (!*p) 119 - return(save); 120 - } 121 - /* NOTREACHED */ 122 - } 123 - 124 - #ifdef MCRT0 125 - asm (" .text"); 126 - asm ("_eprol:"); 127 - #endif 128 -
-61
lib/csu/x86_64/md_init.h
··· 1 - /* $OpenBSD: md_init.h,v 1.1 2004/01/28 01:46:17 mickey Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 2001 Ross Harvey 5 - * All rights reserved. 6 - * 7 - * Redistribution and use in source and binary forms, with or without 8 - * modification, are permitted provided that the following conditions 9 - * are met: 10 - * 1. Redistributions of source code must retain the above copyright 11 - * notice, this list of conditions and the following disclaimer. 12 - * 2. Redistributions in binary form must reproduce the above copyright 13 - * notice, this list of conditions and the following disclaimer in the 14 - * documentation and/or other materials provided with the distribution. 15 - * 3. All advertising materials mentioning features or use of this software 16 - * must display the following acknowledgement: 17 - * This product includes software developed by the NetBSD 18 - * Foundation, Inc. and its contributors. 19 - * 4. Neither the name of The NetBSD Foundation nor the names of its 20 - * contributors may be used to endorse or promote products derived 21 - * from this software without specific prior written permission. 22 - * 23 - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 24 - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 27 - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 - * POSSIBILITY OF SUCH DAMAGE. 34 - */ 35 - 36 - #define MD_SECT_CALL_FUNC(section, func) \ 37 - __asm (".section "#section", \"ax\"\n" \ 38 - " call " #func "\n" \ 39 - " .previous") 40 - 41 - /* 42 - * Align is after because we want the function to start at the first 43 - * address of the section, but overall we want the section to be 44 - * aligned by the align amount. 45 - */ 46 - #define MD_SECTION_PROLOGUE(sect, entry_pt) \ 47 - __asm ( \ 48 - ".section "#sect",\"ax\",@progbits \n" \ 49 - " .globl " #entry_pt " \n" \ 50 - " .type " #entry_pt ",@function \n" \ 51 - #entry_pt": \n" \ 52 - " .align 16 \n" \ 53 - " /* fall thru */ \n" \ 54 - " .previous") 55 - 56 - 57 - #define MD_SECTION_EPILOGUE(sect) \ 58 - __asm ( \ 59 - ".section "#sect",\"ax\",@progbits \n" \ 60 - " ret \n" \ 61 - " .previous")
+2 -2
lib/libarch/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.5 2004/02/26 00:11:05 deraadt Exp $ 1 + # $OpenBSD: Makefile,v 1.6 2004/02/27 17:36:14 deraadt Exp $ 2 2 # $NetBSD: Makefile,v 1.8 1996/02/21 02:43:52 jtk Exp $ 3 3 4 - SUBDIR= alpha i386 x86_64 4 + SUBDIR= alpha i386 amd64 5 5 6 6 .include <bsd.subdir.mk>
+3 -3
lib/libarch/amd64/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.1 2004/02/26 00:10:54 deraadt Exp $ 1 + # $OpenBSD: Makefile,v 1.2 2004/02/27 17:36:14 deraadt Exp $ 2 2 # $NetBSD: Makefile,v 1.1 1996/02/21 02:45:47 jtk Exp $ 3 3 4 4 MAN+= x86_64_get_ldt.2 \ ··· 7 7 MLINKS+=x86_64_get_ldt.2 x86_64_set_ldt.2 \ 8 8 x86_64_get_ioperm.2 x86_64_set_ioperm.2 9 9 10 - .if ${MACHINE_ARCH} == "x86_64" 11 - .PATH: ${LIBC}/x86_64 10 + .if ${MACHINE_ARCH} == "amd64" 11 + .PATH: ${LIBC}/amd64 12 12 NOPIC= 13 13 SRCS+= x86_64_get_ldt.c x86_64_set_ldt.c \ 14 14 x86_64_iopl.c x86_64_get_ioperm.c x86_64_set_ioperm.c
+2 -2
lib/libc/arch/amd64/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:44 mickey Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.2 2004/02/27 17:36:14 deraadt Exp $ 2 2 3 - KMINCLUDES= arch/x86_64/SYS.h 3 + KMINCLUDES= arch/amd64/SYS.h 4 4 KMSRCS= bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlen.S \ 5 5 htonl.S htons.S ntohl.S ntohs.S
-5
lib/libc/arch/x86_64/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:44 mickey Exp $ 2 - 3 - KMINCLUDES= arch/x86_64/SYS.h 4 - KMSRCS= bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlen.S \ 5 - htonl.S htons.S ntohl.S ntohs.S
-135
lib/libc/arch/x86_64/SYS.h
··· 1 - /* $OpenBSD: SYS.h,v 1.3 2004/02/22 21:28:21 miod Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 1990 The Regents of the University of California. 5 - * All rights reserved. 6 - * 7 - * This code is derived from software contributed to Berkeley by 8 - * William Jolitz. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed by the University of 21 - * California, Berkeley and its contributors. 22 - * 4. Neither the name of the University nor the names of its contributors 23 - * may be used to endorse or promote products derived from this software 24 - * without specific prior written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 - * SUCH DAMAGE. 37 - * 38 - * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91 39 - * $NetBSD: SYS.h,v 1.5 2002/06/03 18:30:32 fvdl Exp $ 40 - */ 41 - 42 - /* 43 - * XXXfvdl change to use syscall/sysret. 44 - */ 45 - 46 - #include <machine/asm.h> 47 - #include <sys/syscall.h> 48 - 49 - #ifdef __STDC__ 50 - 51 - #define SYSTRAP(x) movl $(SYS_ ## x),%eax; movq %rcx, %r10; syscall 52 - #define OSYSTRAP(x) movl $(SYS_ ## x),%eax; int $0x80 53 - #define SYSENTRY(x) \ 54 - ENTRY(_thread_sys_ ## x); \ 55 - .weak _C_LABEL(x); \ 56 - _C_LABEL(x) = _C_LABEL(_thread_sys_ ## x) 57 - #else 58 - 59 - #define SYSTRAP(x) movl $(SYS_/**/x),%eax; movq %rcx, %r10; syscall 60 - #define OSYSTRAP(x) movl $(SYS_/**/x),%eax; int $0x80 61 - #define SYSENTRY(x) \ 62 - ENTRY(_thread_sys_/**/x); \ 63 - .weak _C_LABEL(x); \ 64 - _C_LABEL(x) = _C_LABEL(_thread_sys_/**/x) 65 - 66 - #endif 67 - 68 - #define CERROR _C_LABEL(__cerror) 69 - #define CURBRK _C_LABEL(__curbrk) 70 - 71 - #define _SYSCALL_NOERROR(x,y) \ 72 - SYSENTRY(x); \ 73 - SYSTRAP(y) 74 - 75 - #define _OSYSCALL_NOERROR(x,y) \ 76 - SYSENTRY(x); \ 77 - OSYSTRAP(y) 78 - 79 - #ifdef PIC 80 - #define _SYSCALL(x,y) \ 81 - .text; _ALIGN_TEXT; \ 82 - 2: mov PIC_GOT(CERROR), %rcx; \ 83 - jmp *%rcx; \ 84 - _SYSCALL_NOERROR(x,y); \ 85 - jc 2b 86 - #define _OSYSCALL(x,y) \ 87 - .text; _ALIGN_TEXT; \ 88 - 2: mov PIC_GOT(CERROR), %rcx; \ 89 - jmp *%rcx; \ 90 - _OSYSCALL_NOERROR(x,y); \ 91 - jc 2b 92 - #else 93 - #define _SYSCALL(x,y) \ 94 - .text; _ALIGN_TEXT; \ 95 - 2: jmp CERROR; \ 96 - _SYSCALL_NOERROR(x,y); \ 97 - jc 2b 98 - #define _OSYSCALL(x,y) \ 99 - .text; _ALIGN_TEXT; \ 100 - 2: jmp CERROR; \ 101 - _OSYSCALL_NOERROR(x,y); \ 102 - jc 2b 103 - #endif 104 - 105 - #define SYSCALL_NOERROR(x) \ 106 - _SYSCALL_NOERROR(x,x) 107 - 108 - #define OSYSCALL_NOERROR(x) \ 109 - _OSYSCALL_NOERROR(x,x) 110 - 111 - #define SYSCALL(x) \ 112 - _SYSCALL(x,x) 113 - 114 - #define OSYSCALL(x) \ 115 - _OSYSCALL(x,x) 116 - 117 - #define PSEUDO_NOERROR(x,y) \ 118 - _SYSCALL_NOERROR(x,y); \ 119 - ret 120 - 121 - #define PSEUDO(x,y) \ 122 - _SYSCALL(x,y); \ 123 - ret 124 - 125 - #define RSYSCALL_NOERROR(x) \ 126 - PSEUDO_NOERROR(x,x) 127 - 128 - #define RSYSCALL(x) \ 129 - PSEUDO(x,x) 130 - 131 - #define WSYSCALL(weak,strong) \ 132 - WEAK_ALIAS(weak,strong); \ 133 - PSEUDO(strong,weak) 134 - 135 - .globl CERROR
-7
lib/libc/arch/x86_64/gen/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:44 mickey Exp $ 2 - 3 - SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c \ 4 - modf.S setjmp.S sigsetjmp.S 5 - SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S fpsetmask.S \ 6 - fpsetround.S fpsetsticky.S 7 -
-82
lib/libc/arch/x86_64/gen/_setjmp.S
··· 1 - /* $OpenBSD: _setjmp.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: _setjmp.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ 3 - 4 - /* 5 - * Copyright (c) 2001 Wasabi Systems, Inc. 6 - * All rights reserved. 7 - * 8 - * Written by Frank van der Linden for Wasabi Systems, Inc. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed for the NetBSD Project by 21 - * Wasabi Systems, Inc. 22 - * 4. The name of Wasabi Systems, Inc. may not be used to endorse 23 - * or promote products derived from this software without specific prior 24 - * written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 27 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 30 - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 - * POSSIBILITY OF SUCH DAMAGE. 37 - */ 38 - 39 - 40 - #include <machine/asm.h> 41 - #include <machine/setjmp.h> 42 - 43 - /* 44 - * C library -- _setjmp, _longjmp 45 - * 46 - * _longjmp(a,v) 47 - * will generate a "return(v)" from the last call to 48 - * _setjmp(a) 49 - * by restoring registers from the stack. 50 - * The previous signal state is NOT restored. 51 - */ 52 - 53 - ENTRY(_setjmp) 54 - movq (%rsp),%r11 55 - movq %rbx,(_JB_RBX * 8)(%rdi) 56 - movq %rbp,(_JB_RBP * 8)(%rdi) 57 - movq %r12,(_JB_R12 * 8)(%rdi) 58 - movq %r13,(_JB_R13 * 8)(%rdi) 59 - movq %r14,(_JB_R14 * 8)(%rdi) 60 - movq %r15,(_JB_R15 * 8)(%rdi) 61 - movq %rsp,(_JB_RSP * 8)(%rdi) 62 - movq %r11,(_JB_PC * 8)(%rdi) 63 - 64 - xorl %eax,%eax 65 - ret 66 - 67 - ENTRY(_longjmp) 68 - movq (_JB_RBX * 8)(%rdi),%rbx 69 - movq (_JB_RBP * 8)(%rdi),%rbp 70 - movq (_JB_R12 * 8)(%rdi),%r12 71 - movq (_JB_R13 * 8)(%rdi),%r13 72 - movq (_JB_R14 * 8)(%rdi),%r14 73 - movq (_JB_R15 * 8)(%rdi),%r15 74 - movq (_JB_RSP * 8)(%rdi),%rsp 75 - movq (_JB_PC * 8)(%rdi),%r11 76 - 77 - movl %esi,%eax 78 - testl %eax,%eax 79 - jnz 1f 80 - incl %eax 81 - 1: movq %r11,0(%rsp) 82 - ret
-13
lib/libc/arch/x86_64/gen/alloca.S
··· 1 - /* $OpenBSD: alloca.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: alloca.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ 3 - 4 - #include <machine/asm.h> 5 - 6 - ENTRY(alloca) 7 - popq %rdx 8 - movq %rsp,%rcx 9 - addq $15,%rdi /* round up to 16 bytes */ 10 - andq $~15,%rdi 11 - subq %rdi,%rsp 12 - movq %rsp,%rax 13 - jmp *%rdx
-17
lib/libc/arch/x86_64/gen/fabs.S
··· 1 - /* $OpenBSD: fabs.S,v 1.2 2004/02/08 17:29:57 deraadt Exp $ */ 2 - /* $NetBSD: fabs.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ 3 - 4 - #include <machine/asm.h> 5 - 6 - /* 7 - * Ok, this sucks. Is there really no way to push an xmm register onto 8 - * the FP stack directly? 9 - */ 10 - 11 - ENTRY(fabs) 12 - movsd %xmm0, -8(%rsp) 13 - fldl -8(%rsp) 14 - fabs 15 - fstpl -8(%rsp) 16 - movsd -8(%rsp),%xmm0 17 - ret
-30
lib/libc/arch/x86_64/gen/flt_rounds.S
··· 1 - /* $OpenBSD: flt_rounds.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: flt_rounds.S,v 1.2 2002/06/06 23:04:35 fvdl Exp $ */ 3 - 4 - /* 5 - * Written by J.T. Conklin, Apr 4, 1995 6 - * Public domain. 7 - */ 8 - 9 - #include <machine/asm.h> 10 - 11 - .text 12 - _ALIGN_TEXT 13 - _map: 14 - .byte 1 /* round to nearest */ 15 - .byte 3 /* round to negative infinity */ 16 - .byte 2 /* round to positive infinity */ 17 - .byte 0 /* round to zero */ 18 - 19 - ENTRY(__flt_rounds) 20 - fnstcw -4(%rsp) 21 - movl -4(%rsp),%eax 22 - shrl $10,%eax 23 - andl $3,%eax 24 - #ifdef PIC 25 - leaq PIC_GOT(_map),%rcx 26 - movb (%rcx,%rax,1),%al 27 - #else 28 - movb _map(,%rax,1),%al 29 - #endif 30 - ret
-27
lib/libc/arch/x86_64/gen/fpgetmask.S
··· 1 - /* $OpenBSD: fpgetmask.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: fpgetmask.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ 3 - 4 - /* 5 - * Written by J.T. Conklin, Apr 4, 1995 6 - * Public domain. 7 - */ 8 - 9 - #include <machine/asm.h> 10 - 11 - /* 12 - * XXX only read x87 control word here. If an application only 13 - * uses the fp* interface to manipulate FP bits, it should 14 - * always remain in sync with the SSE mxcsr register. 15 - */ 16 - 17 - #ifdef WEAK_ALIAS 18 - WEAK_ALIAS(fpgetmask, _fpgetmask) 19 - ENTRY(_fpgetmask) 20 - #else 21 - ENTRY(fpgetmask) 22 - #endif 23 - fnstcw -4(%rsp) 24 - movl -4(%rsp),%eax 25 - notl %eax 26 - andl $63,%eax 27 - ret
-26
lib/libc/arch/x86_64/gen/fpgetround.S
··· 1 - /* $OpenBSD: fpgetround.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: fpgetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ 3 - 4 - /* 5 - * Written by J.T. Conklin, Apr 4, 1995 6 - * Public domain. 7 - */ 8 - 9 - #include <machine/asm.h> 10 - 11 - /* 12 - * XXX store only x87 state. If an application only uses the fp* 13 - * interface, this should be in sync with the SSE mxcsr register. 14 - */ 15 - 16 - #ifdef WEAK_ALIAS 17 - WEAK_ALIAS(fpgetround, _fpgetround) 18 - ENTRY(_fpgetround) 19 - #else 20 - ENTRY(fpgetround) 21 - #endif 22 - fnstcw -4(%rsp) 23 - movl -4(%rsp),%eax 24 - rorl $10,%eax 25 - andl $3,%eax 26 - ret
-28
lib/libc/arch/x86_64/gen/fpgetsticky.S
··· 1 - /* $OpenBSD: fpgetsticky.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: fpgetsticky.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ 3 - 4 - /* 5 - * Written by Frank van der Linden at Wasabi Systems for NetBSD. 6 - * Public domain. 7 - * 8 - */ 9 - 10 - #include <machine/asm.h> 11 - 12 - /* 13 - * XXX read both the x87 and SSE status words here, and OR 14 - * them to get a complete picture of exceptions. 15 - */ 16 - 17 - #ifdef WEAK_ALIAS 18 - WEAK_ALIAS(fpgetsticky, _fpgetsticky) 19 - ENTRY(_fpgetsticky) 20 - #else 21 - ENTRY(fpgetsticky) 22 - #endif 23 - fnstsw -4(%rsp) 24 - stmxcsr -8(%rsp) 25 - movl -4(%rsp),%eax 26 - orl -8(%rsp),%eax 27 - andl $63,%eax 28 - ret
-42
lib/libc/arch/x86_64/gen/fpsetmask.S
··· 1 - /* $OpenBSD: fpsetmask.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: fpsetmask.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ 3 - 4 - /* 5 - * Written by Frank van der Linden at Wasabi Systems for NetBSD. 6 - * Public domain. 7 - */ 8 - 9 - #include <machine/asm.h> 10 - 11 - /* 12 - * XXX set both the x87 control word and the SSE mxcsr register. 13 - * Applications should only set exception and round flags 14 - * via the fp*() interface, otherwise the status words 15 - * will get our of sync. 16 - */ 17 - 18 - #ifdef WEAK_ALIAS 19 - WEAK_ALIAS(fpsetmask, _fpsetmask) 20 - ENTRY(_fpsetmask) 21 - #else 22 - ENTRY(fpsetmask) 23 - #endif 24 - fnstcw -4(%rsp) 25 - stmxcsr -8(%rsp) 26 - andl $63,%edi 27 - notl %edi 28 - 29 - movl -4(%rsp),%edx 30 - movl %edx,%eax 31 - andl %edi,%edx 32 - movl %edx,-4(%rsp) 33 - 34 - movl -8(%rsp),%edx 35 - roll $7,%edi 36 - andl %edi,%edx 37 - movl %edx,-8(%rsp) 38 - 39 - fldcw -4(%rsp) 40 - ldmxcsr -8(%rsp) 41 - andl $63,%eax 42 - ret
-49
lib/libc/arch/x86_64/gen/fpsetround.S
··· 1 - /* $OpenBSD: fpsetround.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: fpsetround.S,v 1.3 2002/06/12 19:17:22 fvdl Exp $ */ 3 - 4 - /* 5 - * Written by Frank van der Linden at Wasabi Systems for NetBSD. 6 - * Public domain. 7 - */ 8 - 9 - #include <machine/asm.h> 10 - 11 - /* 12 - * XXX set both the x87 control word and the SSE mxcsr register. 13 - * Applications should only set exception and round flags 14 - * via the fp*() interface, otherwise the status words 15 - * will get our of sync. 16 - */ 17 - 18 - 19 - #ifdef WEAK_ALIAS 20 - WEAK_ALIAS(fpsetround, _fpsetround) 21 - ENTRY(_fpsetround) 22 - #else 23 - ENTRY(fpsetround) 24 - #endif 25 - fnstcw -4(%rsp) 26 - stmxcsr -8(%rsp) 27 - 28 - andl $3,%edi 29 - 30 - movl -4(%rsp),%edx 31 - rorl $10,%edx 32 - movl %edx,%eax 33 - andl $3,%eax 34 - 35 - andl $~3,%edx 36 - orl %edi,%edx 37 - roll $10,%edx 38 - movl %edx,-4(%rsp) 39 - 40 - movl -8(%rsp),%edx 41 - rorl $13,%edx 42 - andl $~3,%edx 43 - orl %edi,%edx 44 - roll $13,%edx 45 - movl %edx,-8(%rsp) 46 - 47 - ldmxcsr -8(%rsp) 48 - fldcw -4(%rsp) 49 - ret
-43
lib/libc/arch/x86_64/gen/fpsetsticky.S
··· 1 - /* $OpenBSD: fpsetsticky.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: fpsetsticky.S,v 1.3 2002/06/12 19:17:23 fvdl Exp $ */ 3 - 4 - /* 5 - * Written by Frank van der Linden at Wasabi Systems for NetBSD 6 - * Public domain. 7 - */ 8 - 9 - #include <machine/asm.h> 10 - 11 - /* 12 - * XXX set both the x87 status word and the SSE mxcsr register. 13 - * Applications should only set exception and round flags 14 - * via the fp*() interface, otherwise the status words 15 - * will get our of sync. 16 - */ 17 - 18 - 19 - #ifdef WEAK_ALIAS 20 - WEAK_ALIAS(fpsetsticky, _fpsetsticky) 21 - ENTRY(_fpsetsticky) 22 - #else 23 - ENTRY(fpsetsticky) 24 - #endif 25 - fnstenv -28(%rsp) 26 - stmxcsr -32(%rsp) 27 - 28 - andl $63,%edi 29 - 30 - movl -24(%rsp),%eax 31 - movl %eax,%edx 32 - andl $63,%eax 33 - 34 - orl %edi,%edx 35 - movl %edx,-24(%rsp) 36 - 37 - movl -32(%rsp),%edx 38 - orl %edi,%edx 39 - movl %edx,-32(%rsp) 40 - 41 - ldmxcsr -32(%rsp) 42 - fldenv -28(%rsp) 43 - ret
-74
lib/libc/arch/x86_64/gen/frexp.c
··· 1 - /* $OpenBSD: frexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 1992, 1993 5 - * The Regents of the University of California. All rights reserved. 6 - * 7 - * This software was developed by the Computer Systems Engineering group 8 - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 9 - * contributed to Berkeley. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. Neither the name of the University nor the names of its contributors 20 - * may be used to endorse or promote products derived from this software 21 - * without specific prior written permission. 22 - * 23 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 - * SUCH DAMAGE. 34 - */ 35 - 36 - #if defined(LIBC_SCCS) && !defined(lint) 37 - static char rcsid[] = "$OpenBSD: frexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; 38 - #endif /* LIBC_SCCS and not lint */ 39 - 40 - #include <sys/types.h> 41 - #include <machine/ieee.h> 42 - 43 - /* 44 - * Split the given value into a fraction in the range [0.5, 1.0) and 45 - * an exponent, such that frac * (2^exp) == value. If value is 0, 46 - * return 0. 47 - */ 48 - double 49 - frexp(value, eptr) 50 - double value; 51 - int *eptr; 52 - { 53 - union { 54 - double v; 55 - struct ieee_double s; 56 - } u; 57 - 58 - if (value) { 59 - /* 60 - * Fractions in [0.5..1.0) have an exponent of 2^-1. 61 - * Leave Inf and NaN alone, however. 62 - * WHAT ABOUT DENORMS? 63 - */ 64 - u.v = value; 65 - if (u.s.dbl_exp != DBL_EXP_INFNAN) { 66 - *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1); 67 - u.s.dbl_exp = DBL_EXP_BIAS - 1; 68 - } 69 - return (u.v); 70 - } else { 71 - *eptr = 0; 72 - return ((double)0); 73 - } 74 - }
-12
lib/libc/arch/x86_64/gen/infinity.c
··· 1 - #if defined(LIBC_SCCS) && !defined(lint) 2 - static char rcsid[] = "$OpenBSD: infinity.c,v 1.2 2004/02/08 17:31:44 deraadt Exp $"; 3 - #endif /* LIBC_SCCS and not lint */ 4 - 5 - /* infinity.c */ 6 - 7 - #include <math.h> 8 - 9 - /* bytes for +Infinity on a 387 */ 10 - char __infinity[] __attribute__((__aligned__(sizeof(double)))) = 11 - { 0, 0, 0, 0, 0, 0, (char)0xf0, 0x7f }; 12 -
+12 -17
lib/libc/arch/x86_64/gen/isinf.c usr.bin/gprof/amd64.h
··· 1 - /* $OpenBSD: isinf.c,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 1 + /* $OpenBSD: amd64.h,v 1.1 2004/02/27 17:36:17 deraadt Exp $ */ 2 2 3 - /* 3 + /*- 4 4 * Copyright (c) 1992, 1993 5 5 * The Regents of the University of California. All rights reserved. 6 6 * ··· 31 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 33 * SUCH DAMAGE. 34 + * 35 + * @(#)sparc.h 8.1 (Berkeley) 6/6/93 34 36 */ 35 37 36 - #if defined(LIBC_SCCS) && !defined(lint) 37 - static char rcsid[] = "$OpenBSD: isinf.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; 38 - #endif /* LIBC_SCCS and not lint */ 38 + /* 39 + * offset (in bytes) of the code from the entry address of a routine. 40 + * (see asgnsamples for use and explanation.) 41 + */ 42 + #define OFFSET_OF_CODE 0 43 + #define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) 39 44 40 - #include <sys/types.h> 41 - #include <machine/ieee.h> 42 - 43 - int 44 - isinf(d) 45 - double d; 46 - { 47 - struct ieee_double *p = (struct ieee_double *)&d; 48 - 49 - return (p->dbl_exp == DBL_EXP_INFNAN && 50 - p->dbl_frach == 0 && p->dbl_fracl == 0); 51 - } 45 + enum opermodes { dummy }; 46 + typedef enum opermodes operandenum;
-51
lib/libc/arch/x86_64/gen/isnan.c
··· 1 - /* $OpenBSD: isnan.c,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 1992, 1993 5 - * The Regents of the University of California. All rights reserved. 6 - * 7 - * This software was developed by the Computer Systems Engineering group 8 - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 9 - * contributed to Berkeley. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. Neither the name of the University nor the names of its contributors 20 - * may be used to endorse or promote products derived from this software 21 - * without specific prior written permission. 22 - * 23 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 - * SUCH DAMAGE. 34 - */ 35 - 36 - #if defined(LIBC_SCCS) && !defined(lint) 37 - static char rcsid[] = "$OpenBSD: isnan.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; 38 - #endif /* LIBC_SCCS and not lint */ 39 - 40 - #include <sys/types.h> 41 - #include <machine/ieee.h> 42 - 43 - int 44 - isnan(d) 45 - double d; 46 - { 47 - struct ieee_double *p = (struct ieee_double *)&d; 48 - 49 - return (p->dbl_exp == DBL_EXP_INFNAN && 50 - (p->dbl_frach != 0 || p->dbl_fracl != 0)); 51 - }
-57
lib/libc/arch/x86_64/gen/ldexp.c
··· 1 - /* $OpenBSD: ldexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 1990 The Regents of the University of California. 5 - * All rights reserved. 6 - * 7 - * This code is derived from software contributed to Berkeley by 8 - * Charles Hannum. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. Neither the name of the University nor the names of its contributors 19 - * may be used to endorse or promote products derived from this software 20 - * without specific prior written permission. 21 - * 22 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 - * SUCH DAMAGE. 33 - */ 34 - 35 - #if defined(LIBC_SCCS) && !defined(lint) 36 - static char rcsid[] = "$OpenBSD: ldexp.c,v 1.1 2004/01/28 01:44:45 mickey Exp $"; 37 - #endif /* LIBC_SCCS and not lint */ 38 - 39 - /* 40 - * ldexp(value, exp): return value * (2 ** exp). 41 - */ 42 - 43 - double 44 - ldexp (double value, int exp) 45 - { 46 - double temp; 47 - #if __GNUC__ >= 2 48 - __asm ("fscale" 49 - : "=t" (temp) 50 - : "0" (value), "u" ((double)exp)); 51 - #else 52 - __asm ("fscale; fstp %%st(1)" 53 - : "=f" (temp) 54 - : "f" (value), "0" ((double)exp)); 55 - #endif 56 - return (temp); 57 - }
-91
lib/libc/arch/x86_64/gen/modf.S
··· 1 - /* $OpenBSD: modf.S,v 1.2 2004/02/08 17:29:39 deraadt Exp $ */ 2 - /* $NetBSD: modf.S,v 1.1 2001/06/19 00:25:03 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * Sean Eric Fagan. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)modf.s 5.5 (Berkeley) 3/18/91 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - /* 45 - * modf(value, iptr): return fractional part of value, and stores the 46 - * integral part into iptr (a pointer to double). 47 - * 48 - * Written by Sean Eric Fagan (sef@kithrup.COM) 49 - * Sun Mar 11 20:27:30 PST 1990 50 - */ 51 - 52 - /* With CHOP mode on, frndint behaves as TRUNC does. Useful. */ 53 - ENTRY(modf) 54 - 55 - /* 56 - * Set chop mode. 57 - */ 58 - fnstcw -12(%rsp) 59 - movw -12(%rsp),%dx 60 - orw $3072,%dx 61 - movw %dx,-16(%rsp) 62 - fldcw -16(%rsp) 63 - 64 - /* 65 - * Get integral part. 66 - */ 67 - movsd %xmm0,-24(%rsp) 68 - fldl -24(%rsp) 69 - frndint 70 - fstpl -8(%rsp) 71 - 72 - /* 73 - * Restore control word. 74 - */ 75 - fldcw -12(%rsp) 76 - 77 - /* 78 - * Store integral part. 79 - */ 80 - movsd -8(%rsp),%xmm0 81 - movsd %xmm0,(%rdi) 82 - 83 - /* 84 - * Get fractional part and return it. 85 - */ 86 - fldl -24(%rsp) 87 - fsubl -8(%rsp) 88 - fstpl -8(%rsp) 89 - movsd -8(%rsp),%xmm0 90 - 91 - ret
-103
lib/libc/arch/x86_64/gen/setjmp.S
··· 1 - /* $OpenBSD: setjmp.S,v 1.2 2004/02/09 21:25:08 deraadt Exp $ */ 2 - /* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ 3 - 4 - /* 5 - * Copyright (c) 2001 Wasabi Systems, Inc. 6 - * All rights reserved. 7 - * 8 - * Written by Frank van der Linden for Wasabi Systems, Inc. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed for the NetBSD Project by 21 - * Wasabi Systems, Inc. 22 - * 4. The name of Wasabi Systems, Inc. may not be used to endorse 23 - * or promote products derived from this software without specific prior 24 - * written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 27 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 30 - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 - * POSSIBILITY OF SUCH DAMAGE. 37 - */ 38 - 39 - 40 - #include <machine/asm.h> 41 - #include <machine/setjmp.h> 42 - 43 - /* 44 - * C library -- _setjmp, _longjmp 45 - * 46 - * longjmp(a,v) 47 - * will generate a "return(v)" from the last call to 48 - * setjmp(a) 49 - * by restoring registers from the stack. 50 - * The previous signal state is restored. 51 - */ 52 - 53 - ENTRY(setjmp) 54 - pushq %rdi 55 - xorq %rdi,%rdi 56 - #ifdef PIC 57 - call PIC_PLT(_C_LABEL(sigblock)) 58 - #else 59 - call _C_LABEL(sigblock) 60 - #endif 61 - popq %rdi 62 - movq %rax,(_JB_SIGMASK * 8)(%rdi) 63 - 64 - movq (%rsp),%r11 65 - movq %rbx,(_JB_RBX * 8)(%rdi) 66 - movq %rbp,(_JB_RBP * 8)(%rdi) 67 - movq %r12,(_JB_R12 * 8)(%rdi) 68 - movq %r13,(_JB_R13 * 8)(%rdi) 69 - movq %r14,(_JB_R14 * 8)(%rdi) 70 - movq %r15,(_JB_R15 * 8)(%rdi) 71 - movq %rsp,(_JB_RSP * 8)(%rdi) 72 - movq %r11,(_JB_PC * 8)(%rdi) 73 - 74 - 2: xorl %eax,%eax 75 - ret 76 - 77 - ENTRY(longjmp) 78 - movq %rdi,%r12 79 - movl %esi,%r8d 80 - 81 - movq (_JB_SIGMASK * 8)(%rdi),%rdi 82 - pushq %r8 83 - #ifdef PIC 84 - call PIC_PLT(_C_LABEL(sigsetmask)) 85 - #else 86 - call _C_LABEL(sigsetmask) 87 - #endif 88 - popq %r8 89 - movq (_JB_RBX * 8)(%r12),%rbx 90 - movq (_JB_RBP * 8)(%r12),%rbp 91 - movq (_JB_R13 * 8)(%r12),%r13 92 - movq (_JB_R14 * 8)(%r12),%r14 93 - movq (_JB_R15 * 8)(%r12),%r15 94 - movq (_JB_RSP * 8)(%r12),%rsp 95 - movq (_JB_PC * 8)(%r12),%r11 96 - movq (_JB_R12 * 8)(%r12),%r12 97 - 98 - movl %r8d,%eax 99 - testl %eax,%eax 100 - jnz 1f 101 - incl %eax 102 - 1: movq %r11,0(%rsp) 103 - ret
-107
lib/libc/arch/x86_64/gen/sigsetjmp.S
··· 1 - /* $OpenBSD: sigsetjmp.S,v 1.2 2004/02/09 21:25:08 deraadt Exp $ */ 2 - /* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */ 3 - 4 - /* 5 - * Copyright (c) 2001 Wasabi Systems, Inc. 6 - * All rights reserved. 7 - * 8 - * Written by Frank van der Linden for Wasabi Systems, Inc. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed for the NetBSD Project by 21 - * Wasabi Systems, Inc. 22 - * 4. The name of Wasabi Systems, Inc. may not be used to endorse 23 - * or promote products derived from this software without specific prior 24 - * written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 27 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 30 - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 - * POSSIBILITY OF SUCH DAMAGE. 37 - */ 38 - 39 - 40 - #include <machine/asm.h> 41 - #include <machine/setjmp.h> 42 - 43 - /* 44 - * C library -- _setjmp, _longjmp 45 - * 46 - * longjmp(a,v) 47 - * will generate a "return(v)" from the last call to 48 - * setjmp(a) 49 - * by restoring registers from the stack. 50 - * The previous signal state is restored. 51 - */ 52 - 53 - ENTRY(sigsetjmp) 54 - movl %esi,(_JB_SIGFLAG * 8)(%rdi) 55 - testl %esi,%esi 56 - jz 2f 57 - 58 - pushq %rdi 59 - xorq %rdi,%rdi 60 - #ifdef PIC 61 - call PIC_PLT(_C_LABEL(sigblock)) 62 - #else 63 - call _C_LABEL(sigblock) 64 - #endif 65 - popq %rdi 66 - movq %rax,(_JB_SIGMASK * 8)(%rdi) 67 - 68 - 2: movq (%rsp),%r11 69 - movq %rbx,(_JB_RBX * 8)(%rdi) 70 - movq %rbp,(_JB_RBP * 8)(%rdi) 71 - movq %r12,(_JB_R12 * 8)(%rdi) 72 - movq %r13,(_JB_R13 * 8)(%rdi) 73 - movq %r14,(_JB_R14 * 8)(%rdi) 74 - movq %r15,(_JB_R15 * 8)(%rdi) 75 - movq %rsp,(_JB_RSP * 8)(%rdi) 76 - movq %r11,(_JB_PC * 8)(%rdi) 77 - 78 - 2: xorl %eax,%eax 79 - ret 80 - 81 - ENTRY(siglongjmp) 82 - movq %rdi,%r12 83 - pushq %rsi 84 - cmpl $0, (_JB_SIGFLAG * 8)(%rdi) 85 - jz 2f 86 - 87 - movq (_JB_SIGMASK * 8)(%rdi),%rdi 88 - #ifdef PIC 89 - call PIC_PLT(_C_LABEL(sigsetmask)) 90 - #else 91 - call _C_LABEL(sigsetmask) 92 - #endif 93 - 2: popq %rax 94 - movq (_JB_RBX * 8)(%r12),%rbx 95 - movq (_JB_RBP * 8)(%r12),%rbp 96 - movq (_JB_R13 * 8)(%r12),%r13 97 - movq (_JB_R14 * 8)(%r12),%r14 98 - movq (_JB_R15 * 8)(%r12),%r15 99 - movq (_JB_RSP * 8)(%r12),%rsp 100 - movq (_JB_PC * 8)(%r12),%r11 101 - movq (_JB_R12 * 8)(%r12),%r12 102 - 103 - testl %eax,%eax 104 - jnz 1f 105 - incl %eax 106 - 1: movq %r11,0(%rsp) 107 - ret
-4
lib/libc/arch/x86_64/net/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:45 mickey Exp $ 2 - 3 - SRCS+= htonl.S htons.S ntohl.S ntohs.S 4 - LSRCS+= htonl.c htons.c ntohl.c ntohs.c
-10
lib/libc/arch/x86_64/net/htonl.S
··· 1 - /* $OpenBSD: htonl.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - 3 - /* Written by Artur Grabowski. Public Domain */ 4 - 5 - #include <machine/asm.h> 6 - 7 - ENTRY(_C_LABEL(htonl)) 8 - movl %edi,%eax 9 - bswapl %eax 10 - ret
-11
lib/libc/arch/x86_64/net/htons.S
··· 1 - /* $OpenBSD: htons.S,v 1.2 2004/02/10 00:08:11 drahn Exp $ */ 2 - 3 - /* Written by Artur Grabowski. Public Domain */ 4 - 5 - #include <machine/asm.h> 6 - 7 - ENTRY(_C_LABEL(htons)) 8 - movl %edi,%eax 9 - xchgb %ah,%al 10 - ret 11 -
-10
lib/libc/arch/x86_64/net/ntohl.S
··· 1 - /* $OpenBSD: ntohl.S,v 1.2 2004/02/10 00:08:11 drahn Exp $ */ 2 - 3 - /* Written by Artur Grabowski. Public Domain */ 4 - 5 - #include <machine/asm.h> 6 - 7 - ENTRY(_C_LABEL(ntohl)) 8 - movl %edi,%eax 9 - bswapl %eax 10 - ret
-11
lib/libc/arch/x86_64/net/ntohs.S
··· 1 - /* $OpenBSD: ntohs.S,v 1.2 2004/02/10 00:08:11 drahn Exp $ */ 2 - 3 - /* Written by Artur Grabowski. Public Domain */ 4 - 5 - #include <machine/asm.h> 6 - 7 - ENTRY(_C_LABEL(ntohs)) 8 - movl %edi,%eax 9 - xchgb %ah,%al 10 - ret 11 -
-6
lib/libc/arch/x86_64/string/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.1 2004/01/28 01:44:45 mickey Exp $ 2 - 3 - SRCS+= bcmp.c ffs.S index.c memchr.c memcmp.c bcopy.c bzero.c \ 4 - rindex.c strcat.c strcmp.c strcpy.c strcspn.c strlen.S \ 5 - strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \ 6 - strspn.c strstr.c swab.c memset.c strlcpy.c strlcat.c
-18
lib/libc/arch/x86_64/string/ffs.S
··· 1 - /* $OpenBSD: ffs.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* 3 - * Written by J.T. Conklin <jtc@netbsd.org>. 4 - * Public domain. 5 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 6 - */ 7 - 8 - #include <machine/asm.h> 9 - 10 - ENTRY(ffs) 11 - bsfl %edi,%eax 12 - jz L1 /* ZF is set if all bits are 0 */ 13 - incl %eax /* bits numbered from 1, not 0 */ 14 - ret 15 - 16 - _ALIGN_TEXT 17 - L1: xorl %eax,%eax /* clear result */ 18 - ret
-18
lib/libc/arch/x86_64/string/strlen.S
··· 1 - /* $OpenBSD: strlen.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* 3 - * Written by J.T. Conklin <jtc@netbsd.org>. 4 - * Public domain. 5 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 6 - */ 7 - 8 - #include <machine/asm.h> 9 - 10 - ENTRY(strlen) 11 - cld /* set search forward */ 12 - xorl %eax,%eax /* set search for null terminator */ 13 - movq $-1,%rcx /* set search for lots of characters */ 14 - repne /* search! */ 15 - scasb 16 - notq %rcx /* get length by taking complement */ 17 - leaq -1(%rcx),%rax /* and subtracting one */ 18 - ret
-67
lib/libc/arch/x86_64/sys/Ovfork.S
··· 1 - /* $OpenBSD: Ovfork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: Ovfork.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - /* 47 - * pid = vfork(); 48 - * 49 - * %edx == 0 in parent process, %edx == 1 in child process. 50 - * %eax == pid of child in parent, %eax == pid of parent in child. 51 - * 52 - */ 53 - SYSENTRY(vfork) 54 - popq %r9 /* my rta into r9 */ 55 - SYSTRAP(vfork) 56 - jc err 57 - decl %edx 58 - andl %edx,%eax 59 - jmp *%r9 60 - err: 61 - pushq %r9 62 - #ifdef PIC 63 - movq PIC_GOT(CERROR), %rcx 64 - jmp *%rcx 65 - #else 66 - jmp CERROR 67 - #endif
-89
lib/libc/arch/x86_64/sys/brk.S
··· 1 - /* $OpenBSD: brk.S,v 1.2 2004/02/10 00:22:51 drahn Exp $ */ 2 - /* $NetBSD: brk.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)brk.s 5.2 (Berkeley) 12/17/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - .globl _end 47 - .globl _C_LABEL(__minbrk) 48 - .globl _C_LABEL(minbrk) 49 - .globl __curbrk 50 - 51 - #ifdef WEAK_ALIAS 52 - WEAK_ALIAS(brk, _brk) 53 - #endif 54 - 55 - .data 56 - _C_LABEL(minbrk): 57 - _C_LABEL(__minbrk): 58 - .quad _end 59 - .text 60 - 61 - SYSENTRY(_brk) 62 - #ifdef PIC 63 - movq PIC_GOT(_C_LABEL(__minbrk)),%rdx 64 - cmpq %rdi,(%rdx) 65 - jb 1f 66 - movq (%rdx),%rdi 67 - 1: 68 - SYSTRAP(break) 69 - jc err 70 - movq PIC_GOT(__curbrk),%rdx # set up GOT addressing 71 - movq %rdi,(%rdx) 72 - xorl %eax,%eax 73 - ret 74 - err: 75 - movq PIC_GOT(CERROR),%rdx 76 - jmp *%rdx 77 - #else 78 - cmpq %rdi,_C_LABEL(__minbrk)(%rip) 79 - jb 1f 80 - movq _C_LABEL(__minbrk)(%rip),%rdi 81 - 1: 82 - SYSTRAP(break) 83 - jc err 84 - movq %rdi,__curbrk(%rip) 85 - xorl %eax,%eax 86 - ret 87 - err: 88 - jmp CERROR 89 - #endif
-56
lib/libc/arch/x86_64/sys/cerror.S
··· 1 - /* $OpenBSD: cerror.S,v 1.3 2004/02/18 16:51:21 miod Exp $ */ 2 - /* $NetBSD: cerror.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)cerror.s 5.1 (Berkeley) 4/23/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - .globl _C_LABEL(errno) 47 - 48 - _ENTRY(CERROR) 49 - #ifdef PIC 50 - movq PIC_GOT(_C_LABEL(errno)), %rcx 51 - movl %eax, (%rcx) 52 - #else 53 - movl %eax, _C_LABEL(errno)(%rip) 54 - #endif /* PIC */ 55 - movq $-1,%rax 56 - ret
-57
lib/libc/arch/x86_64/sys/exect.S
··· 1 - /* $OpenBSD: exect.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: exect.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)exect.s 5.1 (Berkeley) 4/23/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - #include <machine/psl.h> 46 - 47 - SYSENTRY(exect) 48 - pushfq 49 - orb $(PSL_T>>8),1(%rsp) 50 - popfq 51 - SYSTRAP(execve) 52 - #ifdef PIC 53 - movq PIC_GOT(CERROR), %rcx 54 - jmp *%rcx 55 - #else 56 - jmp CERROR 57 - #endif
-49
lib/libc/arch/x86_64/sys/fork.S
··· 1 - /* $OpenBSD: fork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: fork.S,v 1.2 2003/02/13 02:50:51 nathanw Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)fork.s 5.1 (Berkeley) 4/23/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - SYSCALL(fork) 47 - decl %edx /* from 1 to 0 in child, 0 to -1 in parent */ 48 - andl %edx,%eax 49 - ret /* pid = fork(); */
-48
lib/libc/arch/x86_64/sys/rfork.S
··· 1 - /* $OpenBSD: rfork.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 1990 The Regents of the University of California. 5 - * All rights reserved. 6 - * 7 - * This code is derived from software contributed to Berkeley by 8 - * William Jolitz. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed by the University of 21 - * California, Berkeley and its contributors. 22 - * 4. Neither the name of the University nor the names of its contributors 23 - * may be used to endorse or promote products derived from this software 24 - * without specific prior written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 - * SUCH DAMAGE. 37 - * 38 - * from: @(#)fork.s 5.1 (Berkeley) 4/23/90 39 - */ 40 - 41 - #include <machine/asm.h> 42 - 43 - #include "SYS.h" 44 - 45 - SYSCALL(rfork) 46 - decl %edx /* from 1 to 0 in child, 0 to -1 in parent */ 47 - andl %edx,%eax 48 - ret /* pid = rfork(); */
-82
lib/libc/arch/x86_64/sys/sbrk.S
··· 1 - /* $OpenBSD: sbrk.S,v 1.2 2004/02/10 00:22:51 drahn Exp $ */ 2 - /* $NetBSD: sbrk.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)sbrk.s 5.1 (Berkeley) 4/23/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - .globl _end 47 - .globl __curbrk 48 - 49 - #ifdef WEAK_ALIAS 50 - WEAK_ALIAS(sbrk, _sbrk) 51 - #endif 52 - 53 - .data 54 - __curbrk: .quad _end 55 - .text 56 - 57 - SYSENTRY(_sbrk) 58 - #ifdef PIC 59 - movq PIC_GOT(__curbrk),%rdx 60 - movq (%rdx),%rax 61 - addq %rax,%rdi 62 - SYSTRAP(break) 63 - jc err 64 - movq PIC_GOT(__curbrk),%rdx 65 - movq (%rdx),%rax 66 - movq %rdi,(%rdx) 67 - ret 68 - err: 69 - mov PIC_GOT(CERROR),%rdx 70 - jmp *%rdx 71 - #else 72 - movq __curbrk(%rip),%rax 73 - movq %rdi,%rsi 74 - addq %rax,%rdi 75 - SYSTRAP(break) 76 - jc err 77 - movq __curbrk(%rip),%rax 78 - addq %rsi,__curbrk(%rip) 79 - ret 80 - err: 81 - jmp CERROR 82 - #endif
-49
lib/libc/arch/x86_64/sys/sigpending.S
··· 1 - /* $OpenBSD: sigpending.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: sigpending.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)sigpending.s 5.1 (Berkeley) 7/1/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - SYSCALL(sigpending) 47 - movl %eax,(%rdi) # store old mask 48 - xorl %eax,%eax 49 - ret
-66
lib/libc/arch/x86_64/sys/sigprocmask.S
··· 1 - /* $OpenBSD: sigprocmask.S,v 1.2 2004/02/09 21:27:21 deraadt Exp $ */ 2 - /* $NetBSD: sigprocmask.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - SYSENTRY(sigprocmask) 47 - testq %rsi,%rsi # check new sigset pointer 48 - jnz 1f # if not null, indirect 49 - movl $1,%edi # SIG_BLOCK 50 - jmp 2f 51 - 1: movl (%rsi),%esi # fetch indirect ... 52 - 2: SYSTRAP(sigprocmask) 53 - jc err 54 - testq %rdx,%rdx # test if old mask requested 55 - jz out 56 - movl %eax,(%rdx) # store old mask 57 - out: 58 - xorl %eax,%eax 59 - ret 60 - err: 61 - #ifdef PIC 62 - movq PIC_GOT(CERROR), %rcx 63 - jmp *%rcx 64 - #else 65 - jmp CERROR 66 - #endif
-60
lib/libc/arch/x86_64/sys/sigreturn.S
··· 1 - /* $OpenBSD: sigreturn.S,v 1.2 2004/02/22 21:28:22 miod Exp $ */ 2 - /* $NetBSD: __sigreturn14.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90" 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - /* 47 - * We must preserve the state of the registers as the user has set them up. 48 - */ 49 - #if 0 /* XXXfvdl fix later, but this one is really low priority */ 50 - #ifdef GPROF 51 - #undef ENTRY 52 - #define MCOUNT_SYMBOL __mcount 53 - #define ENTRY(x) \ 54 - .globl _/**/x; _ALIGN_TEXT; _/**/x: pusha ; \ 55 - .data; 1:; .long 0; .text; movl $1b,%eax; call MCOUNT_SYMBOL; popa ; nop 56 - #endif /* GPROF */ 57 - #endif 58 - 59 - OSYSCALL(sigreturn) 60 - ret
-58
lib/libc/arch/x86_64/sys/sigsuspend.S
··· 1 - /* $OpenBSD: sigsuspend.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ 2 - /* $NetBSD: sigsuspend.S,v 1.1 2001/06/19 00:25:07 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)sigsuspend.s 5.2 (Berkeley) 12/17/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - SYSENTRY(sigsuspend) 47 - movl (%rdi),%edi # indirect to mask arg 48 - SYSTRAP(sigsuspend) 49 - jc err 50 - xorl %eax,%eax # shouldn t happen 51 - ret 52 - err: 53 - #ifdef PIC 54 - movq PIC_GOT(CERROR), %rcx 55 - jmp *%rcx 56 - #else 57 - jmp CERROR 58 - #endif
-58
lib/libc/arch/x86_64/sys/syscall.S
··· 1 - /* $OpenBSD: syscall.S,v 1.2 2004/02/11 07:09:22 deraadt Exp $ */ 2 - /* $NetBSD: syscall.S,v 1.2 2002/06/03 18:30:33 fvdl Exp $ */ 3 - 4 - /*- 5 - * Copyright (c) 1990 The Regents of the University of California. 6 - * All rights reserved. 7 - * 8 - * This code is derived from software contributed to Berkeley by 9 - * William Jolitz. 10 - * 11 - * Redistribution and use in source and binary forms, with or without 12 - * modification, are permitted provided that the following conditions 13 - * are met: 14 - * 1. Redistributions of source code must retain the above copyright 15 - * notice, this list of conditions and the following disclaimer. 16 - * 2. Redistributions in binary form must reproduce the above copyright 17 - * notice, this list of conditions and the following disclaimer in the 18 - * documentation and/or other materials provided with the distribution. 19 - * 3. All advertising materials mentioning features or use of this software 20 - * must display the following acknowledgement: 21 - * This product includes software developed by the University of 22 - * California, Berkeley and its contributors. 23 - * 4. Neither the name of the University nor the names of its contributors 24 - * may be used to endorse or promote products derived from this software 25 - * without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 - * SUCH DAMAGE. 38 - * 39 - * from: @(#)syscall.s 5.1 (Berkeley) 4/23/90 40 - */ 41 - 42 - #include <machine/asm.h> 43 - 44 - #include "SYS.h" 45 - 46 - SYSENTRY(syscall) 47 - movq $0,%rax 48 - movq %rcx,%r10 49 - syscall 50 - jc err 51 - ret 52 - err: 53 - #ifdef PIC 54 - movq PIC_GOT(CERROR), %rcx 55 - jmp *%rcx 56 - #else 57 - jmp CERROR 58 - #endif
+209
lib/libkvm/kvm_amd64.c
··· 1 + /* $OpenBSD: kvm_amd64.c,v 1.1 2004/02/27 17:36:13 deraadt Exp $ */ 2 + /* $NetBSD: kvm_x86_64.c,v 1.3 2002/06/05 22:01:55 fvdl Exp $ */ 3 + 4 + /*- 5 + * Copyright (c) 1989, 1992, 1993 6 + * The Regents of the University of California. All rights reserved. 7 + * 8 + * This code is derived from software developed by the Computer Systems 9 + * Engineering group at Lawrence Berkeley Laboratory under DARPA contract 10 + * BG 91-66 and contributed to Berkeley. 11 + * 12 + * Redistribution and use in source and binary forms, with or without 13 + * modification, are permitted provided that the following conditions 14 + * are met: 15 + * 1. Redistributions of source code must retain the above copyright 16 + * notice, this list of conditions and the following disclaimer. 17 + * 2. Redistributions in binary form must reproduce the above copyright 18 + * notice, this list of conditions and the following disclaimer in the 19 + * documentation and/or other materials provided with the distribution. 20 + * 3. All advertising materials mentioning features or use of this software 21 + * must display the following acknowledgement: 22 + * This product includes software developed by the University of 23 + * California, Berkeley and its contributors. 24 + * 4. Neither the name of the University nor the names of its contributors 25 + * may be used to endorse or promote products derived from this software 26 + * without specific prior written permission. 27 + * 28 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 + * SUCH DAMAGE. 39 + */ 40 + 41 + #include <sys/cdefs.h> 42 + 43 + /* 44 + * x86-64 machine dependent routines for kvm. 45 + */ 46 + 47 + #include <sys/param.h> 48 + #include <sys/user.h> 49 + #include <sys/proc.h> 50 + #include <sys/stat.h> 51 + #include <sys/kcore.h> 52 + #include <machine/kcore.h> 53 + #include <stdlib.h> 54 + #include <unistd.h> 55 + #include <nlist.h> 56 + #include <kvm.h> 57 + 58 + #include <uvm/uvm_extern.h> 59 + 60 + #include <limits.h> 61 + #include <db.h> 62 + 63 + #include "kvm_private.h" 64 + 65 + #include <machine/pmap.h> 66 + #include <machine/pte.h> 67 + #include <machine/vmparam.h> 68 + 69 + void 70 + _kvm_freevtop(kd) 71 + kvm_t *kd; 72 + { 73 + 74 + /* Not actually used for anything right now, but safe. */ 75 + if (kd->vmst != 0) 76 + free(kd->vmst); 77 + } 78 + 79 + /*ARGSUSED*/ 80 + int 81 + _kvm_initvtop(kd) 82 + kvm_t *kd; 83 + { 84 + 85 + return (0); 86 + } 87 + 88 + /* 89 + * Translate a kernel virtual address to a physical address. 90 + */ 91 + int 92 + _kvm_kvatop(kd, va, pa) 93 + kvm_t *kd; 94 + u_long va; 95 + u_long *pa; 96 + { 97 + cpu_kcore_hdr_t *cpu_kh; 98 + u_long page_off; 99 + pd_entry_t pde; 100 + pt_entry_t pte; 101 + paddr_t pde_pa, pte_pa; 102 + 103 + if (ISALIVE(kd)) { 104 + _kvm_err(kd, 0, "vatop called in live kernel!"); 105 + return (0); 106 + } 107 + 108 + cpu_kh = kd->cpu_data; 109 + page_off = va & PGOFSET; 110 + 111 + /* 112 + * Find and read all entries to get to the pa. 113 + */ 114 + 115 + /* 116 + * Level 4. 117 + */ 118 + pde_pa = cpu_kh->ptdpaddr + (pl4_i(va) * sizeof(pd_entry_t)); 119 + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), 120 + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { 121 + _kvm_syserr(kd, 0, "could not read PT level 4 entry"); 122 + goto lose; 123 + } 124 + if ((pde & PG_V) == 0) { 125 + _kvm_err(kd, 0, "invalid translation (invalid level 4 PDE)"); 126 + goto lose; 127 + } 128 + 129 + /* 130 + * Level 3. 131 + */ 132 + pde_pa = (pde_pa + PG_FRAME) + (pl3_i(va) * sizeof(pd_entry_t)); 133 + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), 134 + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { 135 + _kvm_syserr(kd, 0, "could not read PT level 3 entry"); 136 + goto lose; 137 + } 138 + if ((pde & PG_V) == 0) { 139 + _kvm_err(kd, 0, "invalid translation (invalid level 3 PDE)"); 140 + goto lose; 141 + } 142 + 143 + /* 144 + * Level 2. 145 + */ 146 + pde_pa = (pde_pa & PG_FRAME) + (pl2_i(va) * sizeof(pd_entry_t)); 147 + if (pread(kd->pmfd, (void *)&pde, sizeof(pde), 148 + _kvm_pa2off(kd, pde_pa)) != sizeof(pde)) { 149 + _kvm_syserr(kd, 0, "could not read PT level 2 entry"); 150 + goto lose; 151 + } 152 + if ((pde & PG_V) == 0) { 153 + _kvm_err(kd, 0, "invalid translation (invalid level 2 PDE)"); 154 + goto lose; 155 + } 156 + 157 + 158 + /* 159 + * Level 1. 160 + */ 161 + pte_pa = (pde_pa & PG_FRAME) + (pl1_i(va) * sizeof(pt_entry_t)); 162 + if (pread(kd->pmfd, (void *) &pte, sizeof(pte), 163 + _kvm_pa2off(kd, pte_pa)) != sizeof(pte)) { 164 + _kvm_syserr(kd, 0, "could not read PTE"); 165 + goto lose; 166 + } 167 + /* 168 + * Validate the PTE and return the physical address. 169 + */ 170 + if ((pte & PG_V) == 0) { 171 + _kvm_err(kd, 0, "invalid translation (invalid PTE)"); 172 + goto lose; 173 + } 174 + *pa = (pte & PG_FRAME) + page_off; 175 + return (int)(NBPG - page_off); 176 + 177 + lose: 178 + *pa = (u_long)~0L; 179 + return (0); 180 + } 181 + 182 + /* 183 + * Translate a physical address to a file-offset in the crash dump. 184 + */ 185 + off_t 186 + _kvm_pa2off(kd, pa) 187 + kvm_t *kd; 188 + u_long pa; 189 + { 190 + cpu_kcore_hdr_t *cpu_kh; 191 + phys_ram_seg_t *ramsegs; 192 + off_t off; 193 + int i; 194 + 195 + cpu_kh = kd->cpu_data; 196 + ramsegs = (void *)((char *)(void *)cpu_kh + ALIGN(sizeof *cpu_kh)); 197 + 198 + off = 0; 199 + for (i = 0; i < cpu_kh->nmemsegs; i++) { 200 + if (pa >= ramsegs[i].start && 201 + (pa - ramsegs[i].start) < ramsegs[i].size) { 202 + off += (pa - ramsegs[i].start); 203 + break; 204 + } 205 + off += ramsegs[i].size; 206 + } 207 + 208 + return (kd->dump_off + off); 209 + }
+2 -2
lib/libm/Makefile
··· 1 1 # $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $ 2 - # $OpenBSD: Makefile,v 1.31 2004/02/08 18:03:48 deraadt Exp $ 2 + # $OpenBSD: Makefile,v 1.32 2004/02/27 17:36:13 deraadt Exp $ 3 3 # 4 4 # @(#)Makefile 5.1beta 93/09/24 5 5 # ··· 63 63 s_ilogb.S s_ilogbf.S s_log1p.S s_log1pf.S s_logb.S s_logbf.S \ 64 64 s_rint.S s_rintf.S s_scalbn.S s_scalbnf.S s_significand.S \ 65 65 s_significandf.S s_sin.S s_sinf.S s_tan.S s_tanf.S 66 - .elif (${MACHINE_ARCH} == "x86_64") 66 + .elif (${MACHINE_ARCH} == "amd64") 67 67 .PATH: ${.CURDIR}/arch/x86_64 68 68 CPPFLAGS+=-I${.CURDIR}/arch/x86_64 69 69 ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \
-26
lib/libpthread/arch/x86_64/_atomic_lock.c
··· 1 - /* $OpenBSD: _atomic_lock.c,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ 2 - 3 - /* David Leonard, <d@csee.uq.edu.au>. Public domain. */ 4 - 5 - /* 6 - * Atomic lock for amd64 -- taken from i386 code. 7 - */ 8 - 9 - #include "spinlock.h" 10 - 11 - int 12 - _atomic_lock(volatile _spinlock_lock_t *lock) 13 - { 14 - _spinlock_lock_t old; 15 - 16 - /* 17 - * Use the eXCHanGe instruction to swap the lock value with 18 - * a local variable containing the locked state. 19 - */ 20 - old = _SPINLOCK_LOCKED; 21 - __asm__("xchg %0,%1" 22 - : "=r" (old), "=m" (*lock) 23 - : "0" (old), "1" (*lock)); 24 - 25 - return (old != _SPINLOCK_UNLOCKED); 26 - }
-108
lib/libpthread/arch/x86_64/uthread_machdep.c
··· 1 - /* $OpenBSD: uthread_machdep.c,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 2004 Theo de Raadt 5 - * 6 - * Permission to use, copy, modify, and distribute this software for any 7 - * purpose with or without fee is hereby granted, provided that the above 8 - * copyright notice and this permission notice appear in all copies. 9 - * 10 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 - */ 18 - 19 - 20 - #include <machine/param.h> 21 - #include <pthread.h> 22 - #include "pthread_private.h" 23 - 24 - struct frame { 25 - long fr_gs; 26 - long fr_fs; 27 - long fr_es; 28 - long fr_ds; 29 - 30 - long flag; 31 - long fr_r15; 32 - long fr_r14; 33 - long fr_r13; 34 - long fr_r12; 35 - 36 - long fr_r11; 37 - long fr_r10; 38 - long fr_r9; 39 - long fr_r8; 40 - 41 - long fr_rdi; 42 - long fr_rsi; 43 - long fr_rbp; 44 - 45 - long fr_rbx; 46 - long fr_rdx; 47 - long fr_rcx; 48 - long fr_rax; 49 - 50 - long fr_rip; 51 - int fr_cs; /* XXX unreachable? */ 52 - int pad; 53 - }; 54 - 55 - #define copyreg(reg, lval) \ 56 - __asm__("mov %%" #reg ", %0" : "=g"(lval)) 57 - 58 - /* 59 - * Given a stack and an entry function, initialise a state 60 - * structure that can be later switched to. 61 - */ 62 - void 63 - _thread_machdep_init(struct _machdep_state* statep, void *base, int len, 64 - void (*entry)(void)) 65 - { 66 - struct frame *f; 67 - int foo; 68 - 69 - /* Locate the initial frame, aligned at the top of the stack */ 70 - f = (struct frame *)(((long)base + len - sizeof *f) & ~ALIGNBYTES); 71 - 72 - copyreg(cs, foo); 73 - f->fr_cs = foo; 74 - copyreg(ds, foo); 75 - f->fr_ds = foo; 76 - copyreg(es, foo); 77 - f->fr_es = foo; 78 - copyreg(fs, foo); 79 - f->fr_fs = foo; 80 - copyreg(gs, foo); 81 - f->fr_gs = foo; 82 - 83 - f->fr_rbp = (long)-1; 84 - f->fr_rip = (long)entry; 85 - 86 - statep->rsp = (long)f; 87 - 88 - _thread_machdep_save_float_state(statep); 89 - } 90 - 91 - #define fxsave(addr) __asm("fxsave %0" : "=m" (*addr)) 92 - #define fxrstor(addr) __asm("fxrstor %0" : : "m" (*addr)) 93 - #define fwait() __asm("fwait") 94 - #define fninit() __asm("fninit") 95 - 96 - void 97 - _thread_machdep_save_float_state(struct _machdep_state *ms) 98 - { 99 - fxsave(&ms->fpreg); 100 - fninit(); 101 - fwait(); 102 - } 103 - 104 - void 105 - _thread_machdep_restore_float_state(struct _machdep_state *ms) 106 - { 107 - fxrstor(&ms->fpreg); 108 - }
-26
lib/libpthread/arch/x86_64/uthread_machdep.h
··· 1 - /* $OpenBSD: uthread_machdep.h,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 2004 Theo de Raadt 5 - * 6 - * Permission to use, copy, modify, and distribute this software for any 7 - * purpose with or without fee is hereby granted, provided that the above 8 - * copyright notice and this permission notice appear in all copies. 9 - * 10 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 - */ 18 - 19 - #include <sys/types.h> 20 - #include <machine/fpu.h> 21 - 22 - struct _machdep_state { 23 - long rsp; 24 - /* must be 128-bit aligned */ 25 - struct savefpu fpreg __attribute__ ((aligned (16))); 26 - };
-88
lib/libpthread/arch/x86_64/uthread_machdep_asm.S
··· 1 - /* $OpenBSD: uthread_machdep_asm.S,v 1.3 2004/02/25 04:10:53 deraadt Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 2004 Theo de Raadt 5 - * 6 - * Permission to use, copy, modify, and distribute this software for any 7 - * purpose with or without fee is hereby granted, provided that the above 8 - * copyright notice and this permission notice appear in all copies. 9 - * 10 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 - */ 18 - 19 - #include <machine/asm.h> 20 - 21 - /* 22 - * Switch stacks 23 - */ 24 - 25 - /* void _thread_machdep_switch(new, oldsave); */ 26 - ENTRY(_thread_machdep_switch) 27 - pushq %rax 28 - pushq %rcx 29 - pushq %rdx 30 - pushq %rbx 31 - 32 - pushq %rbp 33 - pushq %rsi 34 - pushq %rdi 35 - 36 - pushq %r8 37 - pushq %r9 38 - pushq %r10 39 - pushq %r11 40 - 41 - pushq %r12 42 - pushq %r13 43 - pushq %r14 44 - pushq %r15 45 - movq $0xdeaf12345678beaf, %r15 46 - pushq %r15 47 - 48 - movl %ds,%eax 49 - pushq %rax 50 - movl %es,%eax 51 - pushq %rax 52 - movl %fs,%eax 53 - pushq %rax 54 - movl %gs,%eax 55 - pushq %rax 56 - 57 - movq %rsp, 0(%rsi) /* *arg2 = %rsp */ 58 - movq 0(%rdi), %rsp /* %rsp = *arg1 */ 59 - 60 - popq %rax 61 - movl %eax,%gs 62 - popq %rax 63 - movl %eax,%fs 64 - popq %rax 65 - movl %eax,%es 66 - popq %rax 67 - movl %eax,%ds 68 - 69 - popq %r15 # flag word. 70 - popq %r15 71 - popq %r14 72 - popq %r13 73 - popq %r12 74 - 75 - popq %r11 76 - popq %r10 77 - popq %r9 78 - popq %r8 79 - 80 - popq %rdi 81 - popq %rsi 82 - popq %rbp 83 - 84 - popq %rbx 85 - popq %rdx 86 - popq %rcx 87 - popq %rax 88 - ret
+2 -2
lib/libssl/crypto/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.35 2004/01/29 03:05:33 deraadt Exp $ 1 + # $OpenBSD: Makefile,v 1.36 2004/02/27 17:36:13 deraadt Exp $ 2 2 3 3 LIB= crypto 4 4 ··· 7 7 LCRYPTO_SRC= ${SSL_SRC}/crypto 8 8 9 9 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "arm" || \ 10 - ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "x86_64" || \ 10 + ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "amd64" || \ 11 11 ${MACHINE_ARCH} == "alpha" 12 12 CFLAGS+= -DL_ENDIAN 13 13 .else
-180
lib/libssl/crypto/arch/x86_64/opensslconf.h
··· 1 - /* opensslconf.h */ 2 - /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ 3 - 4 - /* OpenSSL was configured with the following options: */ 5 - #ifndef OPENSSL_DOING_MAKEDEPEND 6 - 7 - #ifndef OPENSSL_NO_KRB5 8 - # define OPENSSL_NO_KRB5 9 - #endif 10 - 11 - #endif /* OPENSSL_DOING_MAKEDEPEND */ 12 - 13 - /* The OPENSSL_NO_* macros are also defined as NO_* if the application 14 - asks for it. This is a transient feature that is provided for those 15 - who haven't had the time to do the appropriate changes in their 16 - applications. */ 17 - #ifdef OPENSSL_ALGORITHM_DEFINES 18 - # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) 19 - # define NO_KRB5 20 - # endif 21 - #endif 22 - 23 - /* crypto/opensslconf.h.in */ 24 - 25 - /* Generate 80386 code? */ 26 - #undef I386_ONLY 27 - 28 - #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ 29 - #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) 30 - #define OPENSSLDIR "/etc/ssl" 31 - #endif 32 - #endif 33 - 34 - #undef OPENSSL_UNISTD 35 - #define OPENSSL_UNISTD <unistd.h> 36 - 37 - #undef OPENSSL_EXPORT_VAR_AS_FUNCTION 38 - 39 - #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) 40 - #define IDEA_INT unsigned int 41 - #endif 42 - 43 - #if defined(HEADER_MD2_H) && !defined(MD2_INT) 44 - #define MD2_INT unsigned int 45 - #endif 46 - 47 - #if defined(HEADER_RC2_H) && !defined(RC2_INT) 48 - /* I need to put in a mod for the alpha - eay */ 49 - #define RC2_INT unsigned int 50 - #endif 51 - 52 - #if defined(HEADER_RC4_H) 53 - #if !defined(RC4_INT) 54 - /* using int types make the structure larger but make the code faster 55 - * on most boxes I have tested - up to %20 faster. */ 56 - /* 57 - * I don't know what does "most" mean, but declaring "int" is a must on: 58 - * - Intel P6 because partial register stalls are very expensive; 59 - * - elder Alpha because it lacks byte load/store instructions; 60 - */ 61 - #define RC4_INT unsigned int 62 - #endif 63 - #if !defined(RC4_CHUNK) 64 - /* 65 - * This enables code handling data aligned at natural CPU word 66 - * boundary. See crypto/rc4/rc4_enc.c for further details. 67 - */ 68 - #undef RC4_CHUNK 69 - #endif 70 - #endif 71 - 72 - #if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG) 73 - /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a 74 - * %20 speed up (longs are 8 bytes, int's are 4). */ 75 - #ifndef DES_LONG 76 - #define DES_LONG unsigned int 77 - #endif 78 - #endif 79 - 80 - #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) 81 - #define CONFIG_HEADER_BN_H 82 - #undef BN_LLONG 83 - 84 - /* Should we define BN_DIV2W here? */ 85 - 86 - /* Only one for the following should be defined */ 87 - /* The prime number generation stuff may not work when 88 - * EIGHT_BIT but I don't care since I've only used this mode 89 - * for debuging the bignum libraries */ 90 - #define SIXTY_FOUR_BIT_LONG 91 - #undef SIXTY_FOUR_BIT 92 - #undef THIRTY_TWO_BIT 93 - #undef SIXTEEN_BIT 94 - #undef EIGHT_BIT 95 - #endif 96 - 97 - #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) 98 - #define CONFIG_HEADER_RC4_LOCL_H 99 - /* if this is defined data[i] is used instead of *data, this is a %20 100 - * speedup on x86 */ 101 - #undef RC4_INDEX 102 - #endif 103 - 104 - #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) 105 - #define CONFIG_HEADER_BF_LOCL_H 106 - #undef BF_PTR 107 - #endif /* HEADER_BF_LOCL_H */ 108 - 109 - #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) 110 - #define CONFIG_HEADER_DES_LOCL_H 111 - #ifndef DES_DEFAULT_OPTIONS 112 - /* the following is tweaked from a config script, that is why it is a 113 - * protected undef/define */ 114 - #ifndef DES_PTR 115 - #define DES_PTR 116 - #endif 117 - 118 - /* This helps C compiler generate the correct code for multiple functional 119 - * units. It reduces register dependancies at the expense of 2 more 120 - * registers */ 121 - #ifndef DES_RISC1 122 - #undef DES_RISC1 123 - #endif 124 - 125 - #ifndef DES_RISC2 126 - #define DES_RISC2 127 - #endif 128 - 129 - #if defined(DES_RISC1) && defined(DES_RISC2) 130 - YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! 131 - #endif 132 - 133 - /* Unroll the inner loop, this sometimes helps, sometimes hinders. 134 - * Very mucy CPU dependant */ 135 - #ifndef DES_UNROLL 136 - #undef DES_UNROLL 137 - #endif 138 - 139 - /* These default values were supplied by 140 - * Peter Gutman <pgut001@cs.auckland.ac.nz> 141 - * They are only used if nothing else has been defined */ 142 - #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) 143 - /* Special defines which change the way the code is built depending on the 144 - CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find 145 - even newer MIPS CPU's, but at the moment one size fits all for 146 - optimization options. Older Sparc's work better with only UNROLL, but 147 - there's no way to tell at compile time what it is you're running on */ 148 - 149 - #if defined( sun ) /* Newer Sparc's */ 150 - # define DES_PTR 151 - # define DES_RISC1 152 - # define DES_UNROLL 153 - #elif defined( __ultrix ) /* Older MIPS */ 154 - # define DES_PTR 155 - # define DES_RISC2 156 - # define DES_UNROLL 157 - #elif defined( __osf1__ ) /* Alpha */ 158 - # define DES_PTR 159 - # define DES_RISC2 160 - #elif defined ( _AIX ) /* RS6000 */ 161 - /* Unknown */ 162 - #elif defined( __hpux ) /* HP-PA */ 163 - /* Unknown */ 164 - #elif defined( __aux ) /* 68K */ 165 - /* Unknown */ 166 - #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ 167 - # define DES_UNROLL 168 - #elif defined( __sgi ) /* Newer MIPS */ 169 - # define DES_PTR 170 - # define DES_RISC2 171 - # define DES_UNROLL 172 - #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ 173 - # define DES_PTR 174 - # define DES_RISC1 175 - # define DES_UNROLL 176 - #endif /* Systems-specific speed defines */ 177 - #endif 178 - 179 - #endif /* DES_DEFAULT_OPTIONS */ 180 - #endif /* HEADER_DES_LOCL_H */
+2 -2
libexec/ld.so/amd64/archdep.h
··· 1 - /* $OpenBSD: archdep.h,v 1.1 2004/02/10 14:18:14 drahn Exp $ */ 1 + /* $OpenBSD: archdep.h,v 1.2 2004/02/27 17:36:15 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1998 Per Fogelstrom, Opsycon AB ··· 31 31 32 32 #define DL_MALLOC_ALIGN 8 /* Arch constraint or otherwise */ 33 33 34 - #define MACHID EM_X86_64 /* ELF e_machine ID value checked */ 34 + #define MACHID EM_AMD64 /* ELF e_machine ID value checked */ 35 35 36 36 #define RELTYPE Elf32_Rela 37 37 #define RELSIZE sizeof(Elf32_Rela)
-4
libexec/ld.so/x86_64/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.1 2004/02/10 14:18:14 drahn Exp $ 2 - 3 - CFLAGS += -fPIC -fno-stack-protector 4 - AFLAGS += -fpic
-87
libexec/ld.so/x86_64/archdep.h
··· 1 - /* $OpenBSD: archdep.h,v 1.1 2004/02/10 14:18:14 drahn Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 1998 Per Fogelstrom, Opsycon AB 5 - * 6 - * Redistribution and use in source and binary forms, with or without 7 - * modification, are permitted provided that the following conditions 8 - * are met: 9 - * 1. Redistributions of source code must retain the above copyright 10 - * notice, this list of conditions and the following disclaimer. 11 - * 2. Redistributions in binary form must reproduce the above copyright 12 - * notice, this list of conditions and the following disclaimer in the 13 - * documentation and/or other materials provided with the distribution. 14 - * 15 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 16 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 19 - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 - * SUCH DAMAGE. 26 - * 27 - */ 28 - 29 - #ifndef _X86_64_ARCHDEP_H_ 30 - #define _X86_64_ARCHDEP_H_ 31 - 32 - #define DL_MALLOC_ALIGN 8 /* Arch constraint or otherwise */ 33 - 34 - #define MACHID EM_X86_64 /* ELF e_machine ID value checked */ 35 - 36 - #define RELTYPE Elf32_Rela 37 - #define RELSIZE sizeof(Elf32_Rela) 38 - 39 - #include <sys/mman.h> 40 - #include <elf_abi.h> 41 - #include <machine/reloc.h> 42 - #include "syscall.h" 43 - #include "util.h" 44 - 45 - #define RTLD_TEXT_PLT 46 - 47 - static inline void * 48 - _dl_mmap(void *addr, unsigned int len, unsigned int prot, 49 - unsigned int flags, int fd, off_t offset) 50 - { 51 - return((void *)_dl__syscall((quad_t)SYS_mmap, addr, len, prot, 52 - flags, fd, 0, offset)); 53 - } 54 - 55 - static inline void * 56 - _dl_mquery(void *addr, unsigned int len, unsigned int prot, 57 - unsigned int flags, int fd, off_t offset) 58 - { 59 - return((void *)_dl__syscall((quad_t)SYS_mquery, addr, len, prot, 60 - flags, fd, 0, offset)); 61 - } 62 - 63 - 64 - static inline void 65 - RELOC_REL(Elf64_Rel *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v) 66 - { 67 - /* AMD64 is a rela architecture */ 68 - } 69 - 70 - static inline void 71 - RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v) 72 - { 73 - if (ELF64_R_TYPE(r->r_info) == R_X86_64_RELATIVE) { 74 - *p = v + r->r_addend; 75 - } else if (ELF64_R_TYPE(r->r_info) == R_X86_64_GLOB_DAT) { 76 - *p = v + s->st_value + r->r_addend; 77 - } else { 78 - _dl_printf("unknown bootstrap relocation\n"); 79 - _dl_exit(6); 80 - } 81 - } 82 - 83 - #define RELOC_GOT(obj, offs) 84 - 85 - #define GOT_PERMS PROT_READ 86 - 87 - #endif /* _X86_64_ARCHDEP_H_ */
-152
libexec/ld.so/x86_64/ldasm.S
··· 1 - /* $OpenBSD: ldasm.S,v 1.3 2004/02/23 20:52:04 deraadt Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 2002,2004 Dale Rahn 5 - * All rights reserved. 6 - * 7 - * Redistribution and use in source and binary forms, with or without 8 - * modification, are permitted provided that the following conditions 9 - * are met: 10 - * 1. Redistributions of source code must retain the above copyright 11 - * notice, this list of conditions and the following disclaimer. 12 - * 2. Redistributions in binary form must reproduce the above copyright 13 - * notice, this list of conditions and the following disclaimer in the 14 - * documentation and/or other materials provided with the distribution. 15 - * 16 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 17 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 20 - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 - * SUCH DAMAGE. 27 - * 28 - */ 29 - 30 - 31 - #define DL_DATA_SIZE (16*8) /* 16 * sizeof(ELF_Addr) */ 32 - #define DL_LOFF_OFFSET (7*8) /* index 7 */ 33 - #include <sys/syscall.h> 34 - #include <machine/asm.h> 35 - 36 - .text 37 - .align 4 38 - .globl _dl_start 39 - .type _dl_start,@function 40 - _dl_start: 41 - movq %rsp, %r12 # save stack pointer for _rtld 42 - pushq %rbx # save ps_strings 43 - subq $DL_DATA_SIZE, %rsp # allocate dl_data 44 - 45 - leaq _DYNAMIC(%rip),%rdx # &_DYNAMIC 46 - movq %rsp, %rsi # dl_data for dl_boot_bind 47 - movq %r12, %rdi # load saved SP for dl_boot_bind 48 - call _dl_boot_bind@PLT # _dl_boot_bind(sp,dl_data,dynamicp) 49 - 50 - movq %rsi, %rcx # dl_data 51 - movq DL_LOFF_OFFSET(%rsi), %rdx # loff from dl_data 52 - 53 - movq (%r12), %rdi 54 - leaq 16(%r12,%rdi,8), %rsi # envp 55 - movq %r12, %rdi 56 - addq $8,%rdi # argv 57 - call _dl_boot@PLT # _dl_boot(argv,envp,loff,dl_data) 58 - 59 - addq $DL_DATA_SIZE,%rsp # return dl_data 60 - 61 - # popq %rbx # %rbx = ps_strings - XXXDSR 62 - # popq %rdx # %rdx = cleanup - XXXDSR 63 - # popq %rcx # %rcx = obj_main - XXXDSR 64 - movq %r12, %rsp 65 - jmp *%rax 66 - 67 - .section ".text" 68 - 69 - #define DL_SYSCALL(n) DL_SYSCALL2(n,n) 70 - #define DL_SYSCALL2(n,c) \ 71 - .global __CONCAT(_dl_,n) ;\ 72 - .type __CONCAT(_dl_,n), @function ;\ 73 - .align 4 ;\ 74 - __CONCAT(_dl_,n): ;\ 75 - movl $(__CONCAT(SYS_,c)), %eax ;\ 76 - movq %rcx, %r10 ;\ 77 - syscall ;\ 78 - jb 1f ;\ 79 - ret 80 - 81 - DL_SYSCALL(open) 82 - DL_SYSCALL(fcntl) 83 - DL_SYSCALL(fstat) 84 - DL_SYSCALL(stat) 85 - DL_SYSCALL(read) 86 - DL_SYSCALL(write) 87 - DL_SYSCALL(close) 88 - DL_SYSCALL(issetugid) 89 - DL_SYSCALL(getdirentries) 90 - DL_SYSCALL(mprotect) 91 - DL_SYSCALL(munmap) 92 - DL_SYSCALL(exit) 93 - DL_SYSCALL2(_syscall,__syscall) 94 - DL_SYSCALL2(sysctl,__sysctl) 95 - 96 - 1: 97 - /* error: result = -errno; - handled here. */ 98 - neg %rax 99 - ret 100 - 101 - 102 - /* _dl_sigprocmask: does not handle NULL new set */ 103 - 104 - .align 4 105 - .global _dl_sigprocmask 106 - .type _dl_sigprocmask,@function 107 - _dl_sigprocmask: 108 - movq (%rsi),%rsi # fetch indirect... 109 - movl $SYS_sigprocmask, %eax 110 - movq %rcx, %r10 111 - syscall 112 - jc 1b /* error: result = -errno */ 113 - testq %rdx,%rdx # test if old mask requested 114 - jz 2f 115 - movq %rax,(%rdx) # store old mask 116 - xorq %rax,%rax 117 - 2: ret 118 - 119 - .align 4 120 - .global _dl_bind_start 121 - .type _dl_bind_start,@function 122 - _dl_bind_start: 123 - pushfq # save registers 124 - pushq %rax 125 - pushq %rcx 126 - pushq %rdx 127 - pushq %rsi 128 - pushq %rdi 129 - pushq %r8 130 - pushq %r9 131 - pushq %r10 132 - pushq %r11 133 - 134 - movq 80(%rsp), %rdi # Copy of reloff 135 - movq 88(%rsp), %rsi # Copy of obj 136 - call _dl_bind@PLT # Call the binder 137 - movq %rax,88(%rsp) # Store function to be called in obj 138 - 139 - popq %r11 # restore registers 140 - popq %r10 141 - popq %r9 142 - popq %r8 143 - popq %rdi 144 - popq %rsi 145 - popq %rdx 146 - popq %rcx 147 - popq %rax 148 - popfq 149 - 150 - leaq 8(%rsp),%rsp # Discard reloff, do not change eflags 151 - ret 152 -
-454
libexec/ld.so/x86_64/rtld_machine.c
··· 1 - /* $OpenBSD: rtld_machine.c,v 1.5 2004/02/23 20:52:04 deraadt Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 2002,2004 Dale Rahn 5 - * Copyright (c) 2001 Niklas Hallqvist 6 - * Copyright (c) 2001 Artur Grabowski 7 - * 8 - * Redistribution and use in source and binary forms, with or without 9 - * modification, are permitted provided that the following conditions 10 - * are met: 11 - * 1. Redistributions of source code must retain the above copyright 12 - * notice, this list of conditions and the following disclaimer. 13 - * 2. Redistributions in binary form must reproduce the above copyright 14 - * notice, this list of conditions and the following disclaimer in the 15 - * documentation and/or other materials provided with the distribution. 16 - * 17 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 18 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 21 - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 - * SUCH DAMAGE. 28 - */ 29 - /*- 30 - * Copyright (c) 2000 Eduardo Horvath. 31 - * Copyright (c) 1999 The NetBSD Foundation, Inc. 32 - * All rights reserved. 33 - * 34 - * This code is derived from software contributed to The NetBSD Foundation 35 - * by Paul Kranenburg. 36 - * 37 - * Redistribution and use in source and binary forms, with or without 38 - * modification, are permitted provided that the following conditions 39 - * are met: 40 - * 1. Redistributions of source code must retain the above copyright 41 - * notice, this list of conditions and the following disclaimer. 42 - * 2. Redistributions in binary form must reproduce the above copyright 43 - * notice, this list of conditions and the following disclaimer in the 44 - * documentation and/or other materials provided with the distribution. 45 - * 3. All advertising materials mentioning features or use of this software 46 - * must display the following acknowledgement: 47 - * This product includes software developed by the NetBSD 48 - * Foundation, Inc. and its contributors. 49 - * 4. Neither the name of The NetBSD Foundation nor the names of its 50 - * contributors may be used to endorse or promote products derived 51 - * from this software without specific prior written permission. 52 - * 53 - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 54 - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 55 - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 56 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 57 - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 60 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 61 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 62 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 63 - * POSSIBILITY OF SUCH DAMAGE. 64 - */ 65 - 66 - #define _DYN_LOADER 67 - 68 - #include <sys/types.h> 69 - #include <sys/cdefs.h> 70 - #include <sys/mman.h> 71 - 72 - #include <nlist.h> 73 - #include <link.h> 74 - #include <signal.h> 75 - 76 - #include "syscall.h" 77 - #include "archdep.h" 78 - #include "resolve.h" 79 - 80 - void 81 - _dl_bcopy(const void *src, void *dest, int size) 82 - { 83 - const unsigned char *psrc = src; 84 - unsigned char *pdest = dest; 85 - int i; 86 - 87 - for (i = 0; i < size; i++) 88 - pdest[i] = psrc[i]; 89 - } 90 - 91 - /* 92 - * The following table holds for each relocation type: 93 - * - the width in bits of the memory location the relocation 94 - * applies to (not currently used) 95 - * - the number of bits the relocation value must be shifted to the 96 - * right (i.e. discard least significant bits) to fit into 97 - * the appropriate field in the instruction word. 98 - * - flags indicating whether 99 - * * the relocation involves a symbol 100 - * * the relocation is relative to the current position 101 - * * the relocation is for a GOT entry 102 - * * the relocation is relative to the load address 103 - * 104 - */ 105 - #define _RF_S 0x80000000 /* Resolve symbol */ 106 - #define _RF_A 0x40000000 /* Use addend */ 107 - #define _RF_P 0x20000000 /* Location relative */ 108 - #define _RF_G 0x10000000 /* GOT offset */ 109 - #define _RF_B 0x08000000 /* Load address relative */ 110 - #define _RF_U 0x04000000 /* Unaligned */ 111 - #define _RF_E 0x02000000 /* ERROR */ 112 - #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ 113 - #define _RF_RS(s) ((s) & 0xff) /* right shift */ 114 - static int reloc_target_flags[] = { 115 - 0, /* 0 NONE */ 116 - _RF_S|_RF_A| _RF_SZ(64) | _RF_RS(0), /* 1 _64*/ 117 - _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(0), /* 2 PC32 */ 118 - _RF_G|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 3 GOT32 */ 119 - _RF_E|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 4 PLT32 */ 120 - _RF_S| _RF_SZ(32) | _RF_RS(0), /* 5 COPY */ 121 - _RF_S| _RF_SZ(64) | _RF_RS(0), /* 6 GLOB_DAT*/ 122 - _RF_S| _RF_SZ(64) | _RF_RS(0), /* 7 JUMP_SLOT*/ 123 - _RF_A| _RF_B| _RF_SZ(64) | _RF_RS(0), /* 8 RELATIVE*/ 124 - _RF_E, /* 9 GOTPCREL*/ 125 - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 10 32 */ 126 - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 11 32S */ 127 - _RF_S|_RF_A| _RF_SZ(16) | _RF_RS(0), /* 12 16 */ 128 - _RF_S|_RF_A|_RF_P| _RF_SZ(16) | _RF_RS(0), /* 13 PC16 */ 129 - _RF_S|_RF_A| _RF_SZ(8) | _RF_RS(0), /* 14 8 */ 130 - _RF_S|_RF_A|_RF_P| _RF_SZ(8) | _RF_RS(0), /* 15 PC8 */ 131 - _RF_E, /* 16 DPTMOD64*/ 132 - _RF_E, /* 17 DTPOFF64*/ 133 - _RF_E, /* 18 TPOFF64 */ 134 - _RF_E, /* 19 TLSGD */ 135 - _RF_E, /* 20 TLSLD */ 136 - _RF_E, /* 21 DTPOFF32*/ 137 - _RF_E, /* 22 GOTTPOFF*/ 138 - _RF_E /* 23 TPOFF32*/ 139 - }; 140 - 141 - #define RELOC_RESOLVE_SYMBOL(t) ((reloc_target_flags[t] & _RF_S) != 0) 142 - #define RELOC_PC_RELATIVE(t) ((reloc_target_flags[t] & _RF_P) != 0) 143 - #define RELOC_BASE_RELATIVE(t) ((reloc_target_flags[t] & _RF_B) != 0) 144 - #define RELOC_UNALIGNED(t) ((reloc_target_flags[t] & _RF_U) != 0) 145 - #define RELOC_USE_ADDEND(t) ((reloc_target_flags[t] & _RF_A) != 0) 146 - #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) 147 - #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) 148 - #define RELOC_ERROR(t) (reloc_target_flags[t] & _RF_E) 149 - 150 - static long reloc_target_bitmask[] = { 151 - #define _BM(x) (x == 64? ~0 : ~(-(1UL << (x)))) 152 - 0, /* 0 NONE */ 153 - _BM(64), /* 1 _64*/ 154 - _BM(32), /* 2 PC32 */ 155 - _BM(32), /* 3 GOT32 */ 156 - _BM(32), /* 4 PLT32 */ 157 - _BM(0), /* 5 COPY */ 158 - _BM(64), /* 6 GLOB_DAT*/ 159 - _BM(64), /* 7 JUMP_SLOT*/ 160 - _BM(64), /* 8 RELATIVE*/ 161 - _BM(32), /* 9 GOTPCREL*/ 162 - _BM(32), /* 10 32 */ 163 - _BM(32), /* 11 32S */ 164 - _BM(16), /* 12 16 */ 165 - _BM(16), /* 13 PC16 */ 166 - _BM(8), /* 14 8 */ 167 - _BM(8), /* 15 PC8 */ 168 - 0, /* 16 DPTMOD64*/ 169 - 0, /* 17 DTPOFF64*/ 170 - 0, /* 18 TPOFF64 */ 171 - 0, /* 19 TLSGD */ 172 - 0, /* 20 TLSLD */ 173 - 0, /* 21 DTPOFF32*/ 174 - 0, /* 22 GOTTPOFF*/ 175 - 0 /* 23 TPOFF32*/ 176 - #undef _BM 177 - }; 178 - #define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t]) 179 - 180 - void _dl_reloc_plt(Elf_Addr *where, Elf_Addr value); 181 - 182 - int 183 - _dl_md_reloc(elf_object_t *object, int rel, int relsz) 184 - { 185 - long i; 186 - long numrel; 187 - long fails = 0; 188 - Elf_Addr loff; 189 - Elf_RelA *rels; 190 - struct load_list *llist; 191 - 192 - loff = object->load_offs; 193 - numrel = object->Dyn.info[relsz] / sizeof(Elf_RelA); 194 - rels = (Elf_RelA *)(object->Dyn.info[rel]); 195 - if (rels == NULL) 196 - return(0); 197 - 198 - /* 199 - * unprotect some segments if we need it. 200 - */ 201 - if ((rel == DT_REL || rel == DT_RELA)) { 202 - for (llist = object->load_list; llist != NULL; llist = llist->next) { 203 - if (!(llist->prot & PROT_WRITE)) 204 - _dl_mprotect(llist->start, llist->size, 205 - llist->prot|PROT_WRITE); 206 - } 207 - } 208 - 209 - for (i = 0; i < numrel; i++, rels++) { 210 - Elf_Addr *where, value, ooff, mask; 211 - Elf_Word type; 212 - const Elf_Sym *sym, *this; 213 - const char *symn; 214 - 215 - type = ELF_R_TYPE(rels->r_info); 216 - 217 - if (RELOC_ERROR(type)) { 218 - _dl_printf("relocation error %d idx %d\n", type, i); 219 - _dl_exit(20); 220 - } 221 - 222 - if (type == R_TYPE(NONE)) 223 - continue; 224 - 225 - if (type == R_TYPE(JUMP_SLOT) && rel != DT_JMPREL) 226 - continue; 227 - 228 - where = (Elf_Addr *)(rels->r_offset + loff); 229 - 230 - if (RELOC_USE_ADDEND(type)) 231 - value = rels->r_addend; 232 - else 233 - value = 0; 234 - 235 - sym = NULL; 236 - symn = NULL; 237 - if (RELOC_RESOLVE_SYMBOL(type)) { 238 - sym = object->dyn.symtab; 239 - sym += ELF_R_SYM(rels->r_info); 240 - symn = object->dyn.strtab + sym->st_name; 241 - 242 - if (sym->st_shndx != SHN_UNDEF && 243 - ELF_ST_BIND(sym->st_info) == STB_LOCAL) { 244 - value += loff; 245 - } else { 246 - this = NULL; 247 - ooff = _dl_find_symbol_bysym(object, 248 - ELF_R_SYM(rels->r_info), _dl_objects, 249 - &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND| 250 - ((type == R_TYPE(JUMP_SLOT))? 251 - SYM_PLT:SYM_NOTPLT), 252 - sym->st_size); 253 - if (this == NULL) { 254 - resolve_failed: 255 - _dl_printf("%s: %s: can't resolve " 256 - "reference '%s'\n", 257 - _dl_progname, object->load_name, 258 - symn); 259 - fails++; 260 - continue; 261 - } 262 - value += (Elf_Addr)(ooff + this->st_value); 263 - } 264 - } 265 - 266 - if (type == R_TYPE(JUMP_SLOT)) { 267 - _dl_reloc_plt(where, value); 268 - continue; 269 - } 270 - 271 - if (type == R_TYPE(COPY)) { 272 - void *dstaddr = where; 273 - const void *srcaddr; 274 - const Elf_Sym *dstsym = sym, *srcsym = NULL; 275 - size_t size = dstsym->st_size; 276 - Elf_Addr soff; 277 - 278 - soff = _dl_find_symbol(symn, object->next, &srcsym, 279 - SYM_SEARCH_ALL|SYM_WARNNOTFOUND| 280 - ((type == R_TYPE(JUMP_SLOT)) ? SYM_PLT:SYM_NOTPLT), 281 - size, object); 282 - if (srcsym == NULL) 283 - goto resolve_failed; 284 - 285 - srcaddr = (void *)(soff + srcsym->st_value); 286 - _dl_bcopy(srcaddr, dstaddr, size); 287 - continue; 288 - } 289 - 290 - if (RELOC_PC_RELATIVE(type)) 291 - value -= (Elf_Addr)where; 292 - if (RELOC_BASE_RELATIVE(type)) 293 - value += loff; 294 - 295 - mask = RELOC_VALUE_BITMASK(type); 296 - value >>= RELOC_VALUE_RIGHTSHIFT(type); 297 - value &= mask; 298 - 299 - if (RELOC_UNALIGNED(type)) { 300 - /* Handle unaligned relocations. */ 301 - Elf_Addr tmp = 0; 302 - char *ptr = (char *)where; 303 - int i, size = RELOC_TARGET_SIZE(type)/8; 304 - 305 - /* Read it in one byte at a time. */ 306 - for (i=0; i<size; i++) 307 - tmp = (tmp << 8) | ptr[i]; 308 - 309 - tmp &= ~mask; 310 - tmp |= value; 311 - 312 - /* Write it back out. */ 313 - for (i=0; i<size; i++) 314 - ptr[i] = ((tmp >> (8*i)) & 0xff); 315 - } else if (RELOC_TARGET_SIZE(type) > 32) { 316 - *where &= ~mask; 317 - *where |= value; 318 - } else { 319 - Elf32_Addr *where32 = (Elf32_Addr *)where; 320 - 321 - *where32 &= ~mask; 322 - *where32 |= value; 323 - } 324 - } 325 - 326 - /* reprotect the unprotected segments */ 327 - if ((rel == DT_REL || rel == DT_RELA)) { 328 - for (llist = object->load_list; llist != NULL; llist = llist->next) { 329 - if (!(llist->prot & PROT_WRITE)) 330 - _dl_mprotect(llist->start, llist->size, 331 - llist->prot); 332 - } 333 - } 334 - 335 - return (fails); 336 - } 337 - 338 - void 339 - _dl_reloc_plt(Elf_Addr *where, Elf_Addr value) 340 - { 341 - *where = value; 342 - } 343 - 344 - /* 345 - * Resolve a symbol at run-time. 346 - */ 347 - Elf_Addr 348 - _dl_bind(elf_object_t *object, int index) 349 - { 350 - Elf_RelA *rel; 351 - Elf_Word *addr; 352 - const Elf_Sym *sym, *this; 353 - const char *symn; 354 - Elf_Addr ooff, newval; 355 - sigset_t omask, nmask; 356 - 357 - rel = (Elf_RelA *)(object->Dyn.info[DT_JMPREL]); 358 - 359 - rel += index; 360 - 361 - sym = object->dyn.symtab; 362 - sym += ELF_R_SYM(rel->r_info); 363 - symn = object->dyn.strtab + sym->st_name; 364 - 365 - addr = (Elf_Word *)(object->load_offs + rel->r_offset); 366 - this = NULL; 367 - ooff = _dl_find_symbol(symn, _dl_objects, &this, 368 - SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym->st_size, object); 369 - if (this == NULL) { 370 - _dl_printf("lazy binding failed!\n"); 371 - *((int *)0) = 0; /* XXX */ 372 - } 373 - 374 - newval = ooff + this->st_value + rel->r_addend; 375 - 376 - /* if GOT is protected, allow the write */ 377 - if (object->got_size != 0) { 378 - sigfillset(&nmask); 379 - _dl_sigprocmask(SIG_BLOCK, &nmask, &omask); 380 - _dl_mprotect((void*)object->got_start, object->got_size, 381 - PROT_READ|PROT_WRITE); 382 - } 383 - 384 - _dl_reloc_plt((Elf_Addr *)addr, newval); 385 - 386 - /* put the GOT back to RO */ 387 - if (object->got_size != 0) { 388 - _dl_mprotect((void*)object->got_start, object->got_size, 389 - PROT_READ); 390 - _dl_sigprocmask(SIG_SETMASK, &omask, NULL); 391 - } 392 - 393 - return(newval); 394 - } 395 - 396 - void 397 - _dl_md_reloc_got(elf_object_t *object, int lazy) 398 - { 399 - extern void _dl_bind_start(void); /* XXX */ 400 - Elf_Addr *pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT]; 401 - int i, num; 402 - Elf_RelA *rel; 403 - Elf_Addr ooff; 404 - const Elf_Sym *this; 405 - 406 - if (pltgot == NULL) 407 - return; /* it is possible to have no PLT/GOT relocations */ 408 - 409 - pltgot[1] = (Elf_Addr)object; 410 - pltgot[2] = (Elf_Addr)&_dl_bind_start; 411 - 412 - if (object->Dyn.info[DT_PLTREL] != DT_RELA) 413 - return; 414 - 415 - object->got_addr = NULL; 416 - object->got_size = 0; 417 - this = NULL; 418 - ooff = _dl_find_symbol("__got_start", object, &this, 419 - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); 420 - if (this != NULL) 421 - object->got_addr = ooff + this->st_value; 422 - 423 - this = NULL; 424 - ooff = _dl_find_symbol("__got_end", object, &this, 425 - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); 426 - if (this != NULL) 427 - object->got_size = ooff + this->st_value - object->got_addr; 428 - 429 - if (object->got_addr == NULL) 430 - object->got_start = NULL; 431 - else { 432 - object->got_start = ELF_TRUNC(object->got_addr, _dl_pagesz); 433 - object->got_size += object->got_addr - object->got_start; 434 - object->got_size = ELF_ROUND(object->got_size, _dl_pagesz); 435 - } 436 - 437 - if (!lazy) { 438 - _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ); 439 - } else { 440 - rel = (Elf_RelA *)(object->Dyn.info[DT_JMPREL]); 441 - num = (object->Dyn.info[DT_PLTRELSZ]); 442 - for (i = 0; i < num/sizeof(Elf_RelA); i++, rel++) { 443 - Elf_Addr *where; 444 - where = (Elf_Addr *)(rel->r_offset + object->load_offs); 445 - *where += object->load_offs; 446 - } 447 - 448 - } 449 - 450 - /* PLT is already RO on i386, no point in mprotecting it, just GOT */ 451 - if (object->got_size != 0) 452 - _dl_mprotect((void*)object->got_start, object->got_size, 453 - PROT_READ); 454 - }
-63
libexec/ld.so/x86_64/syscall.h
··· 1 - /* $OpenBSD: syscall.h,v 1.2 2004/02/23 20:52:05 deraadt Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 2001 Niklas Hallqvist 5 - * 6 - * Redistribution and use in source and binary forms, with or without 7 - * modification, are permitted provided that the following conditions 8 - * are met: 9 - * 1. Redistributions of source code must retain the above copyright 10 - * notice, this list of conditions and the following disclaimer. 11 - * 2. Redistributions in binary form must reproduce the above copyright 12 - * notice, this list of conditions and the following disclaimer in the 13 - * documentation and/or other materials provided with the distribution. 14 - * 15 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 16 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 19 - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 - * SUCH DAMAGE. 26 - * 27 - */ 28 - 29 - #ifndef __DL_SYSCALL_H__ 30 - #define __DL_SYSCALL_H__ 31 - 32 - #include <sys/syscall.h> 33 - #include <sys/stat.h> 34 - #include <sys/signal.h> 35 - 36 - #ifndef _dl_MAX_ERRNO 37 - #define _dl_MAX_ERRNO 4096 38 - #endif 39 - #define _dl_check_error(__res) \ 40 - ((int) __res < 0 && (int) __res >= -_dl_MAX_ERRNO) 41 - 42 - int _dl_close(int); 43 - int _dl_exit(int); 44 - int _dl_issetugid(void); 45 - long _dl__syscall(quad_t, ...); 46 - int _dl_mprotect(const void *, int, int); 47 - int _dl_munmap(const void *, unsigned int); 48 - int _dl_open(const char *, unsigned int); 49 - int _dl_read(int, const char *, int); 50 - int _dl_stat(const char *, struct stat *); 51 - int _dl_fstat(int, struct stat *); 52 - int _dl_fcntl(int, int, ...); 53 - int _dl_getdirentries(int, char*, int, long *); 54 - int _dl_sigprocmask(int, const sigset_t *, sigset_t *); 55 - int _dl_sysctl(int *, u_int, void *, size_t *, void *, size_t); 56 - 57 - static inline off_t 58 - _dl_lseek(int fildes, off_t offset, int whence) 59 - { 60 - return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence); 61 - } 62 - 63 - #endif /*__DL_SYSCALL_H__*/
+2 -2
regress/sys/kern/noexec/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.7 2004/02/23 08:06:56 deraadt Exp $ 1 + # $OpenBSD: Makefile,v 1.8 2004/02/27 17:36:15 deraadt Exp $ 2 2 3 3 .if ${MACHINE} == "sparc64" || ${MACHINE} == "sparc" || \ 4 4 ${MACHINE} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \ 5 - ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "i386" || \ 5 + ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" || \ 6 6 ${MACHINE} == "hppa" 7 7 8 8 PROG= noexec
+5 -3
share/mk/bsd.own.mk
··· 1 - # $OpenBSD: bsd.own.mk,v 1.79 2004/02/21 03:04:18 deraadt Exp $ 1 + # $OpenBSD: bsd.own.mk,v 1.80 2004/02/27 17:36:16 deraadt Exp $ 2 2 # $NetBSD: bsd.own.mk,v 1.24 1996/04/13 02:08:09 thorpej Exp $ 3 3 4 4 # Host-specific overrides ··· 31 31 .if ( ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "arm" || \ 32 32 ${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "i386" || \ 33 33 ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc" || \ 34 - ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64") 34 + ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64") || \ 35 + ${MACHINE} == "amd64" 35 36 ELF_TOOLCHAIN?= yes 36 37 .else 37 38 ELF_TOOLCHAIN?= no ··· 39 40 40 41 # do the dew 41 42 .if (${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "hppa64" || \ 42 - ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64") 43 + ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64") || \ 44 + ${MACHINE} == "amd64" 43 45 USE_GCC3?=yes 44 46 .else 45 47 USE_GCC3?=no
+2 -2
sys/compat/common/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.15 2004/01/28 01:39:39 mickey Exp $ 1 + # $OpenBSD: Makefile,v 1.16 2004/02/27 17:36:16 deraadt Exp $ 2 2 # $NetBSD: Makefile,v 1.8 1996/05/18 15:52:19 christos Exp $ 3 3 4 4 LIB= compat ··· 15 15 vfs_syscalls_25.c vfs_syscalls_43.c vm_43.c 16 16 17 17 # really, all machines where sizeof(int) != sizeof(long) 18 - .if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "x86_64") && \ 18 + .if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "amd64") && \ 19 19 (${MACHINE_ARCH} != "sparc64") 20 20 SRCS+= kern_ipc_10.c 21 21 .endif
-14
sys/lib/libkern/arch/x86_64/Makefile.inc
··· 1 - # $NetBSD: Makefile.inc,v 1.2 2002/11/25 00:55:22 fvdl Exp $ 2 - 3 - SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 4 - byte_swap_2.S byte_swap_4.S \ 5 - bcmp.S bcopy.S bzero.S ffs.S \ 6 - memchr.S memcmp.S memcpy.S memmove.S memset.S \ 7 - ovbcopy.S \ 8 - strcat.S strchr.S strcmp.S \ 9 - strcpy.S strlcpy.c strlcat.c strlen.S \ 10 - strncasecmp.c strncmp.c strncpy.c strrchr.S \ 11 - scanc.S skpc.S random.c 12 - # bswap64.c strcasecmp.c strncasecmp.c \ strtoul.c \ 13 - 14 - CFLAGS+=-mcmodel=kernel
-24
sys/lib/libkern/arch/x86_64/bcmp.S
··· 1 - #include <machine/asm.h> 2 - 3 - #if defined(LIBC_SCCS) 4 - RCSID("$NetBSD: bcmp.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") 5 - #endif 6 - 7 - ENTRY(bcmp) 8 - xorl %eax,%eax /* clear return value */ 9 - cld /* set compare direction forward */ 10 - 11 - movq %rdx,%rcx /* compare by words */ 12 - shrq $3,%rcx 13 - repe 14 - cmpsq 15 - jne L1 16 - 17 - movq %rdx,%rcx /* compare remainder by bytes */ 18 - andq $7,%rcx 19 - repe 20 - cmpsb 21 - je L2 22 - 23 - L1: incl %eax 24 - L2: ret
-101
sys/lib/libkern/arch/x86_64/bcopy.S
··· 1 - /*- 2 - * Copyright (c) 1990 The Regents of the University of California. 3 - * All rights reserved. 4 - * 5 - * This code is derived from locore.s. 6 - * 7 - * Redistribution and use in source and binary forms, with or without 8 - * modification, are permitted provided that the following conditions 9 - * are met: 10 - * 1. Redistributions of source code must retain the above copyright 11 - * notice, this list of conditions and the following disclaimer. 12 - * 2. Redistributions in binary form must reproduce the above copyright 13 - * notice, this list of conditions and the following disclaimer in the 14 - * documentation and/or other materials provided with the distribution. 15 - * 3. All advertising materials mentioning features or use of this software 16 - * must display the following acknowledgement: 17 - * This product includes software developed by the University of 18 - * California, Berkeley and its contributors. 19 - * 4. Neither the name of the University nor the names of its contributors 20 - * may be used to endorse or promote products derived from this software 21 - * without specific prior written permission. 22 - * 23 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 - * SUCH DAMAGE. 34 - */ 35 - 36 - #include <machine/asm.h> 37 - 38 - #if defined(LIBC_SCCS) 39 - RCSID("$NetBSD: bcopy.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") 40 - #endif 41 - 42 - /* 43 - * (ov)bcopy (src,dst,cnt) 44 - * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 45 - */ 46 - 47 - #ifdef MEMCOPY 48 - ENTRY(memcpy) 49 - #else 50 - #ifdef MEMMOVE 51 - ENTRY(memmove) 52 - #else 53 - #ifdef OVBCOPY 54 - ENTRY(ovbcopy) 55 - #else 56 - ENTRY(bcopy) 57 - #endif 58 - #endif 59 - #endif 60 - #if defined(MEMCOPY) || defined(MEMMOVE) 61 - movq %rdi,%r11 /* save dest */ 62 - #else 63 - xchgq %rdi,%rsi 64 - #endif 65 - movq %rdx,%rcx 66 - movq %rdi,%rax 67 - subq %rsi,%rax 68 - cmpq %rcx,%rax /* overlapping? */ 69 - jb 1f 70 - cld /* nope, copy forwards. */ 71 - shrq $3,%rcx /* copy by words */ 72 - rep 73 - movsq 74 - movq %rdx,%rcx 75 - andq $7,%rcx /* any bytes left? */ 76 - rep 77 - movsb 78 - #if defined(MEMCOPY) || defined(MEMMOVE) 79 - movq %r11,%rax 80 - #endif 81 - ret 82 - 1: 83 - addq %rcx,%rdi /* copy backwards. */ 84 - addq %rcx,%rsi 85 - std 86 - andq $7,%rcx /* any fractional bytes? */ 87 - decq %rdi 88 - decq %rsi 89 - rep 90 - movsb 91 - movq %rdx,%rcx /* copy remainder by words */ 92 - shrq $3,%rcx 93 - subq $7,%rsi 94 - subq $7,%rdi 95 - rep 96 - movsq 97 - #if defined(MEMCOPY) || defined(MEMMOVE) 98 - movq %r11,%rax 99 - #endif 100 - cld 101 - ret
-52
sys/lib/libkern/arch/x86_64/byte_swap_2.S
··· 1 - /* $NetBSD: byte_swap_2.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 1990 The Regents of the University of California. 5 - * All rights reserved. 6 - * 7 - * This code is derived from software contributed to Berkeley by 8 - * William Jolitz. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed by the University of 21 - * California, Berkeley and its contributors. 22 - * 4. Neither the name of the University nor the names of its contributors 23 - * may be used to endorse or promote products derived from this software 24 - * without specific prior written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 - * SUCH DAMAGE. 37 - * 38 - * from: @(#)htons.s 5.2 (Berkeley) 12/17/90 39 - */ 40 - 41 - #include <machine/asm.h> 42 - #if defined(LIBC_SCCS) 43 - RCSID("$NetBSD: byte_swap_2.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") 44 - #endif 45 - 46 - _ENTRY(_C_LABEL(bswap16)) 47 - _ENTRY(_C_LABEL(ntohs)) 48 - _ENTRY(_C_LABEL(htons)) 49 - _PROF_PROLOGUE 50 - movl %edi,%eax 51 - xchgb %ah,%al 52 - ret
-52
sys/lib/libkern/arch/x86_64/byte_swap_4.S
··· 1 - /* $NetBSD: byte_swap_4.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 1990 The Regents of the University of California. 5 - * All rights reserved. 6 - * 7 - * This code is derived from software contributed to Berkeley by 8 - * William Jolitz. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed by the University of 21 - * California, Berkeley and its contributors. 22 - * 4. Neither the name of the University nor the names of its contributors 23 - * may be used to endorse or promote products derived from this software 24 - * without specific prior written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 - * SUCH DAMAGE. 37 - * 38 - * from: @(#)htonl.s 5.3 (Berkeley) 12/17/90 39 - */ 40 - 41 - #include <machine/asm.h> 42 - #if defined(LIBC_SCCS) 43 - RCSID("$NetBSD: byte_swap_4.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") 44 - #endif 45 - 46 - _ENTRY(_C_LABEL(bswap32)) 47 - _ENTRY(_C_LABEL(ntohl)) 48 - _ENTRY(_C_LABEL(htonl)) 49 - _PROF_PROLOGUE 50 - movl %edi,%eax 51 - bswap %eax 52 - ret
-44
sys/lib/libkern/arch/x86_64/bzero.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: bzero.S,v 1.1 2001/06/19 00:22:45 fvdl Exp $") 11 - #endif 12 - 13 - ENTRY(bzero) 14 - movq %rsi,%rdx 15 - 16 - cld /* set fill direction forward */ 17 - xorq %rax,%rax /* set fill data to 0 */ 18 - 19 - /* 20 - * if the string is too short, it's really not worth the overhead 21 - * of aligning to word boundries, etc. So we jump to a plain 22 - * unaligned set. 23 - */ 24 - cmpq $16,%rdx 25 - jb L1 26 - 27 - movq %rdi,%rcx /* compute misalignment */ 28 - negq %rcx 29 - andq $7,%rcx 30 - subq %rcx,%rdx 31 - rep /* zero until word aligned */ 32 - stosb 33 - 34 - movq %rdx,%rcx /* zero by words */ 35 - shrq $3,%rcx 36 - andq $7,%rdx 37 - rep 38 - stosq 39 - 40 - L1: movq %rdx,%rcx /* zero remainder by bytes */ 41 - rep 42 - stosb 43 - 44 - ret
-21
sys/lib/libkern/arch/x86_64/ffs.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: ffs.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") 11 - #endif 12 - 13 - ENTRY(ffs) 14 - bsfl %edi,%eax 15 - jz L1 /* ZF is set if all bits are 0 */ 16 - incl %eax /* bits numbered from 1, not 0 */ 17 - ret 18 - 19 - _ALIGN_TEXT 20 - L1: xorl %eax,%eax /* clear result */ 21 - ret
-29
sys/lib/libkern/arch/x86_64/index.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: index.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") 11 - #endif 12 - 13 - #ifdef STRCHR 14 - ENTRY(strchr) 15 - #else 16 - ENTRY(index) 17 - #endif 18 - movq %rdi,%rax 19 - movb %sil,%cl 20 - L1: 21 - movb (%rax),%dl 22 - cmpb %dl,%cl /* found char? */ 23 - je L2 24 - incq %rax 25 - testb %dl,%dl /* null terminator? */ 26 - jnz L1 27 - xorq %rax,%rax 28 - L2: 29 - ret
-25
sys/lib/libkern/arch/x86_64/memchr.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: memchr.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") 11 - #endif 12 - 13 - ENTRY(memchr) 14 - movb %sil,%al /* set character to search for */ 15 - movq %rdx,%rcx /* set length of search */ 16 - testq %rcx,%rcx /* test for len == 0 */ 17 - jz L1 18 - cld /* set search forward */ 19 - repne /* search! */ 20 - scasb 21 - jne L1 /* scan failed, return null */ 22 - leaq -1(%rdi),%rax /* adjust result of scan */ 23 - ret 24 - L1: xorq %rax,%rax 25 - ret
-40
sys/lib/libkern/arch/x86_64/memcmp.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: memcmp.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") 11 - #endif 12 - 13 - ENTRY(memcmp) 14 - cld /* set compare direction forward */ 15 - movq %rdx,%rcx /* compare by longs */ 16 - shrq $3,%rcx 17 - repe 18 - cmpsq 19 - jne L5 /* do we match so far? */ 20 - 21 - movq %rdx,%rcx /* compare remainder by bytes */ 22 - andq $7,%rcx 23 - repe 24 - cmpsb 25 - jne L6 /* do we match? */ 26 - 27 - xorl %eax,%eax /* we match, return zero */ 28 - ret 29 - 30 - L5: movl $8,%ecx /* We know that one of the next */ 31 - subq %rcx,%rdi /* eight pairs of bytes do not */ 32 - subq %rcx,%rsi /* match. */ 33 - repe 34 - cmpsb 35 - L6: xorl %eax,%eax /* Perform unsigned comparison */ 36 - movb -1(%rdi),%al 37 - xorl %edx,%edx 38 - movb -1(%rsi),%dl 39 - subl %edx,%eax 40 - ret
-4
sys/lib/libkern/arch/x86_64/memcpy.S
··· 1 - /* $NetBSD: memcpy.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $ */ 2 - 3 - #define MEMCOPY 4 - #include "bcopy.S"
-4
sys/lib/libkern/arch/x86_64/memmove.S
··· 1 - /* $NetBSD: memmove.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $ */ 2 - 3 - #define MEMMOVE 4 - #include "bcopy.S"
-58
sys/lib/libkern/arch/x86_64/memset.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: memset.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $") 11 - #endif 12 - 13 - ENTRY(memset) 14 - movq %rsi,%rax 15 - movq %rdx,%rcx 16 - movq %rdi,%r11 17 - 18 - cld /* set fill direction forward */ 19 - 20 - /* 21 - * if the string is too short, it's really not worth the overhead 22 - * of aligning to word boundries, etc. So we jump to a plain 23 - * unaligned set. 24 - */ 25 - cmpq $0x0f,%rcx 26 - jle L1 27 - 28 - movb %al,%ah /* copy char to all bytes in word */ 29 - movl %eax,%edx 30 - sall $16,%eax 31 - orl %edx,%eax 32 - 33 - movl %eax,%edx 34 - salq $32,%rax 35 - orq %rdx,%rax 36 - 37 - movq %rdi,%rdx /* compute misalignment */ 38 - negq %rdx 39 - andq $7,%rdx 40 - movq %rcx,%r8 41 - subq %rdx,%r8 42 - 43 - movq %rdx,%rcx /* set until word aligned */ 44 - rep 45 - stosb 46 - 47 - movq %r8,%rcx 48 - shrq $3,%rcx /* set by words */ 49 - rep 50 - stosq 51 - 52 - movq %r8,%rcx /* set remainder by bytes */ 53 - andq $7,%rcx 54 - L1: rep 55 - stosb 56 - movq %r11,%rax 57 - 58 - ret
-4
sys/lib/libkern/arch/x86_64/ovbcopy.S
··· 1 - /* $NetBSD: memmove.S,v 1.1 2001/06/19 00:22:46 fvdl Exp $ */ 2 - 3 - #define OVBCOPY 4 - #include "bcopy.S"
-29
sys/lib/libkern/arch/x86_64/rindex.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: rindex.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") 11 - #endif 12 - 13 - #ifdef STRRCHR 14 - ENTRY(strrchr) 15 - #else 16 - ENTRY(rindex) 17 - #endif 18 - movb %sil,%cl 19 - xorq %rax,%rax /* init pointer to null */ 20 - L1: 21 - movb (%rdi),%dl 22 - cmpb %dl,%cl 23 - jne L2 24 - movq %rdi,%rax 25 - L2: 26 - incq %rdi 27 - testb %dl,%dl /* null terminator??? */ 28 - jnz L1 29 - ret
-62
sys/lib/libkern/arch/x86_64/scanc.S
··· 1 - /* $NetBSD: scanc.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 - * All rights reserved. 6 - * 7 - * This code is derived from software contributed to The NetBSD Foundation 8 - * by Charles M. Hannum. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed by the NetBSD 21 - * Foundation, Inc. and its contributors. 22 - * 4. Neither the name of The NetBSD Foundation nor the names of its 23 - * contributors may be used to endorse or promote products derived 24 - * from this software without specific prior written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 - * POSSIBILITY OF SUCH DAMAGE. 37 - */ 38 - 39 - /* 40 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 41 - */ 42 - 43 - #include <machine/asm.h> 44 - 45 - ENTRY(scanc) 46 - movq %rdx,%r11 47 - movb %cl,%dl 48 - movl %edi,%ecx 49 - testl %ecx,%ecx 50 - jz 2f 51 - movq %r11,%rdi 52 - xorq %rax,%rax 53 - cld 54 - 1: 55 - lodsb 56 - testb %dl,(%rax,%rdi) 57 - jnz 2f 58 - decl %ecx 59 - jnz 1b 60 - 2: 61 - movl %ecx,%eax 62 - ret
-56
sys/lib/libkern/arch/x86_64/skpc.S
··· 1 - /* $NetBSD: skpc.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ 2 - 3 - /*- 4 - * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 - * All rights reserved. 6 - * 7 - * This code is derived from software contributed to The NetBSD Foundation 8 - * by Charles M. Hannum. 9 - * 10 - * Redistribution and use in source and binary forms, with or without 11 - * modification, are permitted provided that the following conditions 12 - * are met: 13 - * 1. Redistributions of source code must retain the above copyright 14 - * notice, this list of conditions and the following disclaimer. 15 - * 2. Redistributions in binary form must reproduce the above copyright 16 - * notice, this list of conditions and the following disclaimer in the 17 - * documentation and/or other materials provided with the distribution. 18 - * 3. All advertising materials mentioning features or use of this software 19 - * must display the following acknowledgement: 20 - * This product includes software developed by the NetBSD 21 - * Foundation, Inc. and its contributors. 22 - * 4. Neither the name of The NetBSD Foundation nor the names of its 23 - * contributors may be used to endorse or promote products derived 24 - * from this software without specific prior written permission. 25 - * 26 - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 - * POSSIBILITY OF SUCH DAMAGE. 37 - */ 38 - 39 - /* 40 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 41 - */ 42 - 43 - #include <machine/asm.h> 44 - 45 - ENTRY(skpc) 46 - movl %edi,%eax 47 - movq %rsi,%rcx 48 - movq %rdx,%rdi 49 - cld 50 - repe 51 - scasb 52 - je 1f 53 - incq %rcx 54 - 1: 55 - movl %ecx,%eax 56 - ret
-65
sys/lib/libkern/arch/x86_64/strcat.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: strcat.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") 11 - #endif 12 - 13 - /* 14 - * NOTE: I've unrolled the loop eight times: large enough to make a 15 - * significant difference, and small enough not to totally trash the 16 - * cache. 17 - */ 18 - 19 - ENTRY(strcat) 20 - movq %rdi,%r11 21 - 22 - cld /* set search forward */ 23 - xorl %eax,%eax /* set search for null terminator */ 24 - movq $-1,%rcx /* set search for lots of characters */ 25 - repne /* search! */ 26 - scasb 27 - 28 - decq %rdi 29 - 30 - L1: movb (%rsi),%al /* unroll loop, but not too much */ 31 - movb %al,(%rdi) 32 - testb %al,%al 33 - jz L2 34 - movb 1(%rsi),%al 35 - movb %al,1(%rdi) 36 - testb %al,%al 37 - jz L2 38 - movb 2(%rsi),%al 39 - movb %al,2(%rdi) 40 - testb %al,%al 41 - jz L2 42 - movb 3(%rsi),%al 43 - movb %al,3(%rdi) 44 - testb %al,%al 45 - jz L2 46 - movb 4(%rsi),%al 47 - movb %al,4(%rdi) 48 - testb %al,%al 49 - jz L2 50 - movb 5(%rsi),%al 51 - movb %al,5(%rdi) 52 - testb %al,%al 53 - jz L2 54 - movb 6(%rsi),%al 55 - movb %al,6(%rdi) 56 - testb %al,%al 57 - jz L2 58 - movb 7(%rsi),%al 59 - movb %al,7(%rdi) 60 - addq $8,%rsi 61 - addq $8,%rdi 62 - testb %al,%al 63 - jnz L1 64 - L2: movq %r11,%rax 65 - ret
-4
sys/lib/libkern/arch/x86_64/strchr.S
··· 1 - /* $NetBSD: strchr.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ 2 - 3 - #define STRCHR 4 - #include "index.S"
-88
sys/lib/libkern/arch/x86_64/strcmp.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: strcmp.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") 11 - #endif 12 - 13 - /* 14 - * NOTE: I've unrolled the loop eight times: large enough to make a 15 - * significant difference, and small enough not to totally trash the 16 - * cache. 17 - */ 18 - 19 - ENTRY(strcmp) 20 - jmp L2 /* Jump into the loop. */ 21 - 22 - L1: incq %rdi 23 - incq %rsi 24 - L2: movb (%rdi),%cl 25 - testb %cl,%cl /* null terminator */ 26 - jz L3 27 - cmpb %cl,(%rsi) /* chars match */ 28 - jne L3 29 - 30 - incq %rdi 31 - incq %rsi 32 - movb (%rdi),%cl 33 - testb %cl,%cl 34 - jz L3 35 - cmpb %cl,(%rsi) 36 - jne L3 37 - 38 - incq %rdi 39 - incq %rsi 40 - movb (%rdi),%cl 41 - testb %cl,%cl 42 - jz L3 43 - cmpb %cl,(%rsi) 44 - jne L3 45 - 46 - incq %rdi 47 - incq %rsi 48 - movb (%rdi),%cl 49 - testb %cl,%cl 50 - jz L3 51 - cmpb %cl,(%rsi) 52 - jne L3 53 - 54 - incq %rdi 55 - incq %rsi 56 - movb (%rdi),%cl 57 - testb %cl,%cl 58 - jz L3 59 - cmpb %cl,(%rsi) 60 - jne L3 61 - 62 - incq %rdi 63 - incq %rsi 64 - movb (%rdi),%cl 65 - testb %cl,%cl 66 - jz L3 67 - cmpb %cl,(%rsi) 68 - jne L3 69 - 70 - incq %rdi 71 - incq %rsi 72 - movb (%rdi),%cl 73 - testb %cl,%cl 74 - jz L3 75 - cmpb %cl,(%rsi) 76 - jne L3 77 - 78 - incq %rdi 79 - incq %rsi 80 - movb (%rdi),%cl 81 - testb %cl,%cl 82 - jz L3 83 - cmpb %cl,(%rsi) 84 - je L1 85 - L3: movzbl (%rdi),%eax /* unsigned comparison */ 86 - movzbl (%rsi),%edx 87 - subl %edx,%eax 88 - ret
-57
sys/lib/libkern/arch/x86_64/strcpy.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: strcpy.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") 11 - #endif 12 - 13 - /* 14 - * NOTE: I've unrolled the loop eight times: large enough to make a 15 - * significant difference, and small enough not to totally trash the 16 - * cache. 17 - */ 18 - 19 - ENTRY(strcpy) 20 - movq %rdi,%r11 21 - 22 - L1: movb (%rsi),%al /* unroll loop, but not too much */ 23 - movb %al,(%rdi) 24 - testb %al,%al 25 - jz L2 26 - movb 1(%rsi),%al 27 - movb %al,1(%rdi) 28 - testb %al,%al 29 - jz L2 30 - movb 2(%rsi),%al 31 - movb %al,2(%rdi) 32 - testb %al,%al 33 - jz L2 34 - movb 3(%rsi),%al 35 - movb %al,3(%rdi) 36 - testb %al,%al 37 - jz L2 38 - movb 4(%rsi),%al 39 - movb %al,4(%rdi) 40 - testb %al,%al 41 - jz L2 42 - movb 5(%rsi),%al 43 - movb %al,5(%rdi) 44 - testb %al,%al 45 - jz L2 46 - movb 6(%rsi),%al 47 - movb %al,6(%rdi) 48 - testb %al,%al 49 - jz L2 50 - movb 7(%rsi),%al 51 - movb %al,7(%rdi) 52 - addq $8,%rsi 53 - addq $8,%rdi 54 - testb %al,%al 55 - jnz L1 56 - L2: movq %r11,%rax 57 - ret
-21
sys/lib/libkern/arch/x86_64/strlen.S
··· 1 - /* 2 - * Written by J.T. Conklin <jtc@netbsd.org>. 3 - * Public domain. 4 - * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com> 5 - */ 6 - 7 - #include <machine/asm.h> 8 - 9 - #if defined(LIBC_SCCS) 10 - RCSID("$NetBSD: strlen.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $") 11 - #endif 12 - 13 - ENTRY(strlen) 14 - cld /* set search forward */ 15 - xorl %eax,%eax /* set search for null terminator */ 16 - movq $-1,%rcx /* set search for lots of characters */ 17 - repne /* search! */ 18 - scasb 19 - notq %rcx /* get length by taking complement */ 20 - leaq -1(%rcx),%rax /* and subtracting one */ 21 - ret
-4
sys/lib/libkern/arch/x86_64/strrchr.S
··· 1 - /* $NetBSD: strrchr.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $ */ 2 - 3 - #define STRRCHR 4 - #include "rindex.S"
+2 -2
sys/sys/exec_aout.h
··· 1 - /* $OpenBSD: exec_aout.h,v 1.18 2004/02/19 23:45:08 deraadt Exp $ */ 1 + /* $OpenBSD: exec_aout.h,v 1.19 2004/02/27 17:36:16 deraadt Exp $ */ 2 2 /* $NetBSD: exec_aout.h,v 1.15 1996/05/18 17:20:54 christos Exp $ */ 3 3 4 4 /* ··· 82 82 #define MID_MIPS2 152 /* MIPS2 */ 83 83 #define MID_M88K 153 /* m88k BSD binary */ 84 84 #define MID_HPPA 154 /* hppa */ 85 - #define MID_X86_64 157 /* AMD x86-64 */ 85 + #define MID_AMD64 157 /* AMD64 */ 86 86 #define MID_HP200 200 /* hp200 (68010) BSD binary */ 87 87 #define MID_HP300 300 /* hp300 (68020+68881) BSD binary */ 88 88 #define MID_HPUX 0x20C /* hp200/300 HP-UX binary */
+2 -2
sys/sys/exec_elf.h
··· 1 - /* $OpenBSD: exec_elf.h,v 1.38 2004/01/29 23:15:53 drahn Exp $ */ 1 + /* $OpenBSD: exec_elf.h,v 1.39 2004/02/27 17:36:16 deraadt Exp $ */ 2 2 /* 3 3 * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved. 4 4 * ··· 191 191 #define EM_ALPHA 41 /* DEC ALPHA */ 192 192 #define EM_SPARCV9 43 /* SPARC version 9 */ 193 193 #define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */ 194 - #define EM_X86_64 62 /* AMD x86-64 architecture */ 194 + #define EM_AMD64 62 /* AMD64 architecture */ 195 195 #define EM_VAX 75 /* DEC VAX */ 196 196 #define EM_NUM 15 /* number of machine types */ 197 197
+7
usr.bin/gprof/amd64.c
··· 1 + #include "gprof.h" 2 + 3 + void 4 + findcall(nltype *parentp, unsigned long p_lowpc, unsigned long p_highpc) 5 + { 6 + /* not supported. */ 7 + }
-3
usr.bin/pmdb/arch/x86_64/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.1 2004/01/29 12:44:40 mickey Exp $ 2 - 3 - SRCS+= x86_64.c
-29
usr.bin/pmdb/arch/x86_64/pmdb_machdep.h
··· 1 - /* $OpenBSD: pmdb_machdep.h,v 1.1 2004/01/29 12:44:40 mickey Exp $ */ 2 - /* 3 - * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> 4 - * All rights reserved. 5 - * 6 - * Redistribution and use in source and binary forms, with or without 7 - * modification, are permitted provided that the following conditions 8 - * are met: 9 - * 10 - * 1. Redistributions of source code must retain the above copyright 11 - * notice, this list of conditions and the following disclaimer. 12 - * 2. The name of the author may not be used to endorse or promote products 13 - * derived from this software without specific prior written permission. 14 - * 15 - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 16 - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 17 - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 18 - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 - */ 26 - 27 - #define BREAKPOINT { 0xcc } 28 - #define BREAKPOINT_LEN 1 29 - #define BREAKPOINT_DECR_PC 1
-94
usr.bin/pmdb/arch/x86_64/x86_64.c
··· 1 - /* $OpenBSD: x86_64.c,v 1.2 2004/02/10 23:36:02 mickey Exp $ */ 2 - 3 - /* 4 - * Copyright (c) 2002 Federico Schwindt <fgsch@openbsd.org> 5 - * All rights reserved. 6 - * 7 - * Redistribution and use in source and binary forms, with or without 8 - * modification, are permitted provided that the following conditions 9 - * are met: 10 - * 11 - * 1. Redistributions of source code must retain the above copyright 12 - * notice, this list of conditions and the following disclaimer. 13 - * 2. The name of the author may not be used to endorse or promote products 14 - * derived from this software without specific prior written permission. 15 - * 16 - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 17 - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 18 - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 22 - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23 - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 - */ 27 - 28 - #include <sys/param.h> 29 - #include <sys/ptrace.h> 30 - #include <machine/reg.h> 31 - #include <machine/frame.h> 32 - #include <string.h> 33 - #include "pmdb.h" 34 - 35 - /* 36 - * No frame for x86? 37 - */ 38 - struct frame { 39 - long fp; 40 - long pc; 41 - }; 42 - 43 - static const char *md_reg_names[] = { 44 - "%rdi", "%rsi", "%rdx", "%rcx", "%r8", "%r9", "%r10", "%r11", 45 - "%r12", "%r13", "%r14", "%r15", "%rbp", "%rbx", "%rax", "%rsp", 46 - "%rip", "%rflags", "%cs", "%ss", "%ds", "%es", "%fs", "%gs", 47 - }; 48 - 49 - struct md_def md_def = { md_reg_names, 16, 8 }; 50 - 51 - void 52 - md_def_init(void) 53 - { 54 - /* no need to do anything */ 55 - } 56 - 57 - int 58 - md_getframe(struct pstate *ps, int frame, struct md_frame *fram) 59 - { 60 - struct frame fr; 61 - struct reg r; 62 - int count; 63 - 64 - if (process_getregs(ps, &r) != 0) 65 - return (-1); 66 - 67 - fr.fp = r.r_rbp; 68 - fr.pc = r.r_rip; 69 - for (count = 0; count < frame; count++) { 70 - if (process_read(ps, fr.fp, &fr, sizeof(fr)) < 0) 71 - return (-1); 72 - 73 - if (fr.pc < 0x1000) 74 - return (-1); 75 - } 76 - 77 - fram->pc = fr.pc; 78 - fram->fp = fr.fp; 79 - 80 - return (0); 81 - } 82 - 83 - int 84 - md_getregs(struct pstate *ps, reg *regs) 85 - { 86 - struct reg r; 87 - 88 - if (process_getregs(ps, &r) != 0) 89 - return (-1); 90 - 91 - memcpy(regs, &r, sizeof(r)); 92 - 93 - return (0); 94 - }
+1 -1
usr.sbin/afs/lib/libarla/Makefile.lwp.inc
··· 20 20 HOST_CPU=${MACHINE_ARCH}; \ 21 21 case "$$HOST_CPU" in \ 22 22 arm) PROCESS_S="process.arm.S" ;; \ 23 - x86_64) PROCESS_S="process.x86_64.S" ;; \ 23 + amd64) PROCESS_S="process.x86_64.S" ;; \ 24 24 sparc64) PROCESS_S="process.sparc.S" ;; \ 25 25 sparc) PROCESS_S="process.sparc.S" ;; \ 26 26 i*86*) PROCESS_S="process.i386.S" ;; \
+2 -2
usr.sbin/httpd/Makefile.bsd-wrapper
··· 1 1 # Build wrapper for Apache 2 - # $OpenBSD: Makefile.bsd-wrapper,v 1.45 2004/02/11 23:15:50 deraadt Exp $ 2 + # $OpenBSD: Makefile.bsd-wrapper,v 1.46 2004/02/27 17:36:18 deraadt Exp $ 3 3 4 4 # Our lndir is hacked; specify a full path to avoid potential conflicts 5 5 # with the one installed with X11. ··· 100 100 .if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "arm" || \ 101 101 ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "m68k" || \ 102 102 ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc" || \ 103 - ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64" 103 + ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64" 104 104 CONFIG_ARGS+= ${DSO_MODULE_ARGS} 105 105 INSTALL_MODULES= \ 106 106 src/modules/experimental/mod_mmap_static.so \
+3 -3
usr.sbin/openssl/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.15 2004/01/28 17:46:05 deraadt Exp $ 1 + # $OpenBSD: Makefile,v 1.16 2004/02/27 17:36:18 deraadt Exp $ 2 2 3 3 PROG= openssl 4 4 LDADD= -lssl -lcrypto ··· 9 9 SSLEAY_SRC= ${.CURDIR}/../../${SSLEAYDIST}/apps 10 10 SSLEAY_SRC_TOP= ${.CURDIR}/../../${SSLEAYDIST} 11 11 12 - .if (${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "x86_64") || \ 13 - (${MACHINE_ARCH} == "vax") 12 + .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "vax" || \ 13 + ${MACHINE_ARCH} == "amd64" 14 14 15 15 CFLAGS+= -DL_ENDIAN 16 16 .else