From 170303421b362769833650ccf53494fe20c67f0c Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 2 Feb 2004 05:43:16 +0000 Subject: [PATCH] binutils214 stage 2/4. * Normalize binutils212 and binutils214. Remove /usr/bin/gcc{2,3}/* and move those binaries to /usr/libexec/gcc{2,3}. Adjust objformat to suit. * Hack up contrib/gcc3 to accomodoate library path requirements and fix STANDARD_BINDIR_PREFIX. Add a missing trailing '/' in STANDARD_EXEC_PREFIX. * Adjust /usr/src/etc/Makefile (upgrade_etc) to remove old GCC and BINUTILS junk. * Cleanup etc/mtree/BSD.usr.dist * Only build gcc2 for non-cross-compiled i386 native builds. Do not build libc_r for non-i386 architectures for now. Allow on sysctl based setproctitle() updates for non-i386 architectures for now. * Move ldscripts from /usr/libdata/gcc{2,3}/ldscripts into /usr/libexec/binutilsXXX/ldscripts and remove /usr/libdata/gcc{2,3}. * GCC vendor obrien->dillon, change TARGET_OS in various places from freebsd -> dragonfly. * Consolidate config.h differences for cross builds in the Makefiles so we need only have one config.h for binutils214/as. * Cleanup and fix default target BFD for the assembler and linker when cross-building. * Build both the 32 and 64 bit support BFD's for binutils214 even if just doing a native build. * Remove a bunch of alpha junk (incomplete). * Note gnu/usr.bin/binutils214/libbfd/dfly_targmatch.h contains aliases to match dragonfly BFD targets. Some are probably unnecessary but I had to move on. * Bring in a bunch of AMD64 related files (incomplete). * Update rpcgen to locate cpp with the current path instead of /usr/bin/cpp. Add rpcgen to the buildworld bootstrap tools. Obtained-From: A good chunk of the amd64-specific files were adapted from FreeBSD-5 (authored by Peter Wemm and others). --- Makefile.inc1 | 74 +++++-- etc/Makefile | 17 +- etc/mtree/BSD.usr.dist | 22 +- gnu/lib/Makefile | 10 +- gnu/lib/libgmp/Makefile | 43 ++-- gnu/lib/libmp/Makefile | 43 +--- gnu/usr.bin/Makefile | 11 +- gnu/usr.bin/binutils/ld/Makefile | 4 +- gnu/usr.bin/binutils214/as/Makefile.inc0 | 13 +- .../binutils214/as/amd64-dragonfly/Makefile | 15 +- gnu/usr.bin/binutils214/as/config.h | 26 +-- .../binutils214/as/i386-dragonfly/Makefile | 10 +- gnu/usr.bin/binutils214/ld/Makefile.amd64 | 24 +++ gnu/usr.bin/binutils214/libbfd/Makefile | 6 +- .../binutils214/libbfd/dfly_targmatch.h | 3 +- .../binutils214/libopcodes/Makefile.amd64 | 5 + gnu/usr.bin/cc/Makefile.inc | 4 +- gnu/usr.bin/cc/cc1/Makefile | 3 +- gnu/usr.bin/cc/cc1obj/Makefile | 3 +- gnu/usr.bin/cc/cc1plus/Makefile | 3 +- gnu/usr.bin/cc/cccp/Makefile | 3 +- gnu/usr.bin/cc/f771/Makefile | 3 +- gnu/usr.bin/cc3/Makefile.inc | 4 +- gnu/usr.bin/cc3/cc1/Makefile | 3 +- gnu/usr.bin/cc3/cc1obj/Makefile | 3 +- gnu/usr.bin/cc3/cc1plus/Makefile | 3 +- gnu/usr.bin/cc3/cc_tools/dragonfly-native.h | 18 +- gnu/usr.bin/cc3/cccp/Makefile | 3 +- gnu/usr.bin/cc3/cpp0/Makefile | 3 +- gnu/usr.bin/cc3/f771/Makefile | 3 +- gnu/usr.bin/cc3/tradcpp0/Makefile | 3 +- ...onfig.SH-elf.alpha => config.SH-elf.amd64} | 30 +-- gnu/usr.bin/perl/libperl/config.SH-elf.i386 | 22 +- include/ieeefp.h | 4 +- include/rpcsvc/Makefile | 6 +- lib/Makefile | 4 +- lib/csu/alpha/Makefile | 25 --- lib/csu/amd64/Makefile | 23 ++ lib/csu/{alpha => amd64}/crt1.c | 52 ++--- lib/csu/{alpha => amd64}/crti.S | 34 +-- lib/csu/{alpha => amd64}/crtn.S | 28 +-- lib/libc/amd64/Makefile.inc | 10 + lib/libc/amd64/SYS.h | 70 ++++++ lib/libc/amd64/_fpmath.h | 50 +++++ lib/libc/amd64/arith.h | 20 ++ lib/libc/amd64/gen/Makefile.inc | 10 + lib/libc/amd64/gen/_setjmp.S | 87 ++++++++ lib/libc/amd64/gen/fabs.S | 20 ++ lib/libc/amd64/gen/fpgetmask.c | 12 ++ lib/libc/amd64/gen/fpgetprec.c | 12 ++ lib/libc/amd64/gen/fpgetround.c | 11 + lib/libc/amd64/gen/fpgetsticky.c | 11 + lib/libc/amd64/gen/fpsetmask.c | 11 + lib/libc/amd64/gen/fpsetprec.c | 11 + lib/libc/amd64/gen/fpsetround.c | 11 + lib/libc/amd64/gen/fpsetsticky.c | 11 + lib/libc/amd64/gen/frexp.c | 65 ++++++ lib/libc/amd64/gen/infinity.c | 14 ++ lib/libc/amd64/gen/isinf.c | 68 ++++++ lib/libc/amd64/gen/ldexp.c | 66 ++++++ lib/libc/amd64/gen/makecontext.c | 108 ++++++++++ lib/libc/amd64/gen/modf.S | 91 ++++++++ lib/libc/amd64/gen/rfork_thread.S | 103 +++++++++ lib/libc/amd64/gen/setjmp.S | 105 +++++++++ lib/libc/amd64/gen/signalcontext.c | 104 +++++++++ lib/libc/amd64/gen/sigsetjmp.S | 113 ++++++++++ lib/libc/amd64/net/Makefile.inc | 5 + lib/libc/amd64/net/htonl.S | 50 +++++ lib/libc/amd64/net/htons.S | 50 +++++ lib/libc/amd64/net/ntohl.S | 50 +++++ lib/libc/amd64/net/ntohs.S | 52 +++++ lib/libc/amd64/stdlib/gdtoa.mk | 6 + lib/libc/amd64/sys/Makefile.inc | 15 ++ lib/libc/amd64/sys/amd64_get_fsbase.c | 37 ++++ lib/libc/amd64/sys/amd64_get_gsbase.c | 37 ++++ lib/libc/amd64/sys/amd64_set_fsbase.c | 37 ++++ lib/libc/amd64/sys/amd64_set_gsbase.c | 37 ++++ lib/libc/amd64/sys/brk.S | 86 ++++++++ lib/libc/amd64/sys/cerror.S | 62 ++++++ lib/libc/amd64/sys/exect.S | 58 +++++ lib/libc/amd64/sys/getcontext.S | 55 +++++ lib/libc/amd64/sys/pipe.S | 48 +++++ lib/libc/amd64/sys/ptrace.S | 62 ++++++ lib/libc/amd64/sys/reboot.S | 45 ++++ lib/libc/amd64/sys/sbrk.S | 90 ++++++++ lib/libc/amd64/sys/setlogin.S | 53 +++++ lib/libc/amd64/sys/sigreturn.S | 49 +++++ lib/libc/amd64/sys/vfork.S | 61 ++++++ lib/libc/gen/setproctitle.c | 4 +- lib/libc/stdlib/Makefile.inc | 4 +- lib/libc/string/Makefile.inc | 4 +- lib/libkvm/kvm_amd64.c | 203 ++++++++++++++++++ lib/libstand/Makefile | 58 +---- ...pensslconf-alpha.h => opensslconf-amd64.h} | 6 +- sys/sys/mount.h | 7 +- usr.bin/objformat/Makefile | 5 +- usr.bin/objformat/objformat.c | 26 ++- usr.bin/rpcgen/rpc_main.c | 41 ++-- 98 files changed, 2817 insertions(+), 396 deletions(-) create mode 100644 gnu/usr.bin/binutils214/ld/Makefile.amd64 create mode 100644 gnu/usr.bin/binutils214/libopcodes/Makefile.amd64 rename gnu/usr.bin/perl/libperl/{config.SH-elf.alpha => config.SH-elf.amd64} (92%) delete mode 100644 lib/csu/alpha/Makefile create mode 100644 lib/csu/amd64/Makefile rename lib/csu/{alpha => amd64}/crt1.c (64%) rename lib/csu/{alpha => amd64}/crti.S (74%) rename lib/csu/{alpha => amd64}/crtn.S (74%) create mode 100644 lib/libc/amd64/Makefile.inc create mode 100644 lib/libc/amd64/SYS.h create mode 100644 lib/libc/amd64/_fpmath.h create mode 100644 lib/libc/amd64/arith.h create mode 100644 lib/libc/amd64/gen/Makefile.inc create mode 100644 lib/libc/amd64/gen/_setjmp.S create mode 100644 lib/libc/amd64/gen/fabs.S create mode 100644 lib/libc/amd64/gen/fpgetmask.c create mode 100644 lib/libc/amd64/gen/fpgetprec.c create mode 100644 lib/libc/amd64/gen/fpgetround.c create mode 100644 lib/libc/amd64/gen/fpgetsticky.c create mode 100644 lib/libc/amd64/gen/fpsetmask.c create mode 100644 lib/libc/amd64/gen/fpsetprec.c create mode 100644 lib/libc/amd64/gen/fpsetround.c create mode 100644 lib/libc/amd64/gen/fpsetsticky.c create mode 100644 lib/libc/amd64/gen/frexp.c create mode 100644 lib/libc/amd64/gen/infinity.c create mode 100644 lib/libc/amd64/gen/isinf.c create mode 100644 lib/libc/amd64/gen/ldexp.c create mode 100644 lib/libc/amd64/gen/makecontext.c create mode 100644 lib/libc/amd64/gen/modf.S create mode 100644 lib/libc/amd64/gen/rfork_thread.S create mode 100644 lib/libc/amd64/gen/setjmp.S create mode 100644 lib/libc/amd64/gen/signalcontext.c create mode 100644 lib/libc/amd64/gen/sigsetjmp.S create mode 100644 lib/libc/amd64/net/Makefile.inc create mode 100644 lib/libc/amd64/net/htonl.S create mode 100644 lib/libc/amd64/net/htons.S create mode 100644 lib/libc/amd64/net/ntohl.S create mode 100644 lib/libc/amd64/net/ntohs.S create mode 100644 lib/libc/amd64/stdlib/gdtoa.mk create mode 100644 lib/libc/amd64/sys/Makefile.inc create mode 100644 lib/libc/amd64/sys/amd64_get_fsbase.c create mode 100644 lib/libc/amd64/sys/amd64_get_gsbase.c create mode 100644 lib/libc/amd64/sys/amd64_set_fsbase.c create mode 100644 lib/libc/amd64/sys/amd64_set_gsbase.c create mode 100644 lib/libc/amd64/sys/brk.S create mode 100644 lib/libc/amd64/sys/cerror.S create mode 100644 lib/libc/amd64/sys/exect.S create mode 100644 lib/libc/amd64/sys/getcontext.S create mode 100644 lib/libc/amd64/sys/pipe.S create mode 100644 lib/libc/amd64/sys/ptrace.S create mode 100644 lib/libc/amd64/sys/reboot.S create mode 100644 lib/libc/amd64/sys/sbrk.S create mode 100644 lib/libc/amd64/sys/setlogin.S create mode 100644 lib/libc/amd64/sys/sigreturn.S create mode 100644 lib/libc/amd64/sys/vfork.S create mode 100644 lib/libkvm/kvm_amd64.c rename secure/lib/libcrypto/{opensslconf-alpha.h => opensslconf-amd64.h} (95%) diff --git a/Makefile.inc1 b/Makefile.inc1 index f4feb3fc6b..baac2530b9 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1,6 +1,6 @@ # # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $ -# $DragonFly: src/Makefile.inc1,v 1.19 2004/01/31 18:08:03 eirikn Exp $ +# $DragonFly: src/Makefile.inc1,v 1.20 2004/02/02 05:43:07 dillon Exp $ # # Make command line options: # -DMAKE_KERBEROS5 to build Kerberos5 @@ -217,15 +217,23 @@ IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 KMAKEENV= ${WMAKEENV} \ OBJFORMAT_PATH=${WORLDTMP}:${OBJFORMAT_PATH} -USRDIRS= usr/bin usr/bin/gcc2 usr/bin/gcc3 \ +# /usr/bin/gccX version-specific gcc binaries +# /usr/lib/gccX version-specific gcc libraries +# /usr/libexec/gccX version-specific gcc helper binaries +# /usr/libexec/binutilsXXX version-specific binutils + +USRDIRS= usr/bin \ usr/lib/gcc2 usr/lib/gcc3 \ + usr/libexec/gcc2 usr/libexec/gcc3 \ usr/lib/compat/aout usr/games \ - usr/libdata/gcc2 usr/libdata/gcc2/ldscripts \ - usr/libdata/gcc3 usr/libdata/gcc3/ldscripts \ - usr/libexec/gcc3 \ - usr/libexec/binutils212/ \ + usr/libdata \ + usr/libexec/binutils212 \ usr/libexec/binutils212/elf \ usr/libexec/binutils212/aout \ + usr/libexec/binutils212/ldscripts \ + usr/libexec/binutils214 \ + usr/libexec/binutils214/elf \ + usr/libexec/binutils214/ldscripts \ usr/sbin usr/share/misc \ usr/share/dict \ usr/share/groff_font/devX100 \ @@ -583,16 +591,19 @@ installmost: # to attempt to manually finish it. If in doubt, 'make world' again. # -# # bootstrap-tools: Build tools needed for compatibility # +# [x]install: dependancies on various new install features +# rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH +# envs are not compatible with older objformat binaries. +# .if exists(${.CURDIR}/games) && !defined(NOGAMES) _strfile= games/fortune/strfile .endif bootstrap-tools: .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \ - usr.bin/uudecode usr.bin/xinstall \ + usr.bin/uudecode usr.bin/xinstall usr.bin/rpcgen \ usr.sbin/config \ gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo ${ECHODIR} "===> ${_tool}"; \ @@ -603,8 +614,9 @@ bootstrap-tools: ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor -# -# build-tools: Build special purpose build tools +# build-tools: Build special purpose build tools. gcc2 related tools are +# only built under the i386 architecture. Other architectures are +# gcc3-only. # .if exists(${.CURDIR}/games) && !defined(NOGAMES) _games= games/adventure games/hack games/phantasia @@ -614,8 +626,22 @@ _games= games/adventure games/hack games/phantasia _share= share/syscons/scrnmaps .endif +_gcc3_cross= gnu/usr.bin/cc3 +_gcc3_tools= gnu/usr.bin/cc3/cc_tools +.if ${MACHINE_ARCH} == "i386" && ${TARGET_ARCH} == "i386" +_gcc2_cross= gnu/usr.bin/cc +_gcc2_tools= gnu/usr.bin/cc/cc_tools +_binutils= gnu/usr.bin/binutils gnu/usr.bin/binutils214 +.else +_binutils= gnu/usr.bin/binutils214 +.endif + .if !defined(NO_FORTRAN) +.if ${TARGET_ARCH} == "i386" _fortran= gnu/usr.bin/cc/f771 +.else +_fortran= gnu/usr.bin/cc3/f771 +.endif .endif .if !defined(NOPERL) @@ -632,11 +658,13 @@ _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \ _sysinstall= release/sysinstall .endif +# build-tools: tools we need +# build-tools: -.for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools \ - gnu/usr.bin/cc3/cc_tools ${_fortran} \ - ${_perl} ${_libroken4} ${_libkrb5} lib/libncurses ${_share} \ - usr.bin/awk usr.bin/file ${_sysinstall} +.for _tool in bin/csh bin/sh ${_games} ${_gcc2_tools} ${_gcc3_tools} \ + ${_fortran} ${_perl} ${_libroken4} ${_libkrb5} \ + lib/libncurses ${_share} usr.bin/awk usr.bin/file \ + ${_sysinstall} ${ECHODIR} "===> ${_tool}"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ @@ -655,9 +683,9 @@ _btxld= usr.sbin/btxld .endif cross-tools: -.for _tool in ${_btxld} ${_elf2exe} \ - gnu/usr.bin/binutils usr.bin/objformat usr.sbin/crunch/crunchide \ - gnu/usr.bin/cc gnu/usr.bin/cc3 +.for _tool in ${_btxld} ${_elf2exe} ${_binutils} \ + usr.bin/objformat usr.sbin/crunch/crunchide \ + ${_gcc2_cross} ${_gcc3_cross} ${ECHODIR} "===> ${_tool}"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ @@ -759,8 +787,14 @@ ${_lib}__L: .PHONY .endif .endfor +# only mess with gcc2 for i386 architectures. +# _startup_libs: ${_startup_libs:S/$/__L/} +.if ${TARGET_ARCH} == "i386" _startup_libs2: ${_startup_libs2:S/$/__L/} +.else +_startup_libs2: +.endif _startup_libs3: ${_startup_libs3:S/$/__L/} _prebuild_libs: ${_prebuild_libs:S/$/__L/} _generic_libs: ${_generic_libs:S/$/__L/} @@ -791,5 +825,11 @@ wmake: wmakeenv: @echo '${WMAKEENV} /bin/sh' +bmakeenv: + @echo '${BMAKEENV} /bin/sh' + +tmakeenv: + @echo '${TMAKEENV} /bin/sh' + .include diff --git a/etc/Makefile b/etc/Makefile index 7d5ee28ec8..6a5dfdbcfa 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,6 +1,6 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 # $FreeBSD: src/etc/Makefile,v 1.219.2.38 2003/03/04 09:49:00 ru Exp $ -# $DragonFly: src/etc/Makefile,v 1.13 2004/02/01 19:51:45 dillon Exp $ +# $DragonFly: src/etc/Makefile,v 1.14 2004/02/02 05:43:09 dillon Exp $ .if !defined(NO_SENDMAIL) SUBDIR= sendmail @@ -95,16 +95,23 @@ upgrade_etc: .if !defined(NOMAN) cd ${.CURDIR}/../share/man; ${MAKE} makedb .endif -.if exists(${DESTDIR}/usr/libexec/binutils212/cc1) +.if exists(${DESTDIR}/usr/libexec/binutils212/elf/as) ldconfig -m ${DESTDIR}/usr/lib/gcc2 rm -rf ${DESTDIR}/usr/libdata/ldscripts + rm -rf ${DESTDIR}/usr/libdata/gcc2 + rm -rf ${DESTDIR}/usr/libdata/gcc3 rm -rf ${DESTDIR}/usr/libexec/elf rm -rf ${DESTDIR}/usr/libexec/aout - rm -rf ${DESTDIR}/usr/libexec/gcc2 + rm -rf ${DESTDIR}/usr/bin/gcc2 + rm -rf ${DESTDIR}/usr/bin/gcc3 csh -c "rm -f ${DESTDIR}/usr/bin/{genassym,gensetdefs}" csh -c "rm -f ${DESTDIR}/usr/share/man/{man8,cat8}/{genassym,gensetdefs}.8.gz" - csh -c "rm -f ${DESTDIR}/usr/libexec/{cc1,cc1obj,cc1plus,cpp,cpp0}" - csh -c "rm -f ${DESTDIR}/usr/libexec/{f771,objformat}" + csh -c "rm -f ${DESTDIR}/usr/libexec/{cc1,cc1obj,cc1plus}" + csh -c "rm -f ${DESTDIR}/usr/libexec/{cpp,cpp0,f771,objformat}" + csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cc1,cc1obj,cc1plus}" + csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cpp,cpp0,f771,objformat}" + csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cc1,cc1obj,cc1plus}" + csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cpp,cpp0,f771,objformat}" csh -c "rm -f ${DESTDIR}/usr/lib/{crtbegin.o,crtbeginS.o,crtend.o}" csh -c "rm -f ${DESTDIR}/usr/lib/{crtendS.o,libgcc.a,libgcc_p.a}" csh -c "rm -f ${DESTDIR}/usr/lib/{libobjc.a,libobjc_p.a,libstdc++.a}" diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index c569914e39..b4b60b99f4 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -1,5 +1,5 @@ # $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.188.2.40 2003/02/14 22:38:14 nectar Exp $ -# $DragonFly: src/etc/mtree/BSD.usr.dist,v 1.8 2004/01/29 01:56:05 dillon Exp $ +# $DragonFly: src/etc/mtree/BSD.usr.dist,v 1.9 2004/02/02 05:43:10 dillon Exp $ # # Please see the file src/etc/mtree/README before making changes to this file. # @@ -35,14 +35,6 @@ fonts .. .. - gcc2 - ldscripts - .. - .. - gcc3 - ldscripts - .. - .. lint .. msdosfs @@ -158,11 +150,23 @@ .. libexec binutils212 + ldscripts + .. + aout + .. + elf + .. + .. + binutils214 + ldscripts + .. aout .. elf .. .. + gcc2 + .. gcc3 .. lpr diff --git a/gnu/lib/Makefile b/gnu/lib/Makefile index ebd967ed80..19da3e65e5 100644 --- a/gnu/lib/Makefile +++ b/gnu/lib/Makefile @@ -1,7 +1,13 @@ # $FreeBSD: src/gnu/lib/Makefile,v 1.25.2.4 2001/01/06 23:16:53 obrien Exp $ -# $DragonFly: src/gnu/lib/Makefile,v 1.4 2004/01/24 22:43:09 joerg Exp $ +# $DragonFly: src/gnu/lib/Makefile,v 1.5 2004/02/02 05:43:10 dillon Exp $ -SUBDIR= libdialog gcc2 gcc3 libgmp libmp libregex libreadline +SUBDIR= libdialog libgmp libmp libregex libreadline + +.if ${MACHINE_ARCH} == "i386" +SUBDIR+=gcc2 gcc3 +.else +SUBDIR+=gcc3 +.endif .if !defined(NO_FORTRAN) SUBDIR+= libg2c diff --git a/gnu/lib/libgmp/Makefile b/gnu/lib/libgmp/Makefile index 7a0a6b846f..8404ba510a 100644 --- a/gnu/lib/libgmp/Makefile +++ b/gnu/lib/libgmp/Makefile @@ -1,6 +1,6 @@ # # $FreeBSD: src/gnu/lib/libgmp/Makefile,v 1.22.2.2 2002/07/22 14:21:44 ru Exp $ -# $DragonFly: src/gnu/lib/libgmp/Attic/Makefile,v 1.2 2003/06/17 04:25:44 dillon Exp $ +# $DragonFly: src/gnu/lib/libgmp/Attic/Makefile,v 1.3 2004/02/02 05:43:10 dillon Exp $ # LIB= gmp @@ -10,37 +10,22 @@ SUBDIR= doc GMPDIR= ${.CURDIR}/../../../contrib/libgmp .PATH: ${GMPDIR} ${GMPDIR}/mpn -.if ${MACHINE_ARCH} == "alpha" -.PATH: ${GMPDIR}/mpn/alpha ${GMPDIR}/mpn/generic - -CFLAGS+= -I${GMPDIR}/mpn/alpha - -MPN_SRC_ASM= add_n.s addmul_1.s lshift.s mul_1.s rshift.s sub_n.s submul_1.s udiv_qrnnd.S - -.elif ${MACHINE_ARCH} == "i386" -.PATH: ${GMPDIR}/mpn/x86 ${GMPDIR}/mpn/generic - -CFLAGS+= -I${GMPDIR}/mpn/x86 - +# Allow architecture-specific files to override generic files. +# XXX remove MPN_SRC_ASM and simply check to see if an equivalent .S +# file exists. +# +# +.if ${MACHINE_ARCH} == "i386" +MPNNAME=x86 MPN_SRC_ASM= add_n.S addmul_1.S lshift.S mul_1.S rshift.S sub_n.S submul_1.S - -.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" -.PATH: ${GMPDIR}/mpn/mips3 ${GMPDIR}/mpn/generic - -CFLAGS+= -I${GMPDIR}/mpn/mips3 - -MPN_SRC_ASM= add_n.s addmul_1.s lshift.s mul_1.s rshift.s sub_n.s submul_1.s - -.elif ${MACHINE_ARCH} == "m68k" -.PATH: ${GMPDIR}/mpn/m68k ${GMPDIR}/mpn/generic - -CFLAGS+= -I${GMPDIR}/mpn/m68k - -MPN_SRC_ASM= add_n.S lshift.S rshift.S sub_n.S - +.else +MPNNAME=${MACHINE_ARCH} +MPN_SRC_ASM= .endif -CFLAGS+= -I${GMPDIR} -I${GMPDIR}/mpn/generic +.PATH: ${GMPDIR}/mpn/${MPNNAME} ${GMPDIR}/mpn/generic +CFLAGS+= -I${GMPDIR}/mpn/${MPNNAME} -I${GMPDIR} -I${GMPDIR}/mpn/generic + MPN_SRC_C= add_n.c addmul_1.c bdivmod.c cmp.c divmod_1.c divrem.c \ divrem_1.c dump.c gcd.c gcd_1.c gcdext.c get_str.c hamdist.c \ diff --git a/gnu/lib/libmp/Makefile b/gnu/lib/libmp/Makefile index 6305c980ca..e7ea5fa6a6 100644 --- a/gnu/lib/libmp/Makefile +++ b/gnu/lib/libmp/Makefile @@ -1,45 +1,24 @@ # # $FreeBSD: src/gnu/lib/libmp/Makefile,v 1.18.2.1 2002/07/22 14:21:44 ru Exp $ -# $DragonFly: src/gnu/lib/libmp/Attic/Makefile,v 1.2 2003/06/17 04:25:44 dillon Exp $ +# $DragonFly: src/gnu/lib/libmp/Attic/Makefile,v 1.3 2004/02/02 05:43:10 dillon Exp $ # LIB= mp GMPDIR= ${.CURDIR}/../../../contrib/libgmp -.if ${MACHINE_ARCH} == "alpha" -.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/alpha ${GMPDIR}/mpn/generic \ - ${GMPDIR}/mpbsd - -CFLAGS+= -I${GMPDIR}/mpn/alpha -I${GMPDIR}/mpz -DBERKELEY_MP - -MPN_SRC_ASM= add_n.s addmul_1.s lshift.s mul_1.s rshift.s sub_n.s submul_1.s udiv_qrnnd.S - -.elif ${MACHINE_ARCH} == "i386" -.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/x86 ${GMPDIR}/mpn/generic \ - ${GMPDIR}/mpbsd - -CFLAGS+= -I${GMPDIR}/mpn/x86 -I${GMPDIR}/mpz -DBERKELEY_MP - -MPN_SRC_ASM= add_n.S addmul_1.S lshift.S mul_1.S rshift.S sub_n.S submul_1.S - -.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" -.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/mips3 ${GMPDIR}/mpn/generic \ - ${GMPDIR}/mpbsd - -CFLAGS+= -I${GMPDIR}/mpn/mips3 -I${GMPDIR}/mpz -DBERKELEY_MP - -MPN_SRC_ASM= add_n.s addmul_1.s lshift.s mul_1.s rshift.s sub_n.s submul_1.s -.elif ${MACHINE_ARCH} == "m68k" -.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/m68k ${GMPDIR}/mpn/generic \ - ${GMPDIR}/mpbsd - -CFLAGS+= -I${GMPDIR}/mpn/m68k -I${GMPDIR}/mpz -DBERKELEY_MP - -MPN_SRC_ASM= add_n.S lshift.S rshift.S sub_n.S - +.if ${MACHINE_ARCH} == "i386" +MPNNAME=x86 +MPN_SRC_ASM= add_n.S addmul_1.S lshift.S mul_1.S rshift.S sub_n.S submul_1.S +.else +MPNNAME=${MACHINE_ARCH} +MPN_SRC_ASM= .endif +.PATH: ${GMPDIR} ${GMPDIR}/mpn ${GMPDIR}/mpn/${MPNNAME} \ + ${GMPDIR}/mpn/generic ${GMPDIR}/mpbsd + +CFLAGS+= -I${GMPDIR}/mpn/${MPNNAME} -I${GMPDIR}/mpz -DBERKELEY_MP CFLAGS+= -I${GMPDIR} -I${GMPDIR}/mpn/generic MPN_SRC_C= add_n.c addmul_1.c bdivmod.c cmp.c divmod_1.c divrem.c \ diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile index 0354293880..255f265fcc 100644 --- a/gnu/usr.bin/Makefile +++ b/gnu/usr.bin/Makefile @@ -1,15 +1,20 @@ # $FreeBSD: src/gnu/usr.bin/Makefile,v 1.51 2000/01/16 00:11:34 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/Makefile,v 1.5 2004/01/24 22:43:09 joerg Exp $ +# $DragonFly: src/gnu/usr.bin/Makefile,v 1.6 2004/02/02 05:43:10 dillon Exp $ +# +# Note that gcc2 is only built under the i386 architecture. Other +# architectures require gcc3. -SUBDIR= awk bc binutils cc cc3 cpio dc dialog diff diff3 gperf \ +SUBDIR= awk bc cpio dc dialog diff diff3 gperf \ grep groff gzip man patch ptx rcs sdiff send-pr sort tar texinfo .if !defined(NO_CVS) SUBDIR+=cvs .endif +SUBDIR+= binutils214 cc3 + .if ${MACHINE_ARCH} == "i386" -SUBDIR+=as ld +SUBDIR+=binutils cc as ld .endif .if !defined(NOPERL) && exists(${.CURDIR}/perl) diff --git a/gnu/usr.bin/binutils/ld/Makefile b/gnu/usr.bin/binutils/ld/Makefile index cae2daf588..eb7de8cb25 100644 --- a/gnu/usr.bin/binutils/ld/Makefile +++ b/gnu/usr.bin/binutils/ld/Makefile @@ -1,12 +1,12 @@ # $FreeBSD: src/gnu/usr.bin/binutils/ld/Makefile,v 1.8.2.8 2002/09/01 23:39:14 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/binutils/ld/Attic/Makefile,v 1.3 2004/01/16 07:45:21 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/binutils/ld/Attic/Makefile,v 1.4 2004/02/02 05:43:10 dillon Exp $ .include "../Makefile.inc0" .PATH: ${SRCDIR}/ld PROG= ld -SCRIPTDIR= /usr/libdata/gcc2/ldscripts +SCRIPTDIR= /usr/libexec/binutils212/ldscripts SRCS+= ldcref.c ldctor.c ldemul.c ldemul-list.h ldexp.c ldfile.c \ ldgram.y ldlang.c ldlex.l ldmain.c ldmisc.c \ ldver.c ldwrite.c lexsup.c mri.c diff --git a/gnu/usr.bin/binutils214/as/Makefile.inc0 b/gnu/usr.bin/binutils214/as/Makefile.inc0 index 86916eddb0..b2589e692e 100644 --- a/gnu/usr.bin/binutils214/as/Makefile.inc0 +++ b/gnu/usr.bin/binutils214/as/Makefile.inc0 @@ -1,11 +1,14 @@ # $FreeBSD: src/gnu/usr.bin/binutils/as/Makefile.inc0,v 1.6.2.4 2002/09/01 23:39:13 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/binutils214/as/Attic/Makefile.inc0,v 1.1 2004/02/01 08:53:03 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/binutils214/as/Attic/Makefile.inc0,v 1.2 2004/02/02 05:43:10 dillon Exp $ .include "${.CURDIR}/../../Makefile.inc0" RELTOP:= ../${RELTOP} .PATH: ${SRCDIR}/gas ${SRCDIR}/gas/config +TARGET_VENDOR ?= dillon +TARGET_OS ?= dragonfly1.0 + PROG= as MAN= doc/as.1 SRCS+= app.c as.c atof-generic.c atof-ieee.c bignum-copy.c \ @@ -24,6 +27,14 @@ WARNS= 2 CFLAGS+= -I${SRCDIR}/gas -I${SRCDIR}/gas/config -I${SRCDIR} -I${.CURDIR}/.. CFLAGS+= -DVERSION=\"${VERSION:C/[ ]?${VERSION_DATE}[ ]?//g}\" CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\" +CFLAGS+= -DTARGET_ALIAS=\"${TARGET_ALIAS}\" +CFLAGS+= -DTARGET_CANONICAL=\"${TARGET_CANONICAL}\" +CFLAGS+= -DTARGET_CPU=\"${TARGET_CPU}\" +CFLAGS+= -DDEFAULT_ARCH=\"${DEFAULT_ARCH}\" +CFLAGS+= -DTARGET_VENDOR=\"${TARGET_VENDOR}\" +CFLAGS+= -DTARGET_OS=\"${TARGET_OS}\" +CFLAGS+= "-DEMULATIONS=${EMULATIONS}" +CFLAGS+= -DDEFAULT_EMULATION=\"${DEFAULT_EMULATION}\" CFLAGS+= -DTE_DragonFly NOSHARED?= yes DPADD= ${RELTOP}/libbfd/libbfd.a diff --git a/gnu/usr.bin/binutils214/as/amd64-dragonfly/Makefile b/gnu/usr.bin/binutils214/as/amd64-dragonfly/Makefile index b0bc85abd1..8248fdc9ba 100644 --- a/gnu/usr.bin/binutils214/as/amd64-dragonfly/Makefile +++ b/gnu/usr.bin/binutils214/as/amd64-dragonfly/Makefile @@ -1,8 +1,21 @@ # $FreeBSD: src/gnu/usr.bin/binutils/as/amd64-freebsd/Makefile,v 1.2 2003/08/14 14:43:28 ru Exp $ -# $DragonFly: src/gnu/usr.bin/binutils214/as/amd64-dragonfly/Attic/Makefile,v 1.1 2004/02/01 08:53:03 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/binutils214/as/amd64-dragonfly/Attic/Makefile,v 1.2 2004/02/02 05:43:11 dillon Exp $ + +DEFAULT_ARCH= x86_64 +EMULATIONS= &i386elf, +DEFAULT_EMULATION= i386elf +TARGET_ALIAS= x86_64-dillon-dragonfly1.0 +TARGET_CANONICAL= x86_64-dillon-dragonfly1.0 +TARGET_CPU= x86_64 .include "${.CURDIR}/../Makefile.inc0" +CFLAGS += -I${.OBJDIR}/../../libbfd +NOMAN= true +.if ${TARGET_ARCH} != "amd64" +BINDIR= /usr/libexec/cross/amd64-dragonfly +.endif SRCS+= obj-elf.c tc-i386-local.c .include + diff --git a/gnu/usr.bin/binutils214/as/config.h b/gnu/usr.bin/binutils214/as/config.h index 754e4b5050..6109de40b0 100644 --- a/gnu/usr.bin/binutils214/as/config.h +++ b/gnu/usr.bin/binutils214/as/config.h @@ -1,6 +1,6 @@ /* * $FreeBSD: src/gnu/usr.bin/binutils/as/i386-freebsd/config.h,v 1.1.6.4 2002/09/01 23:39:13 obrien Exp $ - * $DragonFly: src/gnu/usr.bin/binutils214/as/Attic/config.h,v 1.1 2004/02/01 08:53:03 dillon Exp $ + * $DragonFly: src/gnu/usr.bin/binutils214/as/Attic/config.h,v 1.2 2004/02/02 05:43:10 dillon Exp $ */ /* config.h. Generated automatically by configure. */ @@ -169,9 +169,6 @@ /* Use ELF stabs for MIPS, not ECOFF stabs */ /* #undef MIPS_STABS_ELF */ -/* Default architecture. */ -/* #define DEFAULT_ARCH "i386" */ - /* Using cgen code? */ /* #undef USING_CGEN */ @@ -217,33 +214,12 @@ /* Use emulation support? */ /* #undef USE_EMULATIONS */ -/* Supported emulations. */ -#define EMULATIONS &i386elf, - -/* Default emulation. */ -#define DEFAULT_EMULATION "i386elf" - /* old COFF support? */ /* #undef MANY_SEGMENTS */ /* Use BFD interface? */ #define BFD_ASSEMBLER 1 -/* Target alias. */ -#define TARGET_ALIAS "i386-dillon-dragonfly1.0" - -/* Canonical target. */ -#define TARGET_CANONICAL "i386-dillon-dragonfly1.0" - -/* Target CPU. */ -#define TARGET_CPU "i386" - -/* Target vendor. */ -#define TARGET_VENDOR "dillon" - -/* Target OS. */ -#define TARGET_OS "dragonfly1.0" - /* Define if you have the stpcpy function */ /* #undef HAVE_STPCPY */ diff --git a/gnu/usr.bin/binutils214/as/i386-dragonfly/Makefile b/gnu/usr.bin/binutils214/as/i386-dragonfly/Makefile index 5cbf27b520..0506d40338 100644 --- a/gnu/usr.bin/binutils214/as/i386-dragonfly/Makefile +++ b/gnu/usr.bin/binutils214/as/i386-dragonfly/Makefile @@ -1,5 +1,12 @@ # $FreeBSD: src/gnu/usr.bin/binutils/as/i386-freebsd/Makefile,v 1.7.2.3 2002/09/01 23:39:13 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/binutils214/as/i386-dragonfly/Attic/Makefile,v 1.1 2004/02/01 08:53:03 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/binutils214/as/i386-dragonfly/Attic/Makefile,v 1.2 2004/02/02 05:43:11 dillon Exp $ + +DEFAULT_ARCH= i386 +EMULATIONS= &i386elf, +DEFAULT_EMULATION= i386elf +TARGET_ALIAS= i386-dillon-dragonfly1.0 +TARGET_CANONICAL= i386-dillon-dragonfly1.0 +TARGET_CPU= i386 .include "${.CURDIR}/../Makefile.inc0" @@ -11,3 +18,4 @@ BINDIR= /usr/libexec/cross/i386-dragonfly SRCS+= obj-elf.c tc-i386-local.c .include + diff --git a/gnu/usr.bin/binutils214/ld/Makefile.amd64 b/gnu/usr.bin/binutils214/ld/Makefile.amd64 new file mode 100644 index 0000000000..d4d2739cfe --- /dev/null +++ b/gnu/usr.bin/binutils214/ld/Makefile.amd64 @@ -0,0 +1,24 @@ +# $FreeBSD: src/gnu/usr.bin/binutils/ld/Makefile.i386,v 1.8.2.5 2002/09/01 23:39:14 obrien Exp $ +# $DragonFly: src/gnu/usr.bin/binutils214/ld/Attic/Makefile.amd64,v 1.1 2004/02/02 05:43:11 dillon Exp $ + +TARGET_TUPLE?= x86_64-unknown-dragonfly + +NATIVE_EMULATION= elf_x86_64 +HOST= ${TARGET_TUPLE} +CFLAGS+= -DDEFAULT_EMULATION=\"${NATIVE_EMULATION}\" +CFLAGS+= -DTARGET=\"${TARGET_TUPLE}\" +_amd64_path= ${TOOLS_PREFIX}/usr/lib +EMS+= ${NATIVE_EMULATION} +LDSCRIPTS+= ${NATIVE_EMULATION}.x ${NATIVE_EMULATION}.xbn \ + ${NATIVE_EMULATION}.xn ${NATIVE_EMULATION}.xr \ + ${NATIVE_EMULATION}.xs ${NATIVE_EMULATION}.xu \ + ${NATIVE_EMULATION}.xc ${NATIVE_EMULATION}.xsc +SRCS+= e${NATIVE_EMULATION}.c +CLEANFILES+= e${NATIVE_EMULATION}.c + +e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \ + scripttempl/elf.sc genscripts.sh stringify.sed + sh ${SRCDIR}/ld/genscripts.sh ${SRCDIR}/ld ${_amd64_path} \ + "" ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \ + "${NATIVE_EMULATION}" "" no ${NATIVE_EMULATION} "${TARGET_TUPLE}" + diff --git a/gnu/usr.bin/binutils214/libbfd/Makefile b/gnu/usr.bin/binutils214/libbfd/Makefile index f7b38cb2bd..0f84a5d3b4 100644 --- a/gnu/usr.bin/binutils214/libbfd/Makefile +++ b/gnu/usr.bin/binutils214/libbfd/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/binutils/libbfd/Makefile,v 1.9.2.3 2002/09/01 23:39:15 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/binutils214/libbfd/Attic/Makefile,v 1.1 2004/02/01 08:53:04 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/binutils214/libbfd/Attic/Makefile,v 1.2 2004/02/02 05:43:11 dillon Exp $ .include "../Makefile.inc0" @@ -28,8 +28,8 @@ CFLAGS+= -I${BINUTILSDISTDIR}/bfd -I${BINUTILSDISTDIR}/include -I. .endif SELARCH= -.if ${BINUTIL_ARCH} == "sparc64" -SELARCH= &bfd_sparc_arch +.if ${BINUTIL_ARCH} == "amd64" +SELARCH= &bfd_i386_arch .else .for _a in ${ARCHS} .if ${SELARCH} == "" diff --git a/gnu/usr.bin/binutils214/libbfd/dfly_targmatch.h b/gnu/usr.bin/binutils214/libbfd/dfly_targmatch.h index 320cbded12..67bf0aa30b 100644 --- a/gnu/usr.bin/binutils214/libbfd/dfly_targmatch.h +++ b/gnu/usr.bin/binutils214/libbfd/dfly_targmatch.h @@ -3,9 +3,10 @@ * XXX i386-*-dragonfly and amd64-*-dragonfly are obsolete, but not quite * removed from the binutils build yet. * - * $DragonFly: src/gnu/usr.bin/binutils214/libbfd/Attic/dfly_targmatch.h,v 1.1 2004/02/01 08:53:04 dillon Exp $ + * $DragonFly: src/gnu/usr.bin/binutils214/libbfd/Attic/dfly_targmatch.h,v 1.2 2004/02/02 05:43:11 dillon Exp $ */ { "elf32-i386-dragonfly*", &bfd_elf32_i386_vec }, { "elf64-amd64-dragonfly*", &bfd_elf64_x86_64_vec }, { "i386-*-dragonfly*", &bfd_elf32_i386_vec }, { "amd64-*-dragonfly*", &bfd_elf64_x86_64_vec }, +{ "x86_64-*-dragonfly*", &bfd_elf64_x86_64_vec }, diff --git a/gnu/usr.bin/binutils214/libopcodes/Makefile.amd64 b/gnu/usr.bin/binutils214/libopcodes/Makefile.amd64 new file mode 100644 index 0000000000..6a830ac105 --- /dev/null +++ b/gnu/usr.bin/binutils214/libopcodes/Makefile.amd64 @@ -0,0 +1,5 @@ +# $FreeBSD: src/gnu/usr.bin/binutils/libopcodes/Makefile.i386,v 1.2.2.2 2002/09/01 23:39:17 obrien Exp $ +# $DragonFly: src/gnu/usr.bin/binutils214/libopcodes/Attic/Makefile.amd64,v 1.1 2004/02/02 05:43:11 dillon Exp $ + +SRCS+= i386-dis.c +CFLAGS+= -DARCH_i386 diff --git a/gnu/usr.bin/cc/Makefile.inc b/gnu/usr.bin/cc/Makefile.inc index 5a481ebc39..5f99bca57f 100644 --- a/gnu/usr.bin/cc/Makefile.inc +++ b/gnu/usr.bin/cc/Makefile.inc @@ -1,9 +1,9 @@ # $FreeBSD: src/gnu/usr.bin/cc/Makefile.inc,v 1.49.2.6 2002/11/15 18:18:38 ru Exp $ -# $DragonFly: src/gnu/usr.bin/cc/Attic/Makefile.inc,v 1.6 2004/01/29 01:39:45 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/cc/Attic/Makefile.inc,v 1.7 2004/02/02 05:43:11 dillon Exp $ MY_CCVER=gcc2 MY_BINUTILS=binutils212 -BINDIR?=/usr/bin/gcc2 +BINDIR?=/usr/libexec/gcc2 .include "../Makefile.inc" # Sometimes this is .include'd several times... diff --git a/gnu/usr.bin/cc/cc1/Makefile b/gnu/usr.bin/cc/cc1/Makefile index 003d3c88e9..a57dce2e41 100644 --- a/gnu/usr.bin/cc/cc1/Makefile +++ b/gnu/usr.bin/cc/cc1/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cc1/Makefile,v 1.18.2.2 2002/06/20 23:13:30 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc/cc1/Attic/Makefile,v 1.4 2004/01/29 01:39:48 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/cc/cc1/Attic/Makefile,v 1.5 2004/02/02 05:43:11 dillon Exp $ .include "../Makefile.inc" @@ -9,7 +9,6 @@ PROG= cc1 SRCS= c-parse.y c-lang.c # Ugh, compiled twice... SRCS+= c-decl.c c-lex.c -BINDIR= /usr/libexec/binutils212 NOMAN= 1 NOSHARED=yes diff --git a/gnu/usr.bin/cc/cc1obj/Makefile b/gnu/usr.bin/cc/cc1obj/Makefile index d182e1d4d4..732763639c 100644 --- a/gnu/usr.bin/cc/cc1obj/Makefile +++ b/gnu/usr.bin/cc/cc1obj/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cc1obj/Makefile,v 1.11.2.2 2002/06/20 23:13:31 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc/cc1obj/Attic/Makefile,v 1.4 2004/01/29 01:39:48 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/cc/cc1obj/Attic/Makefile,v 1.5 2004/02/02 05:43:11 dillon Exp $ .include "../Makefile.inc" @@ -9,7 +9,6 @@ PROG= cc1obj SRCS= c-parse.y objc-act.c # Ugh, compiled twice... SRCS+= c-decl.c c-lex.c -BINDIR= /usr/libexec/binutils212 NOMAN= 1 NOSHARED=yes diff --git a/gnu/usr.bin/cc/cc1plus/Makefile b/gnu/usr.bin/cc/cc1plus/Makefile index e3a8686429..9b2874bb89 100644 --- a/gnu/usr.bin/cc/cc1plus/Makefile +++ b/gnu/usr.bin/cc/cc1plus/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cc1plus/Makefile,v 1.22.2.1 2002/06/20 23:13:31 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc/cc1plus/Attic/Makefile,v 1.5 2004/01/29 01:39:48 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/cc/cc1plus/Attic/Makefile,v 1.6 2004/02/02 05:43:11 dillon Exp $ .include "../Makefile.inc" @@ -10,7 +10,6 @@ SRCS= parse.y y.tab.h parse.h SRCS+= call.c class.c cvt.c decl.c decl2.c errfn.c error.c except.c expr.c \ friend.c init.c lex.c method.c pt.c ptree.c repo.c rtti.c \ search.c semantics.c sig.c spew.c tree.c typeck.c typeck2.c xref.c -BINDIR= /usr/libexec/binutils212 NOMAN= 1 NOSHARED=yes diff --git a/gnu/usr.bin/cc/cccp/Makefile b/gnu/usr.bin/cc/cccp/Makefile index ed63594a96..e42bf2523f 100644 --- a/gnu/usr.bin/cc/cccp/Makefile +++ b/gnu/usr.bin/cc/cccp/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cccp/Makefile,v 1.16.2.3 2001/08/01 18:48:34 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc/cccp/Attic/Makefile,v 1.4 2004/01/29 01:39:48 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/cc/cccp/Attic/Makefile,v 1.5 2004/02/02 05:43:11 dillon Exp $ .include "../Makefile.inc" @@ -8,7 +8,6 @@ PROG= cpp0 SRCS= cccp.c cexp.y obstack.c prefix.c version.c YFLAGS= -BINDIR= /usr/libexec/binutils212 NOSHARED?=yes MAN= cccp.1 LINKS= ${BINDIR}/cpp0 ${BINDIR}/cpp diff --git a/gnu/usr.bin/cc/f771/Makefile b/gnu/usr.bin/cc/f771/Makefile index ff4b8b68d1..e48c80d9cd 100644 --- a/gnu/usr.bin/cc/f771/Makefile +++ b/gnu/usr.bin/cc/f771/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/f771/Makefile,v 1.5.2.1 2000/07/04 05:39:50 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc/f771/Attic/Makefile,v 1.4 2004/01/29 01:39:48 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/cc/f771/Attic/Makefile,v 1.5 2004/02/02 05:43:12 dillon Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -10,7 +10,6 @@ SRCS= bad.c bit.c bld.c com.c data.c equiv.c expr.c global.c implic.c info.c \ intrin.c lab.c lex.c malloc.c name.c parse.c proj.c src.c st.c sta.c \ stb.c stc.c std.c ste.c storag.c stp.c str.c sts.c stt.c stu.c stv.c \ stw.c symbol.c target.c top.c type.c version.c where.c -BINDIR= /usr/libexec/binutils212 NOMAN= CFLAGS+= -I${GCCDIR}/f -I. diff --git a/gnu/usr.bin/cc3/Makefile.inc b/gnu/usr.bin/cc3/Makefile.inc index 38ea242ccf..66c3c11896 100644 --- a/gnu/usr.bin/cc3/Makefile.inc +++ b/gnu/usr.bin/cc3/Makefile.inc @@ -1,7 +1,7 @@ # $FreeBSD: src/gnu/usr.bin/cc/Makefile.inc,v 1.63 2002/06/04 19:45:08 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/Attic/Makefile.inc,v 1.3 2004/01/24 20:03:27 joerg Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/Attic/Makefile.inc,v 1.4 2004/02/02 05:43:12 dillon Exp $ -BINDIR?=/usr/bin/gcc3 +BINDIR?=/usr/libexec/gcc3 MY_CCVER=gcc3 .include "../Makefile.inc" diff --git a/gnu/usr.bin/cc3/cc1/Makefile b/gnu/usr.bin/cc3/cc1/Makefile index 376aeb6297..5c91519957 100644 --- a/gnu/usr.bin/cc3/cc1/Makefile +++ b/gnu/usr.bin/cc3/cc1/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cc1/Makefile,v 1.29 2003/07/11 05:37:23 kan Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/cc1/Attic/Makefile,v 1.2 2004/01/17 23:05:19 drhodus Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/cc1/Attic/Makefile,v 1.3 2004/02/02 05:43:12 dillon Exp $ .include "../Makefile.inc" @@ -7,7 +7,6 @@ PROG= cc1 SRCS= main.c c-parse+%DIKED.c c-lang.c c-decl.c c-opts.c -BINDIR= /usr/libexec/gcc3 NOMAN= 1 NOSHARED?=yes diff --git a/gnu/usr.bin/cc3/cc1obj/Makefile b/gnu/usr.bin/cc3/cc1obj/Makefile index 4806c55bda..60ec8c0a84 100644 --- a/gnu/usr.bin/cc3/cc1obj/Makefile +++ b/gnu/usr.bin/cc3/cc1obj/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cc1obj/Makefile,v 1.22 2002/05/13 03:27:02 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/cc1obj/Attic/Makefile,v 1.2 2004/01/17 23:05:19 drhodus Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/cc1obj/Attic/Makefile,v 1.3 2004/02/02 05:43:12 dillon Exp $ .include "../Makefile.inc" @@ -7,7 +7,6 @@ PROG= cc1obj SRCS= objc-parse+DIKED.c objc-act.c objc-lang.c main.c c-decl.c -BINDIR= /usr/libexec/gcc3 NOMAN= 1 NOSHARED?=yes diff --git a/gnu/usr.bin/cc3/cc1plus/Makefile b/gnu/usr.bin/cc3/cc1plus/Makefile index 29998e5ed7..2c3f6706bb 100644 --- a/gnu/usr.bin/cc3/cc1plus/Makefile +++ b/gnu/usr.bin/cc3/cc1plus/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cc1plus/Makefile,v 1.33 2003/07/11 05:37:23 kan Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/cc1plus/Attic/Makefile,v 1.2 2004/01/17 23:05:19 drhodus Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/cc1plus/Attic/Makefile,v 1.3 2004/02/02 05:43:12 dillon Exp $ .include "../Makefile.inc" @@ -12,7 +12,6 @@ SRCS+= main.c cp-lang.c c-opts.c \ init.c lex.c mangle.c method.c pt.c ptree.c repo.c rtti.c search.c \ semantics.c spew.c tree.c typeck.c typeck2.c dump.c optimize.c -BINDIR= /usr/libexec/gcc3 NOMAN= 1 NOSHARED?=yes diff --git a/gnu/usr.bin/cc3/cc_tools/dragonfly-native.h b/gnu/usr.bin/cc3/cc_tools/dragonfly-native.h index a699af77a1..71d20f4804 100644 --- a/gnu/usr.bin/cc3/cc_tools/dragonfly-native.h +++ b/gnu/usr.bin/cc3/cc_tools/dragonfly-native.h @@ -1,5 +1,5 @@ /* $FreeBSD: src/gnu/usr.bin/cc/cc_tools/freebsd-native.h,v 1.23 2003/07/11 05:33:24 kan Exp $ */ -/* $DragonFly: src/gnu/usr.bin/cc3/cc_tools/Attic/dragonfly-native.h,v 1.1 2004/01/20 20:38:35 joerg Exp $ +/* $DragonFly: src/gnu/usr.bin/cc3/cc_tools/Attic/dragonfly-native.h,v 1.2 2004/02/02 05:43:12 dillon Exp $ */ /* FREEBSD_NATIVE is defined when gcc is integrated into the FreeBSD @@ -39,14 +39,20 @@ #undef MD_EXEC_PREFIX /* We don't want one. */ #define FBSD_DATA_PREFIX PREFIX"/libdata/gcc/" +/* + * XXX at the moment crt1.o, crti.o, and crtn.o are generated from + * /usr/lib/libcsu and placed in /usr/lib. crtbegin* and crtend* are + * generated from the gcc dist and placed in /usr/lib/cc3. + * + */ /* Under FreeBSD, the normal location of the various *crt*.o files is the /usr/lib directory. */ -#define STANDARD_STARTFILE_PREFIX PREFIX"/lib/" -#ifdef CROSS_COMPILE -#define CROSS_STARTFILE_PREFIX PREFIX"/lib/gcc3/" -#endif -#define MD_STARTFILE_PREFIX PREFIX"/lib/gcc3/" +#define STANDARD_STARTFILE_PREFIX1 PREFIX"/lib/" +#define STANDARD_STARTFILE_PREFIX2 PREFIX"/lib/gcc3/" +#define STANDARD_STARTFILE_PREFIX3 "" +#define STANDARD_STARTFILE_PREFIX4 "" +#undef MD_STARTFILE_PREFIX /* For the native system compiler, we actually build libgcc in a profiled version. So we should use it with -pg. */ diff --git a/gnu/usr.bin/cc3/cccp/Makefile b/gnu/usr.bin/cc3/cccp/Makefile index 91a5119b00..29e559e33b 100644 --- a/gnu/usr.bin/cc3/cccp/Makefile +++ b/gnu/usr.bin/cc3/cccp/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cccp/Makefile,v 1.24 2002/05/13 03:27:02 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/cccp/Attic/Makefile,v 1.2 2004/01/17 23:05:20 drhodus Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/cccp/Attic/Makefile,v 1.3 2004/02/02 05:43:12 dillon Exp $ .include "../Makefile.inc" @@ -8,7 +8,6 @@ PROG= cpp0 SRCS= cppmain.c c-parse+%DIKED.c c-lang.c c-decl.c -BINDIR= /usr/libexec/gcc3 NOMAN= 1 NOSHARED?=yes diff --git a/gnu/usr.bin/cc3/cpp0/Makefile b/gnu/usr.bin/cc3/cpp0/Makefile index 1b36655315..6e47ec9e08 100644 --- a/gnu/usr.bin/cc3/cpp0/Makefile +++ b/gnu/usr.bin/cc3/cpp0/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cpp0/Makefile,v 1.5 2002/05/13 03:27:03 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/cpp0/Attic/Makefile,v 1.1 2004/01/17 22:40:15 drhodus Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/cpp0/Attic/Makefile,v 1.2 2004/02/02 05:43:12 dillon Exp $ .include "../Makefile.inc" @@ -8,7 +8,6 @@ PROG= cpp0 SRCS= cppmain.c c-parse+%DIKED.c c-lang.c c-decl.c -BINDIR= /usr/bin NOMAN= 1 NOSHARED?=yes diff --git a/gnu/usr.bin/cc3/f771/Makefile b/gnu/usr.bin/cc3/f771/Makefile index ef270c8092..945d73ba41 100644 --- a/gnu/usr.bin/cc3/f771/Makefile +++ b/gnu/usr.bin/cc3/f771/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/f771/Makefile,v 1.10 2004/01/11 20:45:46 ru Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/f771/Attic/Makefile,v 1.2 2004/01/17 23:05:20 drhodus Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/f771/Attic/Makefile,v 1.3 2004/02/02 05:43:12 dillon Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -10,7 +10,6 @@ SRCS= bad.c bit.c bld.c com.c data.c equiv.c expr.c global.c implic.c info.c \ intrin.c lab.c lex.c malloc.c name.c parse.c src.c st.c sta.c \ stb.c stc.c std.c ste.c storag.c stp.c str.c sts.c stt.c stu.c stv.c \ stw.c symbol.c target.c top.c type.c where.c main.c -BINDIR= /usr/libexec/gcc3 NOMAN= CFLAGS+= -I${GCCDIR}/f -I. diff --git a/gnu/usr.bin/cc3/tradcpp0/Makefile b/gnu/usr.bin/cc3/tradcpp0/Makefile index f0029f002b..4921011e46 100644 --- a/gnu/usr.bin/cc3/tradcpp0/Makefile +++ b/gnu/usr.bin/cc3/tradcpp0/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/tradcpp0/Makefile,v 1.6 2002/05/13 03:27:03 obrien Exp $ -# $DragonFly: src/gnu/usr.bin/cc3/tradcpp0/Attic/Makefile,v 1.1 2004/01/17 22:40:16 drhodus Exp $ +# $DragonFly: src/gnu/usr.bin/cc3/tradcpp0/Attic/Makefile,v 1.2 2004/02/02 05:43:13 dillon Exp $ .include "../Makefile.inc" @@ -7,7 +7,6 @@ PROG= tradcpp0 SRCS= tradcpp.c tradcif+%DIKED.c -BINDIR= /usr/bin NOMAN= 1 DPADD+= ${LIBCC_INT} diff --git a/gnu/usr.bin/perl/libperl/config.SH-elf.alpha b/gnu/usr.bin/perl/libperl/config.SH-elf.amd64 similarity index 92% rename from gnu/usr.bin/perl/libperl/config.SH-elf.alpha rename to gnu/usr.bin/perl/libperl/config.SH-elf.amd64 index ce91769211..e01ca80334 100644 --- a/gnu/usr.bin/perl/libperl/config.SH-elf.alpha +++ b/gnu/usr.bin/perl/libperl/config.SH-elf.amd64 @@ -1,19 +1,19 @@ #!/bin/sh # -# $FreeBSD: src/gnu/usr.bin/perl/libperl/config.SH-elf.alpha,v 1.16.2.1 2000/10/31 08:05:27 ps Exp $ -# $DragonFly: src/gnu/usr.bin/perl/libperl/Attic/config.SH-elf.alpha,v 1.2 2003/06/17 04:25:47 dillon Exp $ +# $FreeBSD: src/gnu/usr.bin/perl/libperl/config.SH-elf.i386,v 1.15.2.1 2000/10/31 08:05:27 ps Exp $ +# $DragonFly: src/gnu/usr.bin/perl/libperl/Attic/config.SH-elf.amd64,v 1.1 2004/02/02 05:43:13 dillon Exp $ # # Package name : perl5 # Source directory : . # Configuration time: $Date$ # Configured by : markm -# Target system : freebsd 4.0-current #0: +# Target system : dragonfly Author='' Date='$Date$' Header='' -Id='$FreeBSD: src/gnu/usr.bin/perl/libperl/config.SH-elf.alpha,v 1.16.2.1 2000/10/31 08:05:27 ps Exp $' +Id='$DragonFly: src/gnu/usr.bin/perl/libperl/Attic/config.SH-elf.amd64,v 1.1 2004/02/02 05:43:13 dillon Exp $' Locker='' Mcc='Mcc' RCSfile='$RCSfile$' @@ -31,7 +31,7 @@ apiversion='5.005' ar='ar' archlib='/usr/libdata/perl/5.00503/mach' archlibexp='/usr/libdata/perl/5.00503/mach' -archname='alpha-freebsd' +archname='amd64-dragonfly' archobjs='' awk='awk' baserev='5.0' @@ -48,7 +48,7 @@ cc='cc' cccdlflags='-DPIC -fpic' ccdlflags=' -Wl,-R/usr/lib' ccflags='' -ccsymbols='__ELF__=1 __FreeBSD__=4 __FreeBSD_cc_version=400004 __GNUC_MINOR__=95 __GNUC__=2 cpu=alpha machine=alpha system=FreeBSD system=unix' +ccsymbols='__ELF__=1 __FreeBSD__=4 __FreeBSD_cc_version=400004 __GNUC_MINOR__=95 __GNUC__=2 cpu=amd64 machine=amd64 system=DragonFly system=unix' cf_by='markm' cf_email='markm@FreeBSD.org' cf_time='Sun Mar 5 13:39:27 SAST 2000' @@ -69,7 +69,7 @@ cppminus='-' cpprun='cc -E' cppstdin='cc -E' cppsymbols='__STDC__=1' -cppccsymbols='__alpha=1 __alpha=1 __unix=1 __unix__=1 alpha=1 unix=1' +cppccsymbols='__amd64=1 __amd64__=1 __unix=1 __unix__=1 amd64=1 unix=1' cryptlib='' csh='csh' d_Gconvert='sprintf((b),"%.*g",(n),(x))' @@ -406,7 +406,7 @@ installman1dir='/usr/local/man/man1' installman3dir='/usr/local/lib/perl5/5.00503/man/man3' installprivlib='/usr/libdata/perl/5.00503' installscript='/usr/local/bin' -installsitearch='/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd' +installsitearch='/usr/local/lib/perl5/site_perl/5.005/amd64-dragonfly' installsitelib='/usr/local/lib/perl5/site_perl/5.005' installusrbinperl='undef' intsize='4' @@ -430,7 +430,7 @@ ln='ln' lns='/bin/ln -s' locincpth='' loclibpth='' -longdblsize='8' +longdblsize='16' longlongsize='8' longsize='8' lp='' @@ -458,7 +458,7 @@ models='none' modetype='mode_t' more='more' mv='' -myarchname='alpha-freebsd' +myarchname='amd64-dragonfly' mydomain='.FreeBSD.org' myhostname='freefall' myuname='FreeBSD freefall.FreeBSD.org 4.0-current FreeBSD 4.0-current #0: $Date$' @@ -476,7 +476,7 @@ o_nonblock='O_NONBLOCK' obj_ext='.o' optimize=${CFLAGS:-''} orderlib='false' -osname='freebsd' +osname='dragonfly' osvers='4.0-current' package='perl5' pager='/usr/bin/more' @@ -522,8 +522,8 @@ sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE" sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 6 ' sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 6, 0' signal_t='void' -sitearch='/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd' -sitearchexp='/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd' +sitearch='/usr/local/lib/perl5/site_perl/5.005/amd64-dragonfly' +sitearchexp='/usr/local/lib/perl5/site_perl/5.005/amd64-dragonfly' sitelib='/usr/local/lib/perl5/site_perl/5.005' sitelibexp='/usr/local/lib/perl5/site_perl/5.005' sizetype='size_t' @@ -586,12 +586,12 @@ zcat='' zip='zip' # Configure command line arguments. config_arg0='Configure' -config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more' +config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/amd64-dragonfly -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more' config_argc=10 config_arg1='-Dprefix=/usr' config_arg2='-Darchlib=/usr/libdata/perl/5.00503/mach' config_arg3='-Dprivlib=/usr/libdata/perl/5.00503' -config_arg4='-Dsitearch=/usr/local/lib/perl5/site_perl/5.005/alpha-freebsd' +config_arg4='-Dsitearch=/usr/local/lib/perl5/site_perl/5.005/amd64-dragonfly' config_arg5='-Dsitelib=/usr/local/lib/perl5/site_perl/5.005' config_arg6='-Dman1dir=/usr/local/man/man1' config_arg7='-Dman3dir=/usr/share/perl/man/man3' diff --git a/gnu/usr.bin/perl/libperl/config.SH-elf.i386 b/gnu/usr.bin/perl/libperl/config.SH-elf.i386 index 7c58f45d66..b2bf161981 100644 --- a/gnu/usr.bin/perl/libperl/config.SH-elf.i386 +++ b/gnu/usr.bin/perl/libperl/config.SH-elf.i386 @@ -1,19 +1,19 @@ #!/bin/sh # # $FreeBSD: src/gnu/usr.bin/perl/libperl/config.SH-elf.i386,v 1.15.2.1 2000/10/31 08:05:27 ps Exp $ -# $DragonFly: src/gnu/usr.bin/perl/libperl/Attic/config.SH-elf.i386,v 1.2 2003/06/17 04:25:47 dillon Exp $ +# $DragonFly: src/gnu/usr.bin/perl/libperl/Attic/config.SH-elf.i386,v 1.3 2004/02/02 05:43:13 dillon Exp $ # # Package name : perl5 # Source directory : . # Configuration time: $Date$ # Configured by : markm -# Target system : freebsd 4.0-current #0: +# Target system : dragonly Author='' Date='$Date$' Header='' -Id='$FreeBSD: src/gnu/usr.bin/perl/libperl/config.SH-elf.i386,v 1.15.2.1 2000/10/31 08:05:27 ps Exp $' +Id='$DragonFly: src/gnu/usr.bin/perl/libperl/Attic/config.SH-elf.i386,v 1.3 2004/02/02 05:43:13 dillon Exp $' Locker='' Mcc='Mcc' RCSfile='$RCSfile$' @@ -31,7 +31,7 @@ apiversion='5.005' ar='ar' archlib='/usr/libdata/perl/5.00503/mach' archlibexp='/usr/libdata/perl/5.00503/mach' -archname='i386-freebsd' +archname='i386-dragonfly' archobjs='' awk='awk' baserev='5.0' @@ -406,7 +406,7 @@ installman1dir='/usr/local/man/man1' installman3dir='/usr/local/lib/perl5/5.00503/man/man3' installprivlib='/usr/libdata/perl/5.00503' installscript='/usr/local/bin' -installsitearch='/usr/local/lib/perl5/site_perl/5.005/i386-freebsd' +installsitearch='/usr/local/lib/perl5/site_perl/5.005/i386-dragonfly' installsitelib='/usr/local/lib/perl5/site_perl/5.005' installusrbinperl='undef' intsize='4' @@ -458,7 +458,7 @@ models='none' modetype='mode_t' more='more' mv='' -myarchname='i386-freebsd' +myarchname='i386-dragonfly' mydomain='.FreeBSD.org' myhostname='freefall' myuname='FreeBSD freefall.FreeBSD.org 4.0-current FreeBSD 4.0-current #0: $Date$' @@ -476,7 +476,7 @@ o_nonblock='O_NONBLOCK' obj_ext='.o' optimize=${CFLAGS:-''} orderlib='false' -osname='freebsd' +osname='dragonfly' osvers='4.0-current' package='perl5' pager='/usr/bin/more' @@ -522,8 +522,8 @@ sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE" sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 6 ' sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 6, 0' signal_t='void' -sitearch='/usr/local/lib/perl5/site_perl/5.005/i386-freebsd' -sitearchexp='/usr/local/lib/perl5/site_perl/5.005/i386-freebsd' +sitearch='/usr/local/lib/perl5/site_perl/5.005/i386-dragonfly' +sitearchexp='/usr/local/lib/perl5/site_perl/5.005/i386-dragonfly' sitelib='/usr/local/lib/perl5/site_perl/5.005' sitelibexp='/usr/local/lib/perl5/site_perl/5.005' sizetype='size_t' @@ -586,12 +586,12 @@ zcat='' zip='zip' # Configure command line arguments. config_arg0='Configure' -config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-freebsd -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more' +config_args='-Dprefix=/usr -Darchlib=/usr/libdata/perl/5.00503/mach -Dprivlib=/usr/libdata/perl/5.00503 -Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-dragonfly -Dsitelib=/usr/local/lib/perl5/site_perl/5.005 -Dman1dir=/usr/local/man/man1 -Dman3dir=/usr/share/perl/man/man3 -Ulocincpth= -Uloclibpth= -Dpager=/usr/bin/more' config_argc=10 config_arg1='-Dprefix=/usr' config_arg2='-Darchlib=/usr/libdata/perl/5.00503/mach' config_arg3='-Dprivlib=/usr/libdata/perl/5.00503' -config_arg4='-Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-freebsd' +config_arg4='-Dsitearch=/usr/local/lib/perl5/site_perl/5.005/i386-dragonfly' config_arg5='-Dsitelib=/usr/local/lib/perl5/site_perl/5.005' config_arg6='-Dman1dir=/usr/local/man/man1' config_arg7='-Dman3dir=/usr/share/perl/man/man3' diff --git a/include/ieeefp.h b/include/ieeefp.h index 5013abdf12..866bec291e 100644 --- a/include/ieeefp.h +++ b/include/ieeefp.h @@ -1,6 +1,6 @@ /* $NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $ */ /* $FreeBSD: src/include/ieeefp.h,v 1.3.2.1 2000/08/17 08:08:14 jhb Exp $ */ -/* $DragonFly: src/include/ieeefp.h,v 1.3 2003/11/14 01:01:43 dillon Exp $ */ +/* $DragonFly: src/include/ieeefp.h,v 1.4 2004/02/02 05:43:13 dillon Exp $ */ /* * Written by J.T. Conklin, Apr 6, 1995 @@ -16,6 +16,7 @@ #ifdef __i386__ #include #else /* !__i386__ */ +#if !defined(_IEEEFP_INLINED_) __BEGIN_DECLS extern fp_rnd_t fpgetround (void); extern fp_rnd_t fpsetround (fp_rnd_t); @@ -24,6 +25,7 @@ extern fp_except_t fpsetmask (fp_except_t); extern fp_except_t fpgetsticky (void); extern fp_except_t fpsetsticky (fp_except_t); __END_DECLS +#endif /* !_IEEEFP_INLINED_ */ #endif /* __i386__ */ #endif /* _IEEEFP_H_ */ diff --git a/include/rpcsvc/Makefile b/include/rpcsvc/Makefile index f59d74fb7f..bb21185761 100644 --- a/include/rpcsvc/Makefile +++ b/include/rpcsvc/Makefile @@ -1,9 +1,13 @@ # from: @(#)Makefile 2.3 88/08/11 4.0 RPCSRC # $FreeBSD: src/include/rpcsvc/Makefile,v 1.24.2.1 2002/07/22 14:21:46 ru Exp $ -# $DragonFly: src/include/rpcsvc/Makefile,v 1.2 2003/06/17 04:25:58 dillon Exp $ +# $DragonFly: src/include/rpcsvc/Makefile,v 1.3 2004/02/02 05:43:13 dillon Exp $ .SUFFIXES: .x +# Inherit CPP_PATH from the buildworld so we use the correct cpp +# binary. Otherwise the system cpp might get confused with our +# OBJFORMAT_PATH. +# RPCCOM = rpcgen -C HDRS= key_prot.h klm_prot.h mount.h nfs_prot.h nlm_prot.h rex.h rnusers.h \ diff --git a/lib/Makefile b/lib/Makefile index eff06d1c72..0651bec36d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,6 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD: src/lib/Makefile,v 1.107.2.16 2002/10/10 19:24:35 kbyanc Exp $ -# $DragonFly: src/lib/Makefile,v 1.4 2003/08/05 07:45:41 asmodai Exp $ +# $DragonFly: src/lib/Makefile,v 1.5 2004/02/02 05:43:13 dillon Exp $ # To satisfy shared library or ELF linkage when only the libraries being # built are visible: @@ -37,9 +37,11 @@ _csu=csu/${MACHINE_ARCH}-${OBJFORMAT} _csu=csu/${MACHINE_ARCH} .endif +.if ${MACHINE_ARCH} == "i386" .if !defined(NOLIBC_R) _libc_r= libc_r .endif +.endif .if !defined(NO_BIND) _libbind= libbind diff --git a/lib/csu/alpha/Makefile b/lib/csu/alpha/Makefile deleted file mode 100644 index dd90602b8c..0000000000 --- a/lib/csu/alpha/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# -# $FreeBSD: src/lib/csu/alpha/Makefile,v 1.11.2.4 2002/08/07 16:31:47 ru Exp $ -# $DragonFly: src/lib/csu/alpha/Attic/Makefile,v 1.2 2003/06/17 04:26:41 dillon Exp $ -# - -SRCS= crt1.c crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= gcrt1.o -CFLAGS+= -Wall -Wno-unused \ - -I${.CURDIR}/../common - -.PATH: ${.CURDIR}/../common - -all: ${OBJS} - -CLEANFILES= ${OBJS} - -gcrt1.o: crt1.c - ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC} - -realinstall: - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${OBJS} ${DESTDIR}${LIBDIR} - -.include diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile new file mode 100644 index 0000000000..1ae2b34687 --- /dev/null +++ b/lib/csu/amd64/Makefile @@ -0,0 +1,23 @@ +# $FreeBSD: src/lib/csu/amd64/Makefile,v 1.18 2003/06/30 12:53:39 ru Exp $ +# $DragonFly: src/lib/csu/amd64/Attic/Makefile,v 1.1 2004/02/02 05:43:13 dillon Exp $ + +.PATH: ${.CURDIR}/../common + +SRCS= crt1.c crti.S crtn.S +OBJS= ${SRCS:N*.h:R:S/$/.o/g} +OBJS+= gcrt1.o +CFLAGS+= -I${.CURDIR}/../common \ + -I${.CURDIR}/../../libc/include + +all: ${OBJS} + +CLEANFILES= ${OBJS} + +gcrt1.o: crt1.c + ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c + +realinstall: + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${OBJS} ${DESTDIR}${LIBDIR} + +.include diff --git a/lib/csu/alpha/crt1.c b/lib/csu/amd64/crt1.c similarity index 64% rename from lib/csu/alpha/crt1.c rename to lib/csu/amd64/crt1.c index b9d38f4177..8d6f1630da 100644 --- a/lib/csu/alpha/crt1.c +++ b/lib/csu/amd64/crt1.c @@ -1,10 +1,7 @@ -/* - * Copyright 2001 David E. O'Brien - * All rights reserved. +/* LINTLIBRARY */ +/*- * Copyright 1996-1998 John D. Polstra. * All rights reserved. - * Copyright (c) 1995 Christopher G. Demetriou - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -14,14 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the FreeBSD Project. - * See http://www.freebsd.org/ for information about FreeBSD. - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -34,26 +23,30 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/csu/alpha/crt1.c,v 1.7.2.2 2001/08/01 09:30:36 obrien Exp $ - * $DragonFly: src/lib/csu/alpha/Attic/crt1.c,v 1.2 2003/06/17 04:26:41 dillon Exp $ + * $FreeBSD: src/lib/csu/amd64/crt1.c,v 1.13 2003/04/30 19:27:07 peter Exp $ + * $DragonFly: src/lib/csu/amd64/crt1.c,v 1.1 2004/02/02 05:43:13 dillon Exp $ */ +#ifndef lint #ifndef __GNUC__ #error "GCC is needed to compile this file" #endif +#endif /* lint */ #include -#include "crtbrand.c" -struct Struct_Obj_Entry; -struct ps_strings; +#include "libc_private.h" +#include "crtbrand.c" -#pragma weak _DYNAMIC extern int _DYNAMIC; +#pragma weak _DYNAMIC + +typedef void (*fptr)(void); -extern void _init(void); extern void _fini(void); +extern void _init(void); extern int main(int, char **, char **); +extern void _start(char **, void (*)(void)); #ifdef GCRT extern void _mcleanup(void); @@ -63,25 +56,22 @@ extern int etext; #endif char **environ; -char *__progname = ""; +const char *__progname = ""; /* The entry function. */ void -_start(char **ap, - void (*cleanup)(void), /* from shared loader */ - struct Struct_Obj_Entry *obj, /* from shared loader */ - struct ps_strings *ps_strings) +_start(char **ap, void (*cleanup)(void)) { int argc; char **argv; char **env; + const char *s; - argc = * (long *) ap; + argc = *(long *)(void *)ap; argv = ap + 1; - env = ap + 2 + argc; + env = ap + 2 + argc; environ = env; - if(argc > 0 && argv[0] != NULL) { - char *s; + if (argc > 0 && argv[0] != NULL) { __progname = argv[0]; for (s = __progname; *s != '\0'; s++) if (*s == '/') @@ -108,6 +98,4 @@ __asm__("eprol:"); __asm__(".previous"); #endif -/* - * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text. - */ +__asm__(".ident\t\"$DragonFly: src/lib/csu/amd64/crt1.c,v 1.1 2004/02/02 05:43:13 dillon Exp $\""); diff --git a/lib/csu/alpha/crti.S b/lib/csu/amd64/crti.S similarity index 74% rename from lib/csu/alpha/crti.S rename to lib/csu/amd64/crti.S index 465b62f486..e0b4328399 100644 --- a/lib/csu/alpha/crti.S +++ b/lib/csu/amd64/crti.S @@ -1,5 +1,5 @@ -/* - * Copyright 2000 David O'Brien, John D. Polstra. +/*- + * Copyright 1996, 1997, 1998, 2000 John D. Polstra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -21,34 +21,22 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/csu/amd64/crti.S,v 1.6 2002/05/15 04:19:49 obrien Exp $ + * $DragonFly: src/lib/csu/amd64/crti.S,v 1.1 2004/02/02 05:43:13 dillon Exp $ */ .section .init,"ax",@progbits - .align 5 + .align 4 .globl _init + .type _init,@function _init: - ldgp $29,0($27) -$_init..ng: - lda $30,-16($30) - stq $26,0($30) - stq $15,8($30) - mov $30,$15 - .align 5 - .section .fini,"ax",@progbits - .align 5 + .align 4 .globl _fini + .type _fini,@function _fini: - ldgp $29,0($27) -$_fini..ng: - lda $30,-16($30) - stq $26,0($30) - stq $15,8($30) - mov $30,$15 - .align 5 - -.section .rodata - .ascii "$FreeBSD: src/lib/csu/alpha/crti.S,v 1.1.2.2 2001/08/01 09:30:36 obrien Exp $\0" - .ascii "$DragonFly: src/lib/csu/alpha/Attic/crti.S,v 1.2 2003/06/17 04:26:41 dillon Exp $\0" + .section .rodata +.ascii "$DragonFly: src/lib/csu/amd64/crti.S,v 1.1 2004/02/02 05:43:13 dillon Exp $\0" diff --git a/lib/csu/alpha/crtn.S b/lib/csu/amd64/crtn.S similarity index 74% rename from lib/csu/alpha/crtn.S rename to lib/csu/amd64/crtn.S index ae45491008..498f31067a 100644 --- a/lib/csu/alpha/crtn.S +++ b/lib/csu/amd64/crtn.S @@ -1,5 +1,5 @@ -/* - * Copyright 2000 David O'Brien, John D. Polstra. +/*- + * Copyright 1996, 1997, 1998, 2000 John D. Polstra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -21,26 +21,16 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/csu/amd64/crtn.S,v 1.5 2002/05/15 04:19:49 obrien Exp $ + * $DragonFly: src/lib/csu/amd64/crtn.S,v 1.1 2004/02/02 05:43:13 dillon Exp $ */ .section .init,"ax",@progbits - ldgp $29,0($26) - mov $15,$30 - ldq $26,0($30) - ldq $15,8($30) - lda $30,16($30) - ret $31,($26),1 - + ret .section .fini,"ax",@progbits - ldgp $29,0($26) - mov $15,$30 - ldq $26,0($30) - ldq $15,8($30) - lda $30,16($30) - ret $31,($26),1 - + ret -.section .rodata - .ascii "$FreeBSD: src/lib/csu/alpha/crtn.S,v 1.1.2.2 2001/08/01 09:30:36 obrien Exp $\0" - .ascii "$DragonFly: src/lib/csu/alpha/Attic/crtn.S,v 1.2 2003/06/17 04:26:41 dillon Exp $\0" + .section .rodata +.ascii "$DragonFly: src/lib/csu/amd64/crtn.S,v 1.1 2004/02/02 05:43:13 dillon Exp $\0" diff --git a/lib/libc/amd64/Makefile.inc b/lib/libc/amd64/Makefile.inc new file mode 100644 index 0000000000..6ecb55081c --- /dev/null +++ b/lib/libc/amd64/Makefile.inc @@ -0,0 +1,10 @@ +# $FreeBSD: src/lib/libc/amd64/Makefile.inc,v 1.1 2003/07/22 06:34:57 peter Exp $ +# $DragonFly: src/lib/libc/amd64/Makefile.inc,v 1.1 2004/02/02 05:43:14 dillon Exp $ +# +# Machine dependent definitions for the amd64 architecture. +# + +# +# AMD64 is 64-bit, so it doesn't need quad functions: +# +NO_QUAD=1 diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h new file mode 100644 index 0000000000..a38201ca89 --- /dev/null +++ b/lib/libc/amd64/SYS.h @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)SYS.h 5.5 (Berkeley) 5/7/91 + * $FreeBSD: src/lib/libc/amd64/SYS.h,v 1.26 2003/05/24 17:35:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/SYS.h,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include + +#ifdef PIC +#define SYSCALL(x) 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; \ + jmp *%rcx; \ + ENTRY(__CONCAT(__sys_,x)); \ + .weak CNAME(x); \ + .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ + .weak CNAME(__CONCAT(_,x)); \ + .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2b +#else +#define SYSCALL(x) 2: jmp HIDENAME(cerror); \ + ENTRY(__CONCAT(__sys_,x)); \ + .weak CNAME(x); \ + .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ + .weak CNAME(__CONCAT(_,x)); \ + .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2b +#endif + +#define RSYSCALL(x) SYSCALL(x); ret + +#define PSEUDO(x,y) ENTRY(__CONCAT(__sys_,x)); \ + .weak CNAME(__CONCAT(_,x)); \ + .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + mov __CONCAT($SYS_,x),%rax; KERNCALL; ret + +#define KERNCALL movq %rcx, %r10; syscall diff --git a/lib/libc/amd64/_fpmath.h b/lib/libc/amd64/_fpmath.h new file mode 100644 index 0000000000..4b2ee4d391 --- /dev/null +++ b/lib/libc/amd64/_fpmath.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2002, 2003 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/_fpmath.h,v 1.4 2004/01/18 07:57:01 das Exp $ + * $DragonFly: src/lib/libc/amd64/_fpmath.h,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +union IEEEl2bits { + long double e; + struct { + unsigned int manl :32; + unsigned int manh :32; + unsigned int exp :15; + unsigned int sign :1; + unsigned int junkl :16; + unsigned int junkh :32; + } bits; +}; + +#define mask_nbit_l(u) ((u).bits.manh &= 0x7fffffff) + +#define LDBL_MANH_SIZE 32 +#define LDBL_MANL_SIZE 32 + +#define LDBL_TO_ARRAY32(u, a) do { \ + (a)[0] = (uint32_t)(u).bits.manl; \ + (a)[1] = (uint32_t)(u).bits.manh; \ +} while(0) diff --git a/lib/libc/amd64/arith.h b/lib/libc/amd64/arith.h new file mode 100644 index 0000000000..f4dafa98fc --- /dev/null +++ b/lib/libc/amd64/arith.h @@ -0,0 +1,20 @@ +/* + * MD header for contrib/gdtoa + * + * $FreeBSD: src/lib/libc/amd64/arith.h,v 1.3 2003/05/08 13:50:43 das Exp $ + * $DragonFly: src/lib/libc/amd64/arith.h,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +/* + * NOTE: The definitions in this file must be correct or strtod(3) and + * floating point formats in printf(3) will break! The file can be + * generated by running contrib/gdtoa/arithchk.c on the target + * architecture. See contrib/gdtoa/gdtoaimp.h for details. + */ + +#define IEEE_8087 +#define Arith_Kind_ASL 1 +#define Long int +#define Intcast (int)(long) +#define Double_Align +#define X64_bit_pointers diff --git a/lib/libc/amd64/gen/Makefile.inc b/lib/libc/amd64/gen/Makefile.inc new file mode 100644 index 0000000000..43317fb80c --- /dev/null +++ b/lib/libc/amd64/gen/Makefile.inc @@ -0,0 +1,10 @@ +# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 +# $FreeBSD: src/lib/libc/amd64/gen/Makefile.inc,v 1.24 2003/10/13 20:32:33 alc Exp $ +# $DragonFly: src/lib/libc/amd64/gen/Makefile.inc,v 1.1 2004/02/02 05:43:14 dillon Exp $ + +SRCS+= _setjmp.S rfork_thread.S setjmp.S sigsetjmp.S \ + fabs.S modf.S \ + frexp.c infinity.c isinf.c ldexp.c \ + makecontext.c signalcontext.c \ + fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \ + fpgetround.c fpsetround.c fpgetsticky.c fpsetsticky.c diff --git a/lib/libc/amd64/gen/_setjmp.S b/lib/libc/amd64/gen/_setjmp.S new file mode 100644 index 0000000000..f7e53af21f --- /dev/null +++ b/lib/libc/amd64/gen/_setjmp.S @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)_setjmp.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/gen/_setjmp.S,v 1.18 2003/06/02 22:37:53 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/_setjmp.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* + * C library -- _setjmp, _longjmp + * + * _longjmp(a,v) + * will generate a "return(v)" from the last call to + * _setjmp(a) + * by restoring registers from the environment 'a'. + * The previous signal state is NOT restored. + */ + +ENTRY(_setjmp) + movq %rdi,%rax + movq 0(%rsp),%rdx /* retval */ + movq %rdx, 0(%rax) /* 0; retval */ + movq %rbx, 8(%rax) /* 1; rbx */ + movq %rsp,16(%rax) /* 2; rsp */ + movq %rbp,24(%rax) /* 3; rbp */ + movq %r12,32(%rax) /* 4; r12 */ + movq %r13,40(%rax) /* 5; r13 */ + movq %r14,48(%rax) /* 6; r14 */ + movq %r15,56(%rax) /* 7; r15 */ + fnstcw 64(%rax) /* 8; fpu cw */ + xorq %rax,%rax + ret + + .weak CNAME(_longjmp) + .set CNAME(_longjmp),CNAME(___longjmp) +ENTRY(___longjmp) + movq %rdi,%rdx + movq %rsi,%rax /* retval */ + movq 0(%rdx),%rcx + movq 8(%rdx),%rbx + movq 16(%rdx),%rsp + movq 24(%rdx),%rbp + movq 32(%rdx),%r12 + movq 40(%rdx),%r13 + movq 48(%rdx),%r14 + movq 56(%rdx),%r15 + fninit + fldcw 64(%rdx) + testq %rax,%rax + jnz 1f + incq %rax +1: movq %rcx,0(%rsp) + ret diff --git a/lib/libc/amd64/gen/fabs.S b/lib/libc/amd64/gen/fabs.S new file mode 100644 index 0000000000..26f08c5117 --- /dev/null +++ b/lib/libc/amd64/gen/fabs.S @@ -0,0 +1,20 @@ +/* + * $NetBSD: fabs.S,v 1.4 1997/07/16 14:37:16 christos Exp $ + * $FreeBSD: src/lib/libc/amd64/gen/fabs.S,v 1.2 2003/09/26 01:49:48 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/fabs.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* + * Ok, this sucks. Is there really no way to push an xmm register onto + * the FP stack directly? + */ + +ENTRY(fabs) + movsd %xmm0, -8(%rsp) + fldl -8(%rsp) + fabs + fstpl -8(%rsp) + movsd -8(%rsp),%xmm0 + ret diff --git a/lib/libc/amd64/gen/fpgetmask.c b/lib/libc/amd64/gen/fpgetmask.c new file mode 100644 index 0000000000..867237449e --- /dev/null +++ b/lib/libc/amd64/gen/fpgetmask.c @@ -0,0 +1,12 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpgetmask.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpgetmask.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_except_t fpgetmask(void) +{ + return __fpgetmask(); +} diff --git a/lib/libc/amd64/gen/fpgetprec.c b/lib/libc/amd64/gen/fpgetprec.c new file mode 100644 index 0000000000..2f6e8e8e62 --- /dev/null +++ b/lib/libc/amd64/gen/fpgetprec.c @@ -0,0 +1,12 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpgetprec.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpgetprec.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_prec_t fpgetprec(void) +{ + return __fpgetprec(); +} diff --git a/lib/libc/amd64/gen/fpgetround.c b/lib/libc/amd64/gen/fpgetround.c new file mode 100644 index 0000000000..85430e84a0 --- /dev/null +++ b/lib/libc/amd64/gen/fpgetround.c @@ -0,0 +1,11 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpgetround.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpgetround.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_rnd_t fpgetround(void) +{ + return __fpgetround(); +} diff --git a/lib/libc/amd64/gen/fpgetsticky.c b/lib/libc/amd64/gen/fpgetsticky.c new file mode 100644 index 0000000000..73e9a92a77 --- /dev/null +++ b/lib/libc/amd64/gen/fpgetsticky.c @@ -0,0 +1,11 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpgetsticky.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpgetsticky.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_except_t fpgetsticky(void) +{ + return __fpgetsticky(); +} diff --git a/lib/libc/amd64/gen/fpsetmask.c b/lib/libc/amd64/gen/fpsetmask.c new file mode 100644 index 0000000000..94b1ac0fb7 --- /dev/null +++ b/lib/libc/amd64/gen/fpsetmask.c @@ -0,0 +1,11 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpsetmask.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpsetmask.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_except_t fpsetmask(fp_except_t m) +{ + return (__fpsetmask(m)); +} diff --git a/lib/libc/amd64/gen/fpsetprec.c b/lib/libc/amd64/gen/fpsetprec.c new file mode 100644 index 0000000000..25c797b754 --- /dev/null +++ b/lib/libc/amd64/gen/fpsetprec.c @@ -0,0 +1,11 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpsetprec.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpsetprec.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_prec_t fpsetprec(fp_prec_t m) +{ + return (__fpsetprec(m)); +} diff --git a/lib/libc/amd64/gen/fpsetround.c b/lib/libc/amd64/gen/fpsetround.c new file mode 100644 index 0000000000..24812ad974 --- /dev/null +++ b/lib/libc/amd64/gen/fpsetround.c @@ -0,0 +1,11 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpsetround.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpsetround.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_rnd_t fpsetround(fp_rnd_t m) +{ + return (__fpsetround(m)); +} diff --git a/lib/libc/amd64/gen/fpsetsticky.c b/lib/libc/amd64/gen/fpsetsticky.c new file mode 100644 index 0000000000..e1f36fdb05 --- /dev/null +++ b/lib/libc/amd64/gen/fpsetsticky.c @@ -0,0 +1,11 @@ +/* + * $FreeBSD: src/lib/libc/amd64/gen/fpsetsticky.c,v 1.1 2003/07/22 06:46:17 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/fpsetsticky.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ +#define __IEEEFP_NOINLINES__ 1 +#include + +fp_except_t fpsetsticky(fp_except_t m) +{ + return (__fpsetsticky(m)); +} diff --git a/lib/libc/amd64/gen/frexp.c b/lib/libc/amd64/gen/frexp.c new file mode 100644 index 0000000000..25b15391ac --- /dev/null +++ b/lib/libc/amd64/gen/frexp.c @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)frexp.c 8.1 (Berkeley) 6/4/93 + * $FreeBSD: src/lib/libc/amd64/gen/frexp.c,v 1.8 2002/03/23 02:05:17 obrien Exp $ + * $DragonFly: src/lib/libc/amd64/gen/frexp.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include + +double +frexp(value, eptr) + double value; + int *eptr; +{ + union { + double v; + struct { + u_int u_mant2 : 32; + u_int u_mant1 : 20; + u_int u_exp : 11; + u_int u_sign : 1; + } s; + } u; + + if (value) { + u.v = value; + *eptr = u.s.u_exp - 1022; + u.s.u_exp = 1022; + return(u.v); + } else { + *eptr = 0; + return((double)0); + } +} diff --git a/lib/libc/amd64/gen/infinity.c b/lib/libc/amd64/gen/infinity.c new file mode 100644 index 0000000000..aaff0c3595 --- /dev/null +++ b/lib/libc/amd64/gen/infinity.c @@ -0,0 +1,14 @@ +/* + * infinity.c + * + * $FreeBSD: src/lib/libc/amd64/gen/infinity.c,v 1.10 2003/02/08 20:37:52 mike Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/infinity.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* bytes for +Infinity on a 387 */ +const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; + +/* bytes for NaN */ +const union __nan_un __nan = { { 0, 0, 0xc0, 0xff } }; diff --git a/lib/libc/amd64/gen/isinf.c b/lib/libc/amd64/gen/isinf.c new file mode 100644 index 0000000000..70cc9e5261 --- /dev/null +++ b/lib/libc/amd64/gen/isinf.c @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)isinf.c 8.1 (Berkeley) 6/4/93 + * $FreeBSD: src/lib/libc/amd64/gen/isinf.c,v 1.10 2003/02/12 20:03:41 mike Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/isinf.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +/* For binary compat; to be removed in FreeBSD 6.0. */ + +#include + +int +isnan(d) + double d; +{ + register struct IEEEdp { + u_int manl : 32; + u_int manh : 20; + u_int exp : 11; + u_int sign : 1; + } *p = (struct IEEEdp *)&d; + + return(p->exp == 2047 && (p->manh || p->manl)); +} + +int +isinf(d) + double d; +{ + register struct IEEEdp { + u_int manl : 32; + u_int manh : 20; + u_int exp : 11; + u_int sign : 1; + } *p = (struct IEEEdp *)&d; + + return(p->exp == 2047 && !p->manh && !p->manl); +} diff --git a/lib/libc/amd64/gen/ldexp.c b/lib/libc/amd64/gen/ldexp.c new file mode 100644 index 0000000000..8cadf3fd5f --- /dev/null +++ b/lib/libc/amd64/gen/ldexp.c @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Sean Eric Fagan. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ldexp.c 8.1 (Berkeley) 6/4/93 + * $FreeBSD: src/lib/libc/amd64/gen/ldexp.c,v 1.11 2003/06/10 21:17:55 obrien Exp $ + * $DragonFly: src/lib/libc/amd64/gen/ldexp.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +/* + * ldexp(value, exp): return value * (2 ** exp). + * + * Written by Sean Eric Fagan (sef@kithrup.COM) + * Sun Mar 11 20:27:09 PST 1990 + */ + +/* + * We do the conversion in C to let gcc optimize it away, if possible. + * The "fxch ; fstp" stuff is because value is still on the stack + * (stupid 8087!). + */ +double +ldexp (double value, int exp) +{ + double temp, texp, temp2; + texp = exp; +#ifdef __GNUC__ + __asm ("fscale " + : "=u" (temp2), "=t" (temp) + : "0" (texp), "1" (value)); +#else +error unknown asm +#endif + return (temp); +} diff --git a/lib/libc/amd64/gen/makecontext.c b/lib/libc/amd64/gen/makecontext.c new file mode 100644 index 0000000000..75b8281a9a --- /dev/null +++ b/lib/libc/amd64/gen/makecontext.c @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2003 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/gen/makecontext.c,v 1.2 2003/12/05 01:36:44 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/makecontext.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + + +#include +#include +#include +#include + +typedef void (*func_t)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, + uint64_t); + +/* Prototypes */ +static void ctx_wrapper(ucontext_t *ucp, func_t func, uint64_t *args); + +__weak_reference(__makecontext, makecontext); + +void +__makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...) +{ + uint64_t *args; + uint64_t *sp; + va_list ap; + int i; + + /* A valid context is required. */ + if ((ucp == NULL) || (ucp->uc_mcontext.mc_len != sizeof(mcontext_t))) + return; + else if ((argc < 0) || (argc > 6) || (ucp->uc_stack.ss_sp == NULL) || + (ucp->uc_stack.ss_size < MINSIGSTKSZ)) { + /* + * This should really return -1 with errno set to ENOMEM + * or something, but the spec says that makecontext is + * a void function. At least make sure that the context + * isn't valid so it can't be used without an error. + */ + ucp->uc_mcontext.mc_len = 0; + return; + } + + /* Align the stack to 16 bytes. */ + sp = (uint64_t *)(ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); + sp = (uint64_t *)((uint64_t)sp & -15UL); + + /* Allocate space for a maximum of 6 arguments on the stack. */ + args = sp - 6; + + /* + * Account for arguments on stack and do the funky C entry alignment. + * This means that we need an 8-byte-odd alignment since the ABI expects + * the return address to be pushed, thus breaking the 16 byte alignment. + */ + sp -= 7; + + /* Add the arguments: */ + va_start(ap, argc); + for (i = 0; i < argc; i++) + args[i] = va_arg(ap, uint64_t); + va_end(ap); + for (i = argc; i < 6; i++) + args[i] = 0; + + ucp->uc_mcontext.mc_rdi = (register_t)ucp; + ucp->uc_mcontext.mc_rsi = (register_t)start; + ucp->uc_mcontext.mc_rdx = (register_t)args; + ucp->uc_mcontext.mc_rbp = (register_t)sp; + ucp->uc_mcontext.mc_rbx = (register_t)sp; + ucp->uc_mcontext.mc_rsp = (register_t)sp; + ucp->uc_mcontext.mc_rip = (register_t)ctx_wrapper; +} + +static void +ctx_wrapper(ucontext_t *ucp, func_t func, uint64_t *args) +{ + (*func)(args[0], args[1], args[2], args[3], args[4], args[5]); + if (ucp->uc_link == NULL) + exit(0); + setcontext((const ucontext_t *)ucp->uc_link); + /* should never get here */ + abort(); + /* NOTREACHED */ +} diff --git a/lib/libc/amd64/gen/modf.S b/lib/libc/amd64/gen/modf.S new file mode 100644 index 0000000000..db3a370f7d --- /dev/null +++ b/lib/libc/amd64/gen/modf.S @@ -0,0 +1,91 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Sean Eric Fagan. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)modf.s 5.5 (Berkeley) 3/18/91 + * $NetBSD: modf.S,v 1.5 1997/07/16 14:37:18 christos Exp $ + * $FreeBSD: src/lib/libc/amd64/gen/modf.S,v 1.2 2003/05/08 03:19:37 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/modf.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* + * modf(value, iptr): return fractional part of value, and stores the + * integral part into iptr (a pointer to double). + * + * Written by Sean Eric Fagan (sef@kithrup.COM) + * Sun Mar 11 20:27:30 PST 1990 + */ + +/* With CHOP mode on, frndint behaves as TRUNC does. Useful. */ +ENTRY(modf) + + /* + * Set chop mode. + */ + fnstcw -12(%rsp) + movw -12(%rsp),%dx + orw $3072,%dx + movw %dx,-16(%rsp) + fldcw -16(%rsp) + + /* + * Get integral part. + */ + movsd %xmm0,-24(%rsp) + fldl -24(%rsp) + frndint + fstpl -8(%rsp) + + /* + * Restore control word. + */ + fldcw -12(%rsp) + + /* + * Store integral part. + */ + movsd -8(%rsp),%xmm0 + movsd %xmm0,(%rdi) + + /* + * Get fractional part and return it. + */ + fldl -24(%rsp) + fsubl -8(%rsp) + fstpl -8(%rsp) + movsd -8(%rsp),%xmm0 + + ret diff --git a/lib/libc/amd64/gen/rfork_thread.S b/lib/libc/amd64/gen/rfork_thread.S new file mode 100644 index 0000000000..f509c2703f --- /dev/null +++ b/lib/libc/amd64/gen/rfork_thread.S @@ -0,0 +1,103 @@ +/*- + * Copyright (c) 2000 Peter Wemm + * Copyright (c) 2003 Alan L. Cox + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/gen/rfork_thread.S,v 1.1 2003/10/13 20:32:33 alc Exp $ + * $DragonFly: src/lib/libc/amd64/gen/rfork_thread.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* + * With thanks to John Dyson for the original version of this. + */ + +#include + +/* + * %edi %rsi %rdx %rcx + * rfork_thread(flags, stack_addr, start_fnc, start_arg); + * + * flags: Flags to rfork system call. See rfork(2). + * stack_addr: Top of stack for thread. + * start_fnc: Address of thread function to call in child. + * start_arg: Argument to pass to the thread function in child. + */ + +ENTRY(rfork_thread) + pushq %rbx + pushq %r12 + movq %rdx, %rbx + movq %rcx, %r12 + + /* + * Prepare and execute the thread creation syscall + */ + movq $SYS_rfork, %rax + KERNCALL + jb 2f + + /* + * Check to see if we are in the parent or child + */ + cmpl $0, %edx + jnz 1f + popq %r12 + popq %rbx + ret + + /* + * If we are in the child (new thread), then + * set-up the call to the internal subroutine. If it + * returns, then call __exit. + */ +1: + movq %rsi, %rsp + movq %r12, %rdi + call *%rbx + movl %eax, %edi + + /* + * Exit system call + */ +#ifdef SYS_exit + movq $SYS_exit, %rax +#else + movq $SYS_sys_exit, %rax +#endif + KERNCALL + + /* + * Branch here if the thread creation fails: + */ +2: + popq %r12 + popq %rbx +#ifdef PIC + movq PIC_GOT(HIDENAME(cerror)), %rdx + jmp *%rdx +#else + jmp HIDENAME(cerror) +#endif diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S new file mode 100644 index 0000000000..b90e7208c4 --- /dev/null +++ b/lib/libc/amd64/gen/setjmp.S @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)setjmp.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/gen/setjmp.S,v 1.26 2003/06/02 22:37:53 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/setjmp.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* + * C library -- _setjmp, _longjmp + * + * longjmp(a,v) + * will generate a "return(v)" from the last call to + * setjmp(a) + * by restoring registers from the environment 'a'. + * The previous signal state is restored. + */ + +#include "SYS.h" + +ENTRY(setjmp) + pushq %rdi + movq %rdi,%rcx + movq $1,%rdi /* SIG_BLOCK */ + movq $0,%rsi /* (sigset_t*)set */ + leaq 72(%rcx),%rdx /* 9,10; (sigset_t*)oset */ + call PIC_PLT(CNAME(_sigprocmask)) + popq %rdi + movq %rdi,%rcx + movq 0(%rsp),%rdx /* retval */ + movq %rdx, 0(%rcx) /* 0; retval */ + movq %rbx, 8(%rcx) /* 1; rbx */ + movq %rsp,16(%rcx) /* 2; rsp */ + movq %rbp,24(%rcx) /* 3; rbp */ + movq %r12,32(%rcx) /* 4; r12 */ + movq %r13,40(%rcx) /* 5; r13 */ + movq %r14,48(%rcx) /* 6; r14 */ + movq %r15,56(%rcx) /* 7; r15 */ + fnstcw 64(%rcx) /* 8; fpu cw */ + xorq %rax,%rax + ret + + .weak CNAME(longjmp) + .set CNAME(longjmp),CNAME(__longjmp) +ENTRY(__longjmp) + pushq %rdi + pushq %rsi + movq %rdi,%rdx + movq $3,%rdi /* SIG_SETMASK */ + leaq 72(%rdx),%rsi /* (sigset_t*)set */ + movq $0,%rdx /* (sigset_t*)oset */ + call PIC_PLT(CNAME(_sigprocmask)) + popq %rsi + popq %rdi /* jmpbuf */ + movq %rdi,%rdx + movq %rsi,%rax /* retval */ + movq 0(%rdx),%rcx + movq 8(%rdx),%rbx + movq 16(%rdx),%rsp + movq 24(%rdx),%rbp + movq 32(%rdx),%r12 + movq 40(%rdx),%r13 + movq 48(%rdx),%r14 + movq 56(%rdx),%r15 + fninit + fldcw 64(%rdx) + testq %rax,%rax + jnz 1f + incq %rax +1: movq %rcx,0(%rsp) + ret diff --git a/lib/libc/amd64/gen/signalcontext.c b/lib/libc/amd64/gen/signalcontext.c new file mode 100644 index 0000000000..63c0825dc5 --- /dev/null +++ b/lib/libc/amd64/gen/signalcontext.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2003 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/gen/signalcontext.c,v 1.2 2003/07/26 12:58:28 davidxu Exp $ + * $DragonFly: src/lib/libc/amd64/gen/Attic/signalcontext.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include +#include +#include +#include + +typedef void (*handler_t)(uint64_t, uint64_t, uint64_t); + +/* Prototypes */ +static void ctx_wrapper(ucontext_t *ucp, handler_t func, uint64_t *args); + +__weak_reference(__signalcontext, signalcontext); + +int +__signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func) +{ + uint64_t *args; + siginfo_t *sig_si; + ucontext_t *sig_uc; + uint64_t sp; + + /* Bail out if we don't have a valid ucontext pointer. */ + if (ucp == NULL) + abort(); + + /* + * Build a signal frame and copy the arguments of signal handler + * 'func' onto the stack. We only need 3 arguments, but we + * create room for 4 so that we are 16-byte aligned. + */ + sp = (ucp->uc_mcontext.mc_rsp - sizeof(ucontext_t)) & ~15UL; + sig_uc = (ucontext_t *)sp; + bcopy(ucp, sig_uc, sizeof(*sig_uc)); + sp = (sp - sizeof(siginfo_t)) & ~15UL; + sig_si = (siginfo_t *)sp; + bzero(sig_si, sizeof(*sig_si)); + sig_si->si_signo = sig; + sp -= 4 * sizeof(uint64_t); + args = (uint64_t *)sp; + args[0] = sig; + args[1] = (intptr_t)sig_si; + args[2] = (intptr_t)sig_uc; + args[3] = 0; + sp -= 16; + + /* + * Setup the ucontext of the signal handler. + */ + bzero(&ucp->uc_mcontext, sizeof(ucp->uc_mcontext)); + ucp->uc_link = sig_uc; + sigdelset(&ucp->uc_sigmask, sig); + + ucp->uc_mcontext.mc_len = sizeof(mcontext_t); + ucp->uc_mcontext.mc_rdi = (register_t)ucp; + ucp->uc_mcontext.mc_rsi = (register_t)func; + ucp->uc_mcontext.mc_rdx = (register_t)args; + ucp->uc_mcontext.mc_rbp = (register_t)sp; + ucp->uc_mcontext.mc_rbx = (register_t)sp; + ucp->uc_mcontext.mc_rsp = (register_t)sp; + ucp->uc_mcontext.mc_rip = (register_t)ctx_wrapper; + return (0); +} + +static void +ctx_wrapper(ucontext_t *ucp, handler_t func, uint64_t *args) +{ + + (*func)(args[0], args[1], args[2]); + if (ucp->uc_link == NULL) + exit(0); + setcontext((const ucontext_t *)ucp->uc_link); + /* should never get here */ + abort(); + /* NOTREACHED */ +} diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S new file mode 100644 index 0000000000..bee0de63d3 --- /dev/null +++ b/lib/libc/amd64/gen/sigsetjmp.S @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)setjmp.s 5.1 (Berkeley) 4/23/90" + * $Id: sigsetjmp.S,v 1.1 1993/12/05 13:01:05 ats Exp $ + * $FreeBSD: src/lib/libc/amd64/gen/sigsetjmp.S,v 1.28 2003/06/02 22:37:53 peter Exp $ + * $DragonFly: src/lib/libc/amd64/gen/sigsetjmp.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +#include "SYS.h" + +/*- + * TODO: + * Rename sigsetjmp to __sigsetjmp and siglongjmp to __siglongjmp, + * remove the other *jmp functions and define everything in terms + * of the renamed functions. This requires compiler support for + * the renamed functions (introduced in gcc-2.5.3; previous versions + * only supported *jmp with 0 or 1 leading underscores). + * + * Restore _all_ the registers and the signal mask atomically. Can + * use sigreturn() if sigreturn() works. + */ + +ENTRY(sigsetjmp) + movl %esi,88(%rdi) /* 11; savemask */ + testl %esi,%esi + jz 2f + pushq %rdi + movq %rdi,%rcx + movq $1,%rdi /* SIG_BLOCK */ + movq $0,%rsi /* (sigset_t*)set */ + leaq 72(%rcx),%rdx /* 9,10 (sigset_t*)oset */ + call PIC_PLT(CNAME(_sigprocmask)) + popq %rdi +2: movq %rdi,%rcx + movq 0(%rsp),%rdx /* retval */ + movq %rdx, 0(%rcx) /* 0; retval */ + movq %rbx, 8(%rcx) /* 1; rbx */ + movq %rsp,16(%rcx) /* 2; rsp */ + movq %rbp,24(%rcx) /* 3; rbp */ + movq %r12,32(%rcx) /* 4; r12 */ + movq %r13,40(%rcx) /* 5; r13 */ + movq %r14,48(%rcx) /* 6; r14 */ + movq %r15,56(%rcx) /* 7; r15 */ + fnstcw 64(%rcx) /* 8; fpu cw */ + xorq %rax,%rax + ret + + .weak CNAME(siglongjmp) + .set CNAME(siglongjmp),CNAME(__siglongjmp) +ENTRY(__siglongjmp) + cmpl $0,88(%rdi) + jz 2f + movq %rdi,%rdx + pushq %rdi + pushq %rsi + movq $3,%rdi /* SIG_SETMASK */ + leaq 72(%rdx),%rsi /* (sigset_t*)set */ + movq $0,%rdx /* (sigset_t*)oset */ + call PIC_PLT(CNAME(_sigprocmask)) + popq %rsi + popq %rdi /* jmpbuf */ +2: movq %rdi,%rdx + movq %rsi,%rax /* retval */ + movq 0(%rdx),%rcx + movq 8(%rdx),%rbx + movq 16(%rdx),%rsp + movq 24(%rdx),%rbp + movq 32(%rdx),%r12 + movq 40(%rdx),%r13 + movq 48(%rdx),%r14 + movq 56(%rdx),%r15 + fninit + fldcw 64(%rdx) + testq %rax,%rax + jnz 1f + incq %rax +1: movq %rcx,0(%rsp) + ret diff --git a/lib/libc/amd64/net/Makefile.inc b/lib/libc/amd64/net/Makefile.inc new file mode 100644 index 0000000000..f830b82f3c --- /dev/null +++ b/lib/libc/amd64/net/Makefile.inc @@ -0,0 +1,5 @@ +# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 +# $FreeBSD: src/lib/libc/amd64/net/Makefile.inc,v 1.6 1999/08/27 23:59:24 peter Exp $ +# $DragonFly: src/lib/libc/amd64/net/Makefile.inc,v 1.1 2004/02/02 05:43:14 dillon Exp $ + +SRCS+= htonl.S htons.S ntohl.S ntohs.S diff --git a/lib/libc/amd64/net/htonl.S b/lib/libc/amd64/net/htonl.S new file mode 100644 index 0000000000..9d4503b608 --- /dev/null +++ b/lib/libc/amd64/net/htonl.S @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)htonl.s 5.3 (Berkeley) 12/17/90 + * $FreeBSD: src/lib/libc/amd64/net/htonl.S,v 1.10 2003/04/30 18:07:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/net/htonl.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* netorder = htonl(hostorder) */ + + .weak CNAME(htonl) + .set CNAME(htonl),CNAME(__htonl) +ENTRY(__htonl) + movl %edi,%eax + bswap %eax + ret diff --git a/lib/libc/amd64/net/htons.S b/lib/libc/amd64/net/htons.S new file mode 100644 index 0000000000..fdba2ec58f --- /dev/null +++ b/lib/libc/amd64/net/htons.S @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)htons.s 5.2 (Berkeley) 12/17/90 + * $FreeBSD: src/lib/libc/amd64/net/htons.S,v 1.10 2003/04/30 18:07:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/net/htons.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* netorder = htons(hostorder) */ + + .weak CNAME(htons) + .set CNAME(htons),CNAME(__htons) +ENTRY(__htons) + movl %edi,%eax + xchgb %al,%ah + ret diff --git a/lib/libc/amd64/net/ntohl.S b/lib/libc/amd64/net/ntohl.S new file mode 100644 index 0000000000..a806a356fb --- /dev/null +++ b/lib/libc/amd64/net/ntohl.S @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ntohl.s 5.2 (Berkeley) 12/17/90 + * $FreeBSD: src/lib/libc/amd64/net/ntohl.S,v 1.10 2003/04/30 18:07:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/net/ntohl.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* hostorder = ntohl(netorder) */ + + .weak CNAME(ntohl) + .set CNAME(ntohl),CNAME(__ntohl) +ENTRY(__ntohl) + movl %edi,%eax + bswap %eax + ret diff --git a/lib/libc/amd64/net/ntohs.S b/lib/libc/amd64/net/ntohs.S new file mode 100644 index 0000000000..60115ac3fc --- /dev/null +++ b/lib/libc/amd64/net/ntohs.S @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ntohs.s 5.2 (Berkeley) 12/17/90 + * $FreeBSD: src/lib/libc/amd64/net/ntohs.S,v 1.10 2003/04/30 18:07:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/net/ntohs.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +/* hostorder = ntohs(netorder) */ + +#include + + .weak CNAME(ntohs) + .set CNAME(ntohs),CNAME(__ntohs) +ENTRY(__ntohs) + movl %edi,%eax + xchgb %al,%ah + ret diff --git a/lib/libc/amd64/stdlib/gdtoa.mk b/lib/libc/amd64/stdlib/gdtoa.mk new file mode 100644 index 0000000000..4147ac3aac --- /dev/null +++ b/lib/libc/amd64/stdlib/gdtoa.mk @@ -0,0 +1,6 @@ +# $FreeBSD: src/lib/libc/amd64/stdlib/gdtoa.mk,v 1.1 2003/03/12 20:29:59 das Exp $ +# $DragonFly: src/lib/libc/amd64/stdlib/gdtoa.mk,v 1.1 2004/02/02 05:43:14 dillon Exp $ + +# Long double is 80 bits +GDTOASRCS+=strtopx.c +MDSRCS+=machdep_ldisx.c diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc new file mode 100644 index 0000000000..b36e7c98fe --- /dev/null +++ b/lib/libc/amd64/sys/Makefile.inc @@ -0,0 +1,15 @@ +# from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp +# $FreeBSD: src/lib/libc/amd64/sys/Makefile.inc,v 1.29 2003/10/23 06:07:09 peter Exp $ +# $DragonFly: src/lib/libc/amd64/sys/Makefile.inc,v 1.1 2004/02/02 05:43:14 dillon Exp $ + +SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c amd64_set_gsbase.c + +MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ + reboot.S sbrk.S setlogin.S sigreturn.S + +# Don't generate default code for these syscalls: +NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ + pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o + +PSEUDO= _getlogin.o _exit.o diff --git a/lib/libc/amd64/sys/amd64_get_fsbase.c b/lib/libc/amd64/sys/amd64_get_fsbase.c new file mode 100644 index 0000000000..7de04bc4de --- /dev/null +++ b/lib/libc/amd64/sys/amd64_get_fsbase.c @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2003 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/sys/amd64_get_fsbase.c,v 1.2 2004/01/09 16:52:09 nectar Exp $ + * $DragonFly: src/lib/libc/amd64/sys/amd64_get_fsbase.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +int +amd64_get_fsbase(void **addr) +{ + + return (sysarch(AMD64_GET_FSBASE, addr)); +} diff --git a/lib/libc/amd64/sys/amd64_get_gsbase.c b/lib/libc/amd64/sys/amd64_get_gsbase.c new file mode 100644 index 0000000000..defd958cd2 --- /dev/null +++ b/lib/libc/amd64/sys/amd64_get_gsbase.c @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2003 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/sys/amd64_get_gsbase.c,v 1.2 2004/01/09 16:52:09 nectar Exp $ + * $DragonFly: src/lib/libc/amd64/sys/amd64_get_gsbase.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +int +amd64_get_gsbase(void **addr) +{ + + return (sysarch(AMD64_GET_GSBASE, addr)); +} diff --git a/lib/libc/amd64/sys/amd64_set_fsbase.c b/lib/libc/amd64/sys/amd64_set_fsbase.c new file mode 100644 index 0000000000..d803cedbb6 --- /dev/null +++ b/lib/libc/amd64/sys/amd64_set_fsbase.c @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2003 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/sys/amd64_set_fsbase.c,v 1.2 2004/01/09 16:52:09 nectar Exp $ + * $DragonFly: src/lib/libc/amd64/sys/amd64_set_fsbase.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +int +amd64_set_fsbase(void *addr) +{ + + return (sysarch(AMD64_SET_FSBASE, &addr)); +} diff --git a/lib/libc/amd64/sys/amd64_set_gsbase.c b/lib/libc/amd64/sys/amd64_set_gsbase.c new file mode 100644 index 0000000000..7aefaef30a --- /dev/null +++ b/lib/libc/amd64/sys/amd64_set_gsbase.c @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2003 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/sys/amd64_set_gsbase.c,v 1.2 2004/01/09 16:52:09 nectar Exp $ + * $DragonFly: src/lib/libc/amd64/sys/amd64_set_gsbase.c,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +int +amd64_set_gsbase(void *addr) +{ + + return (sysarch(AMD64_SET_GSBASE, &addr)); +} diff --git a/lib/libc/amd64/sys/brk.S b/lib/libc/amd64/sys/brk.S new file mode 100644 index 0000000000..1431e05093 --- /dev/null +++ b/lib/libc/amd64/sys/brk.S @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)brk.s 5.2 (Berkeley) 12/17/90 + * $FreeBSD: src/lib/libc/amd64/sys/brk.S,v 1.12 2003/05/24 17:35:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/brk.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +#include "SYS.h" + + .globl HIDENAME(curbrk) + .globl HIDENAME(minbrk) +ENTRY(_brk) + pushq %rdi + jmp ok + +ENTRY(brk) + pushq %rdi + movq %rdi,%rax +#ifdef PIC + movq PIC_GOT(HIDENAME(minbrk)),%rdx + cmpq %rax,(%rdx) +#else + cmpq %rax,HIDENAME(minbrk)(%rip) +#endif + jbe ok +#ifdef PIC + movq (%rdx),%rdi +#else + movq HIDENAME(minbrk)(%rip),%rdi +#endif +ok: + movq $SYS_break,%rax + KERNCALL + jb err + movq 0(%rsp),%rax +#ifdef PIC + movq PIC_GOT(HIDENAME(curbrk)),%rdx + movq %rax,(%rdx) +#else + movq %rax,HIDENAME(curbrk)(%rip) +#endif + movq $0,%rax + popq %rdi + ret +err: +#ifdef PIC + movq PIC_GOT(HIDENAME(cerror)),%rdx + jmp *%rdx +#else + jmp HIDENAME(cerror) +#endif diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S new file mode 100644 index 0000000000..aac9847cef --- /dev/null +++ b/lib/libc/amd64/sys/cerror.S @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cerror.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/sys/cerror.S,v 1.13 2003/04/30 18:16:33 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/cerror.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include + +#include "SYS.h" + + .globl HIDENAME(cerror) + + /* + * The __error() function is thread aware. For non-threaded + * programs and the initial threaded in threaded programs, + * it returns a pointer to the global errno variable. + */ + .globl CNAME(__error) + .type CNAME(__error),@function +HIDENAME(cerror): + pushq %rax + call PIC_PLT(CNAME(__error)) + popq %rcx + movq %rcx,(%rax) + movq $-1,%rax + movq $-1,%rdx + ret + diff --git a/lib/libc/amd64/sys/exect.S b/lib/libc/amd64/sys/exect.S new file mode 100644 index 0000000000..5c601bc9f8 --- /dev/null +++ b/lib/libc/amd64/sys/exect.S @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)exect.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/sys/exect.S,v 1.11 2003/05/24 17:35:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/exect.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" +#include + +ENTRY(exect) + movq $SYS_execve,%rax + pushfq + popq %r8 + orq $PSL_T,%r8 + pushq %r8 + popfq + KERNCALL +#ifdef PIC + movq PIC_GOT(HIDENAME(cerror)),%rdx + jmp *%rdx +#else + jmp HIDENAME(cerror) +#endif diff --git a/lib/libc/amd64/sys/getcontext.S b/lib/libc/amd64/sys/getcontext.S new file mode 100644 index 0000000000..2824e110f6 --- /dev/null +++ b/lib/libc/amd64/sys/getcontext.S @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2003 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/amd64/sys/getcontext.S,v 1.2 2003/09/04 00:31:45 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/Attic/getcontext.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include + +/* + * This has to be magic to handle the multiple returns. + * Otherwise, the setcontext() syscall will return here and we'll + * pop off the return address and go to the *setcontext* call. + */ + .weak _getcontext + .set _getcontext,__sys_getcontext + .weak getcontext + .set getcontext,__sys_getcontext +ENTRY(__sys_getcontext) + movq (%rsp),%rsi /* save getcontext return address */ + mov $SYS_getcontext,%rax + KERNCALL + jb 1f + addq $8,%rsp /* remove stale (setcontext) return address */ + jmp *%rsi /* restore return address */ +1: +#ifdef PIC + movq PIC_GOT(HIDENAME(cerror)),%rdx + jmp *%rdx +#else + jmp HIDENAME(cerror) +#endif diff --git a/lib/libc/amd64/sys/pipe.S b/lib/libc/amd64/sys/pipe.S new file mode 100644 index 0000000000..13a92a4d22 --- /dev/null +++ b/lib/libc/amd64/sys/pipe.S @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pipe.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/sys/pipe.S,v 1.12 2003/04/30 18:13:48 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/pipe.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" + +SYSCALL(pipe) + movl %eax,(%rdi) /* %rdi is preserved by syscall */ + movl %edx,4(%rdi) + movq $0,%rax + ret diff --git a/lib/libc/amd64/sys/ptrace.S b/lib/libc/amd64/sys/ptrace.S new file mode 100644 index 0000000000..c157928ccc --- /dev/null +++ b/lib/libc/amd64/sys/ptrace.S @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ptrace.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/sys/ptrace.S,v 1.11 2003/05/24 17:35:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/ptrace.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" + +ENTRY(ptrace) + xorl %eax,%eax +#ifdef PIC + movq PIC_GOT(CNAME(errno)),%r8 + movl %eax,(%r8) +#else + movl %eax,CNAME(errno)(%rip) +#endif + mov $SYS_ptrace,%eax + KERNCALL + jb err + ret +err: +#ifdef PIC + movq PIC_GOT(HIDENAME(cerror)),%rdx + jmp *%rdx +#else + jmp HIDENAME(cerror) +#endif diff --git a/lib/libc/amd64/sys/reboot.S b/lib/libc/amd64/sys/reboot.S new file mode 100644 index 0000000000..2533dffbc9 --- /dev/null +++ b/lib/libc/amd64/sys/reboot.S @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)reboot.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/sys/reboot.S,v 1.8 2003/04/30 18:14:44 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/reboot.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" + +SYSCALL(reboot) + iretq diff --git a/lib/libc/amd64/sys/sbrk.S b/lib/libc/amd64/sys/sbrk.S new file mode 100644 index 0000000000..980d08d6ae --- /dev/null +++ b/lib/libc/amd64/sys/sbrk.S @@ -0,0 +1,90 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sbrk.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/sys/sbrk.S,v 1.13 2003/05/24 17:35:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/sbrk.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" + + .globl CNAME(_end) + .globl HIDENAME(minbrk) + .globl HIDENAME(curbrk) + + .data +HIDENAME(minbrk): .quad CNAME(_end) +HIDENAME(curbrk): .quad CNAME(_end) + .text + +ENTRY(sbrk) + pushq %rdi + movq %rdi,%rcx +#ifdef PIC + movq PIC_GOT(HIDENAME(curbrk)),%rdx + movq (%rdx),%rax +#else + movq HIDENAME(curbrk)(%rip),%rax +#endif + testq %rcx,%rcx + jz back + addq %rax,%rdi + mov $SYS_break,%eax + KERNCALL + jb err +#ifdef PIC + movq PIC_GOT(HIDENAME(curbrk)),%rdx + movq (%rdx),%rax +#else + movq HIDENAME(curbrk)(%rip),%rax +#endif + movq 0(%rsp), %rcx +#ifdef PIC + addq %rcx,(%rdx) +#else + addq %rcx,HIDENAME(curbrk)(%rip) +#endif +back: + addq $8, %rsp + ret +err: + addq $8, %rsp +#ifdef PIC + movq PIC_GOT(HIDENAME(cerror)),%rdx + jmp *%rdx +#else + jmp HIDENAME(cerror) +#endif diff --git a/lib/libc/amd64/sys/setlogin.S b/lib/libc/amd64/sys/setlogin.S new file mode 100644 index 0000000000..7353226cf6 --- /dev/null +++ b/lib/libc/amd64/sys/setlogin.S @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)setlogin.s 5.2 (Berkeley) 4/12/91 + * $FreeBSD: src/lib/libc/amd64/sys/setlogin.S,v 1.11 2003/05/24 17:35:23 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/setlogin.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" + +.globl CNAME(_logname_valid) /* in _getlogin() */ + +SYSCALL(setlogin) +#ifdef PIC + movq PIC_GOT(CNAME(_logname_valid)),%rdx + movl $0,(%rdx) +#else + movl $0,CNAME(_logname_valid)(%rip) +#endif + ret /* setlogin(name) */ diff --git a/lib/libc/amd64/sys/sigreturn.S b/lib/libc/amd64/sys/sigreturn.S new file mode 100644 index 0000000000..cdaac1472a --- /dev/null +++ b/lib/libc/amd64/sys/sigreturn.S @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sigreturn.s 5.2 (Berkeley) 12/17/90 + * $FreeBSD: src/lib/libc/amd64/sys/sigreturn.S,v 1.12 2002/03/23 02:10:28 obrien Exp $ + * $DragonFly: src/lib/libc/amd64/sys/sigreturn.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" + +/* + * NOTE: If the profiling ENTRY() code ever changes any registers, they + * must be saved. On FreeBSD, this is not the case. + */ + +RSYSCALL(sigreturn) diff --git a/lib/libc/amd64/sys/vfork.S b/lib/libc/amd64/sys/vfork.S new file mode 100644 index 0000000000..27616b6598 --- /dev/null +++ b/lib/libc/amd64/sys/vfork.S @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)Ovfork.s 5.1 (Berkeley) 4/23/90 + * $FreeBSD: src/lib/libc/amd64/sys/vfork.S,v 1.22 2003/09/04 00:26:40 peter Exp $ + * $DragonFly: src/lib/libc/amd64/sys/vfork.S,v 1.1 2004/02/02 05:43:14 dillon Exp $ + */ + +#include +#include "SYS.h" + + .weak _vfork + .set _vfork,__sys_vfork + .weak vfork + .set vfork,__sys_vfork +ENTRY(__sys_vfork) + popq %rsi /* fetch return address (%rsi preserved) */ + mov $SYS_vfork,%rax + KERNCALL + jb 1f + jmp *%rsi +1: + pushq %rsi +#ifdef PIC + movq PIC_GOT(HIDENAME(cerror)),%rdx + jmp *%rdx +#else + jmp HIDENAME(cerror) +#endif diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index 15012ef1e5..3500626486 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -15,7 +15,7 @@ * Peter Wemm. * * $FreeBSD: src/lib/libc/gen/setproctitle.c,v 1.12.2.2 2000/12/10 20:27:08 jdp Exp $ - * $DragonFly: src/lib/libc/gen/setproctitle.c,v 1.2 2003/06/17 04:26:42 dillon Exp $ + * $DragonFly: src/lib/libc/gen/setproctitle.c,v 1.3 2004/02/02 05:43:14 dillon Exp $ */ #include @@ -111,6 +111,7 @@ setproctitle(const char *fmt, ...) oid[3] = getpid(); sysctl(oid, 4, 0, 0, kbuf, strlen(kbuf) + 1); +#ifdef __i386__ if (ps_strings == NULL) { len = sizeof(ul_ps_strings); if (sysctlbyname("kern.ps_strings", &ul_ps_strings, &len, NULL, @@ -156,4 +157,5 @@ setproctitle(const char *fmt, ...) OLD_PS_STRINGS->old_ps_nargvstr = 1; OLD_PS_STRINGS->old_ps_argvstr = nargvp[0]; } +#endif } diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 441b68e64f..b41698d976 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -1,6 +1,6 @@ # from @(#)Makefile.inc 8.3 (Berkeley) 2/4/95 # $FreeBSD: src/lib/libc/stdlib/Makefile.inc,v 1.19.2.4 2001/10/02 11:15:38 ru Exp $ -# $DragonFly: src/lib/libc/stdlib/Makefile.inc,v 1.3 2004/01/31 13:38:48 joerg Exp $ +# $DragonFly: src/lib/libc/stdlib/Makefile.inc,v 1.4 2004/02/02 05:43:14 dillon Exp $ # machine-independent stdlib sources .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/stdlib ${.CURDIR}/../libc/stdlib @@ -22,7 +22,9 @@ SRCS+= strtod.c .endif # machine-dependent stdlib sources +.if exists(${.CURDIR}/../libc/${MACHINE_ARCH}/stdlib/Makefile.inc) .include "${.CURDIR}/../libc/${MACHINE_ARCH}/stdlib/Makefile.inc" +.endif .if ${LIB} == "c" MAN+= abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \ diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc index d89c34a703..15ea93ea9d 100644 --- a/lib/libc/string/Makefile.inc +++ b/lib/libc/string/Makefile.inc @@ -1,6 +1,6 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD: src/lib/libc/string/Makefile.inc,v 1.19.2.5 2001/12/25 00:36:53 ache Exp $ -# $DragonFly: src/lib/libc/string/Makefile.inc,v 1.2 2003/06/17 04:26:46 dillon Exp $ +# $DragonFly: src/lib/libc/string/Makefile.inc,v 1.3 2004/02/02 05:43:15 dillon Exp $ .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/string ${.CURDIR}/../libc/string @@ -19,7 +19,9 @@ MISRCS+=bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \ wmemmove.c wmemset.c # machine-dependent string sources +.if exists (${.CURDIR}/../libc/${MACHINE_ARCH}/string/Makefile.inc) .include "${.CURDIR}/../libc/${MACHINE_ARCH}/string/Makefile.inc" +.endif .if ${LIB} == "c" MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \ diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c new file mode 100644 index 0000000000..4f708a549e --- /dev/null +++ b/lib/libkvm/kvm_amd64.c @@ -0,0 +1,203 @@ +/*- + * Copyright (c) 1989, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software developed by the Computer Systems + * Engineering group at Lawrence Berkeley Laboratory under DARPA contract + * BG 91-66 and contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93 + * $FreeBSD: src/lib/libkvm/kvm_amd64.c,v 1.16 2003/04/30 21:05:33 peter Exp $ + * $DragonFly: src/lib/libkvm/kvm_amd64.c,v 1.1 2004/02/02 05:43:15 dillon Exp $ + */ + +/* + * AMD64 machine dependent routines for kvm. Hopefully, the forthcoming + * vm code will one day obsolete this module. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "kvm_private.h" + +#ifndef btop +#define btop(x) (amd64_btop(x)) +#define ptob(x) (amd64_ptob(x)) +#endif + +struct vmstate { + pd_entry_t *PTD; +}; + +void +_kvm_freevtop(kvm_t *kd) +{ + if (kd->vmst != 0) { + if (kd->vmst->PTD) { + free(kd->vmst->PTD); + } + free(kd->vmst); + } +} + +int +_kvm_initvtop(kvm_t *kd) +{ + struct vmstate *vm; + struct nlist nlist[2]; + u_long pa; + u_long kernbase; + pd_entry_t *PTD; + + vm = (struct vmstate *)_kvm_malloc(kd, sizeof(*vm)); + if (vm == 0) { + _kvm_err(kd, kd->program, "cannot allocate vm"); + return (-1); + } + kd->vmst = vm; + vm->PTD = 0; + + nlist[0].n_name = "kernbase"; + nlist[1].n_name = 0; + + if (kvm_nlist(kd, nlist) != 0) + kernbase = KERNBASE; /* for old kernels */ + else + kernbase = nlist[0].n_value; + + nlist[0].n_name = "IdlePTD"; + nlist[1].n_name = 0; + + if (kvm_nlist(kd, nlist) != 0) { + _kvm_err(kd, kd->program, "bad namelist"); + return (-1); + } + if (kvm_read(kd, (nlist[0].n_value - kernbase), &pa, sizeof(pa)) != + sizeof(pa)) { + _kvm_err(kd, kd->program, "cannot read IdlePTD"); + return (-1); + } + PTD = _kvm_malloc(kd, PAGE_SIZE); + if (kvm_read(kd, pa, PTD, PAGE_SIZE) != PAGE_SIZE) { + _kvm_err(kd, kd->program, "cannot read PTD"); + return (-1); + } + vm->PTD = PTD; + return (0); +} + +static int +_kvm_vatop(kvm_t *kd, u_long va, u_long *pa) +{ + struct vmstate *vm; + u_long offset; + u_long pte_pa; + pd_entry_t pde; + pt_entry_t pte; + u_long pdeindex; + u_long pteindex; + int i; + + if (ISALIVE(kd)) { + _kvm_err(kd, 0, "vatop called in live kernel!"); + return((off_t)0); + } + + vm = kd->vmst; + offset = va & (PAGE_SIZE - 1); + + /* + * If we are initializing (kernel page table descriptor pointer + * not yet set) then return pa == va to avoid infinite recursion. + */ + if (vm->PTD == 0) { + *pa = va; + return (PAGE_SIZE - offset); + } + + pdeindex = va >> PDRSHIFT; + pde = vm->PTD[pdeindex]; + if (((u_long)pde & PG_V) == 0) + goto invalid; + + if ((u_long)pde & PG_PS) { + /* + * No second-level page table; ptd describes one 4MB page. + * (We assume that the kernel wouldn't set PG_PS without enabling + * it cr0, and that the kernel doesn't support 36-bit physical + * addresses). + */ +#define PAGE4M_MASK (NBPDR - 1) +#define PG_FRAME4M (~PAGE4M_MASK) + *pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK); + return (NBPDR - (va & PAGE4M_MASK)); + } + + pteindex = (va >> PAGE_SHIFT) & (NPTEPG-1); + pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pt_entry_t)); + + /* XXX This has to be a physical address read, kvm_read is virtual */ + if (lseek(kd->pmfd, pte_pa, 0) == -1) { + _kvm_syserr(kd, kd->program, "_kvm_vatop: lseek"); + goto invalid; + } + if (read(kd->pmfd, &pte, sizeof pte) != sizeof pte) { + _kvm_syserr(kd, kd->program, "_kvm_vatop: read"); + goto invalid; + } + if (((u_long)pte & PG_V) == 0) + goto invalid; + + *pa = ((u_long)pte & PG_FRAME) + offset; + return (PAGE_SIZE - offset); + +invalid: + _kvm_err(kd, 0, "invalid address (%x)", va); + return (0); +} + +int +_kvm_kvatop(kvm_t *kd, u_long va, u_long *pa) +{ + return (_kvm_vatop(kd, va, pa)); +} diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile index 3db45d2a45..eadf80e896 100644 --- a/lib/libstand/Makefile +++ b/lib/libstand/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/lib/libstand/Makefile,v 1.14.2.10 2002/07/22 14:21:50 ru Exp $ -# $DragonFly: src/lib/libstand/Makefile,v 1.4 2004/01/25 01:08:41 joerg Exp $ +# $DragonFly: src/lib/libstand/Makefile,v 1.5 2004/02/02 05:43:15 dillon Exp $ # # Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $ # @@ -17,8 +17,8 @@ MAN= libstand.3 # Mostly OK, some of the libc imports are a bit noisy CFLAGS+= -Wall -ffreestanding -.if ${MACHINE_ARCH} == "alpha" -CFLAGS+= -mno-fp-regs +.if ${MACHINE_ARCH} == "amd64" +CFLAGS+= -m32 -mpreferred-stack-boundary=2 .endif .if ${MACHINE_ARCH} == "i386" CFLAGS+= -mpreferred-stack-boundary=2 @@ -45,62 +45,14 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \ .if ${MACHINE_ARCH} == "i386" SRCS+= ucmpdi2.c .endif -.if ${MACHINE_ARCH} == "alpha" -.PATH: ${.CURDIR}/../libc/alpha/string -SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ - memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \ - strcmp.c strcpy.c strcspn.c strlen.c \ - strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ - strspn.c strstr.c strtok.c swab.c - -.PATH: ${.CURDIR}/../libc/alpha/net -SRCS+= htons.S ntohs.S htonl.S ntohl.S - -SRCS+= __divqu.S __divq.S __divlu.S __divl.S -SRCS+= __remqu.S __remq.S __remlu.S __reml.S - -CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S -CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S - - -__divqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \ - ${.ALLSRC} > ${.TARGET} - -__divq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \ - ${.ALLSRC} > ${.TARGET} - -__divlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \ - ${.ALLSRC} > ${.TARGET} - -__divl.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \ - ${.ALLSRC} > ${.TARGET} - -__remqu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \ - ${.ALLSRC} > ${.TARGET} - -__remq.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \ - ${.ALLSRC} > ${.TARGET} - -__remlu.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \ - ${.ALLSRC} > ${.TARGET} - -__reml.S: ${.CURDIR}/../libc/alpha/gen/divrem.m4 - m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \ - ${.ALLSRC} > ${.TARGET} -.endif +.if ${MACHINE_ARCH} == "i386" # _setjmp/_longjmp .PATH: ${.CURDIR}/${MACHINE_ARCH} SRCS+= _setjmp.S # really only required for i386 CFLAGS+=-I${.CURDIR}/../libc/${MACHINE_ARCH} +.endif # decompression functionality from libbz2 .PATH: ${.CURDIR}/../../contrib/bzip2 diff --git a/secure/lib/libcrypto/opensslconf-alpha.h b/secure/lib/libcrypto/opensslconf-amd64.h similarity index 95% rename from secure/lib/libcrypto/opensslconf-alpha.h rename to secure/lib/libcrypto/opensslconf-amd64.h index 094fa373e3..22d01c68d6 100644 --- a/secure/lib/libcrypto/opensslconf-alpha.h +++ b/secure/lib/libcrypto/opensslconf-amd64.h @@ -1,5 +1,7 @@ -/* $FreeBSD: src/secure/lib/libcrypto/opensslconf-alpha.h,v 1.1.2.4 2003/02/14 22:38:14 nectar Exp $ */ -/* $DragonFly: src/secure/lib/libcrypto/Attic/opensslconf-alpha.h,v 1.2 2003/06/17 04:27:48 dillon Exp $ */ +/* + * $FreeBSD: src/secure/lib/libcrypto/opensslconf-alpha.h,v 1.1.2.4 2003/02/14 22:38:14 nectar Exp $ + * $DragonFly: src/secure/lib/libcrypto/opensslconf-amd64.h,v 1.1 2004/02/02 05:43:16 dillon Exp $ + */ /* opensslconf.h */ /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ diff --git a/sys/sys/mount.h b/sys/sys/mount.h index d4eab3a733..db1ee71677 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -32,7 +32,7 @@ * * @(#)mount.h 8.21 (Berkeley) 5/20/95 * $FreeBSD: src/sys/sys/mount.h,v 1.89.2.7 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/sys/mount.h,v 1.7 2003/08/27 02:03:22 dillon Exp $ + * $DragonFly: src/sys/sys/mount.h,v 1.8 2004/02/02 05:43:15 dillon Exp $ */ #ifndef _SYS_MOUNT_H_ @@ -72,12 +72,7 @@ struct fid { */ #define MFSNAMELEN 16 /* length of fs type name, including null */ -#ifdef __i386__ #define MNAMELEN 80 /* length of buffer for returned name */ -#endif -#ifdef __alpha__ -#define MNAMELEN 72 /* length of buffer for returned name */ -#endif struct statfs { long f_spare2; /* placeholder */ diff --git a/usr.bin/objformat/Makefile b/usr.bin/objformat/Makefile index 923446ee01..21c3b5b3eb 100644 --- a/usr.bin/objformat/Makefile +++ b/usr.bin/objformat/Makefile @@ -1,9 +1,12 @@ # $FreeBSD: src/usr.bin/objformat/Makefile,v 1.15 1999/12/24 15:18:19 green Exp $ -# $DragonFly: src/usr.bin/objformat/Makefile,v 1.4 2004/01/23 22:30:25 joerg Exp $ +# $DragonFly: src/usr.bin/objformat/Makefile,v 1.5 2004/02/02 05:43:16 dillon Exp $ PROG= objformat CFLAGS+= -Wall NOSHARED?= YES +.if defined(TARGET_ARCH) +CFLAGS+= -DTARGET_ARCH="${TARGET_ARCH}" +.endif # These will exec /usr/libexec/${BINUTILSVER}// # diff --git a/usr.bin/objformat/objformat.c b/usr.bin/objformat/objformat.c index daaa5bd623..d882d88372 100644 --- a/usr.bin/objformat/objformat.c +++ b/usr.bin/objformat/objformat.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/objformat/objformat.c,v 1.6 1998/10/24 02:01:30 jdp Exp $ - * $DragonFly: src/usr.bin/objformat/objformat.c,v 1.10 2004/01/31 09:14:24 dillon Exp $ + * $DragonFly: src/usr.bin/objformat/objformat.c,v 1.11 2004/02/02 05:43:16 dillon Exp $ */ #include @@ -35,18 +35,23 @@ #include /* - * System default compiler is still gcc2 for the IA32 architecture, - * unless overriden. For other architectures we have to use gcc3. + * The system default compiler for IA32 is gcc2. When generating + * cross-building tools (TARGET_ARCH is set), or if the architecture + * is not IA32, the system default compiler is gcc3. */ #ifndef CCVER_DEFAULT -#ifdef __i386__ +#if defined(__i386__) && !defined(TARGET_ARCH) #define CCVER_DEFAULT "gcc2" #else #define CCVER_DEFAULT "gcc3" #endif #endif #ifndef BINUTILSVER_DEFAULT +#if defined(__i386__) && !defined(TARGET_ARCH) #define BINUTILSVER_DEFAULT "binutils212" +#else +#define BINUTILSVER_DEFAULT "binutils214" +#endif #endif #define OBJFORMAT 0 @@ -121,17 +126,18 @@ main(int argc, char **argv) if ((ccver = getenv("CCVER")) == NULL) ccver = CCVER_DEFAULT; if ((buver = getenv("BINUTILSVER")) == NULL) { - buver = BINUTILSVER_DEFAULT; - /* - * XXX auto-select buver based on ccver if buver is - * not otherwise specified - */ + if (strcmp(ccver, "gcc2") == 0) + buver = "binutils212"; + else if (strcmp(ccver, "gcc3") == 0) + buver = "binutils214"; + else + buver = "binutils214"; /* fall through */ } if (cmds) { switch (cmds->type) { case COMPILER: - base_path = "/usr/bin"; + base_path = "/usr/libexec"; use_objformat = 0; env_value = ccver; break; diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 2bc97550ef..0563113fa8 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -28,7 +28,7 @@ * * @(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI * $FreeBSD: src/usr.bin/rpcgen/rpc_main.c,v 1.11 1999/08/28 01:05:16 peter Exp $ - * $DragonFly: src/usr.bin/rpcgen/rpc_main.c,v 1.7 2004/01/22 03:22:53 rob Exp $ + * $DragonFly: src/usr.bin/rpcgen/rpc_main.c,v 1.8 2004/02/02 05:43:16 dillon Exp $ */ @@ -79,19 +79,10 @@ static void s_output( int, char **, char *, char *, int, char *, int, int ); #define EXTEND 1 /* alias for TRUE */ #define DONT_EXTEND 0 /* alias for FALSE */ -#define SVR4_CPP "/usr/ccs/lib/cpp" -#if defined(__DragonFly__) -#define SUNOS_CPP "/usr/bin/cpp" -#elif defined(__NetBSD__) -#define SUNOS_CPP "/usr/bin/cpp" -#else -#define SUNOS_CPP "/usr/lib/cpp" -#endif - static int cppDefined = 0; /* explicit path for C preprocessor */ static char *svcclosetime = "120"; -static char *CPP = SVR4_CPP; +static char *CPP = NULL; static char CPPFLAGS[] = "-C"; static char pathbuf[MAXPATHLEN + 1]; static char *allv[] = { @@ -323,22 +314,12 @@ static void clear_args() } /* make sure that a CPP exists */ -static void find_cpp() +static int find_cpp() { - struct stat buf; - - if (stat(CPP, &buf) < 0) { /* SVR4 or explicit cpp does not exist */ - if (cppDefined) { - warnx("cannot find C preprocessor: %s", CPP); - crash(); - } else { /* try the other one */ - CPP = SUNOS_CPP; - if (stat(CPP, &buf) < 0) { /* can't find any cpp */ - warnx("cannot find any C preprocessor (cpp)"); - crash(); - } - } - } + if (CPP) + return(0); + CPP = "cpp"; + return(1); } /* @@ -350,12 +331,13 @@ open_input(infile, define) char *define; { int pd[2]; + int usevp; infilename = (infile == NULL) ? "" : infile; (void) pipe(pd); switch (childpid = fork()) { case 0: - find_cpp(); + usevp = find_cpp(); putarg(0, CPP); putarg(1, CPPFLAGS); addarg(define); @@ -365,7 +347,10 @@ open_input(infile, define) (void) close(1); (void) dup2(pd[1], 1); (void) close(pd[0]); - execv(arglist[0], arglist); + if (usevp) + execvp(arglist[0], arglist); + else + execv(arglist[0], arglist); warn("execv"); exit(1); case -1: -- 2.41.0