Remove alpha left-overs.

This commit is contained in:
ru 2006-08-22 08:03:01 +00:00
parent 78738a2fe9
commit 4d582ffe09
107 changed files with 14 additions and 6882 deletions

View File

@ -926,9 +926,6 @@ _btxld= usr.sbin/btxld
.if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
_crunchide= usr.sbin/crunch/crunchide
.endif
.if ${TARGET_ARCH} == "alpha"
_elf2exe= usr.sbin/elf2exe
.endif
.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
_kgzip= usr.sbin/kgzip
.endif
@ -941,7 +938,6 @@ cross-tools:
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
${_btxld} \
${_crunchide} \
${_elf2exe} \
${_kgzip}
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool}; \

View File

@ -334,7 +334,7 @@ OLD_FILES+=usr/share/man/man1/sasc.1.gz
OLD_FILES+=usr/share/man/man1/sgsc.1.gz
OLD_FILES+=usr/share/man/man4/i386/stl.4.gz
OLD_FILES+=usr/share/man/man8/raidctl.8.gz
.if ${TARGET_ARCH} != "alpha" && ${TARGET_ARCH} != "sparc64"
.if ${TARGET_ARCH} != "sparc64"
# 20040130: libkse renamed to libpthread
OLD_FILES+=usr/lib/libkse.a
OLD_FILES+=usr/lib/libkse.so
@ -3066,7 +3066,7 @@ OLD_LIBS+=usr/lib/libpcap.so.2
OLD_LIBS+=usr/lib/libisc.so.1
# 200408XX
OLD_LIBS+=usr/lib/snmp_netgraph.so.1
.if ${TARGET_ARCH} != "alpha" && ${TARGET_ARCH} != "sparc64"
.if ${TARGET_ARCH} != "sparc64"
# 20040130: libkse renamed to libpthread
OLD_LIBS+=usr/lib/libkse.so.1
.endif

View File

@ -593,9 +593,6 @@ main(int argc, char **argv)
if (open("/dev/io", O_RDONLY) < 0)
errx(1, "can't get I/O privilege");
#endif
#ifdef __alpha__
ioperm(0x203, 0x400 - 0x203, 1);
#endif
printf("Checking for Plug-n-Play devices...\n");

View File

@ -30,7 +30,7 @@ SUBDIR= ${_csu} libbsm libcom_err libcrypt libkvm msun libmd libncurses \
libbegemot ${_libbluetooth} libbsnmp libbz2 libc ${_libc_r} \
libcalendar libcam libcompat libdevinfo libdevstat libdisk \
libedit libexpat libfetch libform libftpio libgeom ${_libgpib} \
libgssapi ${_libio} libipsec \
libgssapi libipsec \
${_libipx} libkiconv libmagic libmemstat libmenu ${_libmilter} ${_libmp} \
${_libncp} ${_libngatm} libopie libpam libpanel libpcap \
libpmc ${_libpthread} librt ${_libsdp} ${_libsm} ${_libsmb} \
@ -81,10 +81,6 @@ _libsmb= libsmb
_libc_r=
.endif
.if ${MACHINE_ARCH} == "alpha"
_libio= libio
.endif
.if ${MK_SENDMAIL} != "no"
_libmilter= libmilter
_libsm= libsm

View File

@ -1,21 +0,0 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../common
SRCS= crt1.c crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= gcrt1.o
WARNS?= 6
CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../../libc/include
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 <bsd.lib.mk>

View File

@ -1,114 +0,0 @@
/* LINTLIBRARY */
/*-
* Copyright 2001 David E. O'Brien.
* All rights reserved.
* 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
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the 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
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef lint
#ifndef __GNUC__
#error "GCC is needed to compile this file"
#endif
#endif /* lint */
#include <stdlib.h>
#include "libc_private.h"
#include "crtbrand.c"
struct Struct_Obj_Entry;
struct ps_strings;
extern int _DYNAMIC;
#pragma weak _DYNAMIC
extern void _fini(void);
extern void _init(void);
extern int main(int, char **, char **);
extern void _start(char **, void (*)(void), struct Struct_Obj_Entry *,
struct ps_strings *);
#ifdef GCRT
extern void _mcleanup(void);
extern void monstartup(void *, void *);
extern int eprol;
extern int etext;
#endif
char **environ;
const char *__progname = "";
/* The entry function. */
/* ARGSUSED */
void
_start(char **ap, void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused,
struct ps_strings *ps_strings __unused)
{
int argc;
char **argv;
char **env;
const char *s;
argc = *(long *)(void *)ap;
argv = ap + 1;
env = ap + 2 + argc;
environ = env;
if (argc > 0 && argv[0] != NULL) {
__progname = argv[0];
for (s = __progname; *s != '\0'; s++)
if (*s == '/')
__progname = s + 1;
}
if (&_DYNAMIC != NULL)
atexit(cleanup);
#ifdef GCRT
atexit(_mcleanup);
#endif
atexit(_fini);
#ifdef GCRT
monstartup(&eprol, &etext);
#endif
_init();
exit( main(argc, argv, env) );
}
#ifdef GCRT
__asm__(".text");
__asm__("eprol:");
__asm__(".previous");
#endif
__asm__(".ident\t\"$FreeBSD$\"");

View File

@ -1,53 +0,0 @@
/*-
* Copyright 2000 David O'Brien, John D. Polstra.
* 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.
*/
.section .init,"ax",@progbits
.align 5
.globl _init
_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
.globl _fini
_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$\0"

View File

@ -1,45 +0,0 @@
/*-
* Copyright 2000 David O'Brien, John D. Polstra.
* 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.
*/
.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
.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
.section .rodata
.ascii "$FreeBSD$\0"

View File

@ -41,8 +41,7 @@ NOASM=
.include "${.CURDIR}/net/Makefile.inc"
.include "${.CURDIR}/nls/Makefile.inc"
.include "${.CURDIR}/posix1e/Makefile.inc"
.if ${MACHINE_ARCH} != "alpha" && \
${MACHINE_ARCH} != "amd64" && \
.if ${MACHINE_ARCH} != "amd64" && \
${MACHINE_ARCH} != "ia64" && \
${MACHINE_ARCH} != "sparc64"
.include "${.CURDIR}/quad/Makefile.inc"

View File

@ -1,8 +0,0 @@
# $FreeBSD$
#
# Machine dependent definitions for the alpha architecture.
#
# On Alpha, long double is just double precision.
MDSRCS+=machdep_ldisd.c
SYM_MAPS+=${.CURDIR}/alpha/Symbol.map

View File

@ -1,74 +0,0 @@
/* From: NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $FreeBSD$
*/
#include <machine/asm.h>
#include <sys/syscall.h>
#define CALLSYS_ERROR(name) \
CALLSYS_NOERROR(name); \
br gp, LLABEL(name,0); \
LLABEL(name,0): \
LDGP(gp); \
beq a3, LLABEL(name,1); \
jmp zero, .cerror; \
LLABEL(name,1):
#define SYSCALL(name) \
LEAF(__CONCAT(__sys_,name),0); /* XXX # of args? */ \
WEAK_ALIAS(name, __CONCAT(__sys_,name)); \
WEAK_ALIAS(__CONCAT(_,name), __CONCAT(__sys_,name)); \
CALLSYS_ERROR(name)
#define SYSCALL_NOERROR(name) \
LEAF(__CONCAT(__sys_,name),0); /* XXX # of args? */ \
WEAK_ALIAS(name, __CONCAT(__sys_,name)); \
WEAK_ALIAS(__CONCAT(_,name), __CONCAT(__sys_,name)); \
CALLSYS_NOERROR(name)
#define RSYSCALL(name) \
SYSCALL(name); \
RET; \
END(__CONCAT(__sys_,name))
#define RSYSCALL_NOERROR(name) \
SYSCALL_NOERROR(name); \
RET; \
END(__CONCAT(__sys_,name))
#define PSEUDO(name) \
LEAF(__CONCAT(__sys_,name),0); /* XXX # of args? */ \
WEAK_ALIAS(__CONCAT(_,name), __CONCAT(__sys_, name)); \
CALLSYS_ERROR(name); \
RET; \
END(__CONCAT(__sys_,name))

View File

@ -1,77 +0,0 @@
# $FreeBSD$
#
# This only needs to contain symbols that are not listed in
# symbol maps from other parts of libc (i.e., not found in
# stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
#
FBSD_1.0 {
# PSEUDO syscalls
_exit;
__flt_rounds;
fpgetmask;
fpgetround;
fpgetsticky;
fpsetmask;
fpsetround;
__infinity;
__nan;
makecontext;
modf;
_setjmp;
_longjmp;
fabs;
rfork_thread;
setjmp;
longjmp;
sigsetjmp;
siglongjmp;
__htonl;
htonl;
__htons;
htons;
__ntohl;
ntohl;
__ntohs;
ntohs;
vfork;
exect;
fork;
sbrk;
};
#
# FreeBSD private ABI
#
FBSDprivate {
# PSEUDO syscalls
__sys_getlogin;
_getlogin;
__sys_exit;
_set_tp;
__makecontext;
__signalcontext;
signalcontext;
___longjmp;
__longjmp;
__siglongjmp;
__divqu;
__divq;
__divlu;
__divl;
__remqu;
__remq;
__remlu;
__reml;
__sys_vork;
_vfork;
__sys_fork;
_fork;
_end;
curbrk;
minbrk;
brk;
.cerror;
};

View File

@ -1,49 +0,0 @@
/*-
* Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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$
*/
union IEEEl2bits {
long double e;
struct {
unsigned int manl :32;
unsigned int manh :20;
unsigned int exp :11;
unsigned int sign :1;
} bits;
};
#define mask_nbit_l(u) ((void)0)
#define LDBL_IMPLICIT_NBIT
#define LDBL_NBIT 0
#define LDBL_MANH_SIZE 20
#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)

View File

@ -1,20 +0,0 @@
/*
* MD header for contrib/netlib/gdtoa
*
* $FreeBSD$
*/
/*
* 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
#define Sudden_Underflow

View File

@ -1,47 +0,0 @@
# $FreeBSD$
SRCS+= _setjmp.S _set_tp.c fabs.S infinity.c ldexp.c modf.c setjmp.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c
SRCS+= sigsetjmp.S
SRCS+= __divqu.S __divq.S __divlu.S __divl.S
SRCS+= __remqu.S __remq.S __remlu.S __reml.S
SRCS+= rfork_thread.S
SRCS+= _ctx_start.S makecontext.c signalcontext.c
CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
__divqu.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__divqu -DOP=div -DS=false -DWORDSIZE=64 \
${.ALLSRC} > ${.TARGET}
__divq.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__divq -DOP=div -DS=true -DWORDSIZE=64 \
${.ALLSRC} > ${.TARGET}
__divlu.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__divlu -DOP=div -DS=false -DWORDSIZE=32 \
${.ALLSRC} > ${.TARGET}
__divl.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__divl -DOP=div -DS=true -DWORDSIZE=32 \
${.ALLSRC} > ${.TARGET}
__remqu.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__remqu -DOP=rem -DS=false -DWORDSIZE=64 \
${.ALLSRC} > ${.TARGET}
__remq.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__remq -DOP=rem -DS=true -DWORDSIZE=64 \
${.ALLSRC} > ${.TARGET}
__remlu.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__remlu -DOP=rem -DS=false -DWORDSIZE=32 \
${.ALLSRC} > ${.TARGET}
__reml.S: ${.CURDIR}/alpha/gen/divrem.m4
m4 -DNAME=__reml -DOP=rem -DS=true -DWORDSIZE=32 \
${.ALLSRC} > ${.TARGET}

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of the author 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 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.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
/*
* A0-A5 are the first 6 arguments to the start routine with the
* remaining arguments (if any) placed on the stack. S0 is the
* address of the user-supplied start routine, and S1 is the pointer
* to the ucontext.
*/
.set noreorder
LEAF(_ctx_start,0)
mov s0, t12
jsr ra, (s0) /* call start routine; args already set */
LDGP(ra)
mov s1, a0 /* load A0 (arg 1) with pointer to ucontext */
CALL(_ctx_done) /* call context completion routine */
CALL(abort) /* should never return from above call */
RET
END(_ctx_start)

View File

@ -1,40 +0,0 @@
/*-
* Copyright (c) 2004 Doug Rabson
* 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$
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/alpha_cpu.h>
void
_set_tp(void *tp)
{
alpha_pal_wrunique((uintptr_t) tp);
}

View File

@ -1,127 +0,0 @@
/* $NetBSD: _setjmp.S,v 1.2 1996/10/17 03:08:03 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v)" from
* the last call to
* _setjmp(a)
* by restoring registers from the stack,
* The previous signal state is NOT restored.
*/
.set noreorder
LEAF(_setjmp, 1)
LDGP(pv)
stq ra, (2 * 8)(a0) /* sc_pc = return address */
stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
stq s1, ((10 + 4) * 8)(a0)
stq s2, ((11 + 4) * 8)(a0)
stq s3, ((12 + 4) * 8)(a0)
stq s4, ((13 + 4) * 8)(a0)
stq s5, ((14 + 4) * 8)(a0)
stq s6, ((15 + 4) * 8)(a0)
stq ra, ((26 + 4) * 8)(a0)
stq t12,((27 + 4) * 8)(a0)
stq sp, ((30 + 4) * 8)(a0)
ldiq t0, 0xacedbadd /* sigcontext magic number */
stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */
/* Too bad we can't check if we actually used FP */
ldiq t0, 1
stq t0, (36 * 8)(a0) /* say we've used FP. */
stt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */
stt fs1, ((3 + 37) * 8)(a0)
stt fs2, ((4 + 37) * 8)(a0)
stt fs3, ((5 + 37) * 8)(a0)
stt fs4, ((6 + 37) * 8)(a0)
stt fs5, ((7 + 37) * 8)(a0)
stt fs6, ((8 + 37) * 8)(a0)
stt fs7, ((9 + 37) * 8)(a0)
mf_fpcr ft0 /* get FP control reg */
stt ft0, (69 * 8)(a0) /* and store it in sc_fpcr */
stq zero, (70 * 8)(a0) /* FP software control XXX */
stq zero, (71 * 8)(a0) /* sc_reserved[0] */
stq zero, (72 * 8)(a0) /* sc_reserved[1] */
stq zero, (73 * 8)(a0) /* sc_xxx[0] */
stq zero, (74 * 8)(a0) /* sc_xxx[1] */
stq zero, (75 * 8)(a0) /* sc_xxx[2] */
stq zero, (76 * 8)(a0) /* sc_xxx[3] */
stq zero, (77 * 8)(a0) /* sc_xxx[4] */
stq zero, (78 * 8)(a0) /* sc_xxx[5] */
stq zero, (79 * 8)(a0) /* sc_xxx[6] */
stq zero, (80 * 8)(a0) /* sc_xxx[7] */
mov zero, v0 /* return zero */
RET
END(_setjmp)
XLEAF(_longjmp, 2)
LEAF(___longjmp, 2)
LDGP(pv)
ldq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */
ldiq t1, 0xacedbadd
cmpeq t0, t1, t0
beq t0, botch /* If the magic was bad, punt */
ldq ra, (2 * 8)(a0) /* sc_pc = return address */
ldq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
ldq s1, ((10 + 4) * 8)(a0)
ldq s2, ((11 + 4) * 8)(a0)
ldq s3, ((12 + 4) * 8)(a0)
ldq s4, ((13 + 4) * 8)(a0)
ldq s5, ((14 + 4) * 8)(a0)
ldq s6, ((15 + 4) * 8)(a0)
/* ldq ra, ((26 + 4) * 8)(a0) set above */
ldq t12,((27 + 4) * 8)(a0)
ldq sp, ((30 + 4) * 8)(a0)
ldt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */
ldt fs1, ((3 + 37) * 8)(a0)
ldt fs2, ((4 + 37) * 8)(a0)
ldt fs3, ((5 + 37) * 8)(a0)
ldt fs4, ((6 + 37) * 8)(a0)
ldt fs5, ((7 + 37) * 8)(a0)
ldt fs6, ((8 + 37) * 8)(a0)
ldt fs7, ((9 + 37) * 8)(a0)
ldt ft0, (69 * 8)(a0) /* get sc_fpcr */
mt_fpcr ft0 /* and restore it. */
mov a1, v0 /* return second arg */
RET
botch:
CALL(longjmperror)
CALL(abort)
RET /* "can't" get here... */
END(___longjmp)

View File

@ -1,198 +0,0 @@
/* $NetBSD: divrem.m4,v 1.7 1996/10/17 03:08:04 cgd Exp $ */
/* $FreeBSD$ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/*
* Division and remainder.
*
* The use of m4 is modeled after the sparc code, but the algorithm is
* simple binary long division.
*
* Note that the loops could probably benefit from unrolling.
*/
/*
* M4 Parameters
* NAME name of function to generate
* OP OP=div: t10 / t11 -> t12; OP=rem: t10 % t11 -> t12
* S S=true: signed; S=false: unsigned
* WORDSIZE total number of bits
*/
define(A, `t10')
define(B, `t11')
define(RESULT, `t12')
define(BIT, `t0')
define(I, `t1')
define(CC, `t2')
define(T_0, `t3')
ifelse(S, `true', `define(NEG, `t4')')
#include <machine/asm.h>
NESTED(NAME, 0, 0, t9, 0, 0) /* Get the right ra */
lda sp, -64(sp)
stq BIT, 0(sp)
stq I, 8(sp)
stq CC, 16(sp)
stq T_0, 24(sp)
ifelse(S, `true',
` stq NEG, 32(sp)')
stq A, 40(sp)
stq B, 48(sp)
mov zero, RESULT /* Initialize result to zero */
ifelse(S, `true',
`
/* Compute sign of result. If either is negative, this is easy. */
or A, B, NEG /* not the sign, but... */
srl NEG, WORDSIZE - 1, NEG /* rather, or of high bits */
blbc NEG, Ldoit /* neither negative? do it! */
ifelse(OP, `div',
` xor A, B, NEG /* THIS is the sign! */
', ` mov A, NEG /* sign follows A. */
')
srl NEG, WORDSIZE - 1, NEG /* make negation the low bit. */
srl A, WORDSIZE - 1, I /* is A negative? */
blbc I, LnegB /* no. */
/* A is negative; flip it. */
ifelse(WORDSIZE, `32', `
/* top 32 bits may be random junk */
zap A, 0xf0, A
')
subq zero, A, A
srl B, WORDSIZE - 1, I /* is B negative? */
blbc I, Ldoit /* no. */
LnegB:
/* B is definitely negative, no matter how we got here. */
ifelse(WORDSIZE, `32', `
/* top 32 bits may be random junk */
zap B, 0xf0, B
')
subq zero, B, B
Ldoit:
')
ifelse(WORDSIZE, `32', `
/*
* Clear the top 32 bits of each operand, as they may
* sign extension (if negated above), or random junk.
*/
zap A, 0xf0, A
zap B, 0xf0, B
')
/* kill the special cases. */
beq B, Ldotrap /* division by zero! */
cmpult A, B, CC /* A < B? */
/* RESULT is already zero, from above. A is untouched. */
bne CC, Lret_result
cmpeq A, B, CC /* A == B? */
cmovne CC, 1, RESULT
cmovne CC, zero, A
bne CC, Lret_result
/*
* Find out how many bits of zeros are at the beginning of the divisor.
*/
LBbits:
ldiq T_0, 1 /* I = 0; BIT = 1<<WORDSIZE-1 */
mov zero, I
sll T_0, WORDSIZE-1, BIT
LBloop:
and B, BIT, CC /* if bit in B is set, done. */
bne CC, LAbits
addq I, 1, I /* increment I, shift bit */
srl BIT, 1, BIT
cmplt I, WORDSIZE-1, CC /* if I leaves one bit, done. */
bne CC, LBloop
LAbits:
beq I, Ldodiv /* If I = 0, divide now. */
ldiq T_0, 1 /* BIT = 1<<WORDSIZE-1 */
sll T_0, WORDSIZE-1, BIT
LAloop:
and A, BIT, CC /* if bit in A is set, done. */
bne CC, Ldodiv
subq I, 1, I /* decrement I, shift bit */
srl BIT, 1, BIT
bne I, LAloop /* If I != 0, loop again */
Ldodiv:
sll B, I, B /* B <<= i */
ldiq T_0, 1
sll T_0, I, BIT
Ldivloop:
cmpult A, B, CC
or RESULT, BIT, T_0
cmoveq CC, T_0, RESULT
subq A, B, T_0
cmoveq CC, T_0, A
srl BIT, 1, BIT
srl B, 1, B
beq A, Lret_result
bne BIT, Ldivloop
Lret_result:
ifelse(OP, `div',
`', ` mov A, RESULT
')
ifelse(S, `true',
`
/* Check to see if we should negate it. */
subq zero, RESULT, T_0
cmovlbs NEG, T_0, RESULT
')
ldq BIT, 0(sp)
ldq I, 8(sp)
ldq CC, 16(sp)
ldq T_0, 24(sp)
ifelse(S, `true',
` ldq NEG, 32(sp)')
ldq A, 40(sp)
ldq B, 48(sp)
lda sp, 64(sp)
ret zero, (t9), 1
Ldotrap:
ldiq a0, -2 /* This is the signal to SIGFPE! */
call_pal PAL_gentrap
ifelse(OP, `div',
`', ` mov zero, A /* so that zero will be returned */
')
br zero, Lret_result
END(NAME)

View File

@ -1,36 +0,0 @@
/* $NetBSD: fabs.S,v 1.2 1996/10/17 03:08:05 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
LEAF(fabs, 1)
cpys fzero, fa0, fv0
RET
END(fabs)

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $NetBSD: flt_rounds.c,v 1.2 1997/07/18 00:30:30 thorpej Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/float.h>
static const int map[] = {
0, /* round to zero */
3, /* round to negative infinity */
1, /* round to nearest */
2 /* round to positive infinity */
};
int
__flt_rounds()
{
union {
double fpcrval;
u_int64_t intval;
} u;
__asm__("trapb");
__asm__("mf_fpcr %0" : "=f" (u.fpcrval));
__asm__("trapb");
return map[(u.intval >> 58) & 0x3];
}

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $NetBSD: fpgetmask.c,v 1.1 1995/04/29 05:10:55 cgd Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <ieeefp.h>
#include <machine/sysarch.h>
struct params {
u_int64_t mask;
};
fp_except_t
fpgetmask()
{
struct params p;
sysarch(ALPHA_GET_FPMASK, &p);
return((fp_except_t) p.mask);
}

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $NetBSD: fpgetround.c,v 1.1 1995/04/29 05:09:55 cgd Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <ieeefp.h>
#include <machine/fpu.h>
fp_rnd_t
fpgetround()
{
union {
double fpcrval;
u_int64_t intval;
} u;
GET_FPCR(u.fpcrval);
return ((u.intval & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT);
}

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $NetBSD: fpgetsticky.c,v 1.1 1995/04/29 05:10:59 cgd Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <ieeefp.h>
#include <machine/fpu.h>
fp_except_t
fpgetsticky()
{
union {
double fpcrval;
u_int64_t intval;
} u;
GET_FPCR(u.fpcrval);
return (((u.intval >> IEEE_STATUS_TO_FPCR_SHIFT) & IEEE_STATUS_MASK)
>> IEEE_STATUS_TO_EXCSUM_SHIFT);
}

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $NetBSD: fpsetmask.c,v 1.1 1995/04/29 05:11:01 cgd Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <ieeefp.h>
#include <machine/sysarch.h>
struct params {
u_int64_t mask;
};
fp_except_t
fpsetmask(mask)
fp_except_t mask;
{
struct params p;
p.mask = (u_int64_t) mask;
sysarch(ALPHA_SET_FPMASK, &p);
return ((fp_except_t) p.mask);
}

View File

@ -1,61 +0,0 @@
/*
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $NetBSD: fpsetround.c,v 1.1 1995/04/29 05:09:57 cgd Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <ieeefp.h>
#include <machine/fpu.h>
fp_rnd_t
fpsetround(rnd_dir)
fp_rnd_t rnd_dir;
{
union {
double fpcrval;
u_int64_t intval;
} u;
u_int64_t old, new;
GET_FPCR(u.fpcrval);
old = u.intval;
new = old & (~FPCR_DYN_MASK);
new |= ((long) rnd_dir << FPCR_DYN_SHIFT) & FPCR_DYN_MASK;
u.intval = new;
SET_FPCR(u.fpcrval);
return ((old & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT);
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $NetBSD: infinity.c,v 1.1 1995/02/10 17:50:23 cgd Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <math.h>
/* bytes for +Infinity on an Alpha (IEEE double format) */
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 } };

View File

@ -1,172 +0,0 @@
/*
* Copyright (c) 2001 Daniel M. Eischen <deischen@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of the author 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 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/signal.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ucontext.h>
#include <unistd.h>
/* Prototypes */
extern void _ctx_start(int argc, ...);
__weak_reference(__makecontext, makecontext);
void
_ctx_done (ucontext_t *ucp)
{
if (ucp->uc_link == NULL)
exit(0);
else {
/*
* Since this context has finished, don't allow it
* to be restarted without being reinitialized (via
* setcontext or swapcontext).
*/
ucp->uc_mcontext.mc_format = 0;
/* Set context to next one in link */
/* XXX - what to do for error, abort? */
setcontext((const ucontext_t *)ucp->uc_link);
abort(); /* should never get here */
}
}
void
__makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...)
{
va_list ap;
char *stack_top;
intptr_t *argp;
int i;
if (ucp == NULL)
return;
else if ((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_format = 0;
}
/* XXX - Do we want to sanity check argc? */
else if ((argc < 0) || (argc > NCARGS)) {
ucp->uc_mcontext.mc_format = 0;
}
/*
* Make sure the context is valid. For now, we only allow
* trapframe format contexts to be used for makecontext.
*/
else if (ucp->uc_mcontext.mc_format == _MC_REV0_TRAPFRAME) {
/*
* Alpha passes the first 6 parameters in registers and
* remaining parameters on the stack. Set up the context
* accordingly, with the user start routine in register
* S0, and the context start wrapper (_ctx_start) in the
* program counter and return address. The context must
* be in trapframe format.
*
* Note: The context start wrapper needs to retrieve the
* ucontext pointer. Place this in register S1
* which must be saved by the callee.
*/
stack_top = (char *)(ucp->uc_stack.ss_sp +
ucp->uc_stack.ss_size - sizeof(double));
stack_top = (char *)ALIGN(stack_top);
/*
* Adjust top of stack to allow for any additional integer
* arguments beyond 6.
*/
if (argc > 6)
stack_top = stack_top - (sizeof(intptr_t) * (argc - 6));
argp = (intptr_t *)stack_top;
va_start(ap, argc);
for (i = 0; i < argc; i++) {
switch (i) {
case 0: ucp->uc_mcontext.mc_regs[FRAME_A0] =
(unsigned long)va_arg(ap, intptr_t);
break;
case 1: ucp->uc_mcontext.mc_regs[FRAME_A1] =
(unsigned long)va_arg(ap, intptr_t);
break;
case 2: ucp->uc_mcontext.mc_regs[FRAME_A2] =
(unsigned long)va_arg(ap, intptr_t);
break;
case 3: ucp->uc_mcontext.mc_regs[FRAME_A3] =
(unsigned long)va_arg(ap, intptr_t);
break;
case 4: ucp->uc_mcontext.mc_regs[FRAME_A4] =
(unsigned long)va_arg(ap, intptr_t);
break;
case 5: ucp->uc_mcontext.mc_regs[FRAME_A5] =
(unsigned long)va_arg(ap, intptr_t);
break;
default:
*argp = va_arg(ap, intptr_t);
argp++;
break;
}
}
va_end(ap);
/*
* The start routine and ucontext are placed in registers
* S0 and S1 respectively.
*/
ucp->uc_mcontext.mc_regs[FRAME_S0] = (unsigned long)start;
ucp->uc_mcontext.mc_regs[FRAME_S1] = (unsigned long)ucp;
/*
* Set the machine context to point to the top of the stack,
* and the program counter and return address to the context
* start wrapper.
*/
ucp->uc_mcontext.mc_regs[FRAME_SP] = (unsigned long)stack_top;
ucp->uc_mcontext.mc_regs[FRAME_PC] = (unsigned long)_ctx_start;
ucp->uc_mcontext.mc_regs[FRAME_RA] = (unsigned long)_ctx_start;
ucp->uc_mcontext.mc_regs[FRAME_T12] = (unsigned long)_ctx_start;
}
}

View File

@ -1,107 +0,0 @@
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $NetBSD: modf.c,v 1.1 1995/02/10 17:50:25 cgd Exp $
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/ieee.h>
#include <errno.h>
#include <math.h>
/*
* double modf(double val, double *iptr)
* returns: f and i such that |f| < 1.0, (f + i) = val, and
* sign(f) == sign(i) == sign(val).
*
* Beware signedness when doing subtraction, and also operand size!
*/
double
modf(val, iptr)
double val, *iptr;
{
union doub {
double v;
struct ieee_double s;
} u, v;
u_int64_t frac;
/*
* If input is Inf or NaN, return it and leave i alone.
*/
u.v = val;
if (u.s.dbl_exp == DBL_EXP_INFNAN)
return (u.v);
/*
* If input can't have a fractional part, return
* (appropriately signed) zero, and make i be the input.
*/
if ((int)u.s.dbl_exp - DBL_EXP_BIAS > DBL_FRACBITS - 1) {
*iptr = u.v;
v.v = 0.0;
v.s.dbl_sign = u.s.dbl_sign;
return (v.v);
}
/*
* If |input| < 1.0, return it, and set i to the appropriately
* signed zero.
*/
if (u.s.dbl_exp < DBL_EXP_BIAS) {
v.v = 0.0;
v.s.dbl_sign = u.s.dbl_sign;
*iptr = v.v;
return (u.v);
}
/*
* There can be a fractional part of the input.
* If you look at the math involved for a few seconds, it's
* plain to see that the integral part is the input, with the
* low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed,
* the the fractional part is the part with the rest of the
* bits zeroed. Just zeroing the high bits to get the
* fractional part would yield a fraction in need of
* normalization. Therefore, we take the easy way out, and
* just use subtraction to get the fractional part.
*/
v.v = u.v;
/* Zero the low bits of the fraction, the sleazy way. */
frac = ((u_int64_t)v.s.dbl_frach << 32) + v.s.dbl_fracl;
frac >>= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS);
frac <<= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS);
v.s.dbl_fracl = frac & 0xffffffff;
v.s.dbl_frach = frac >> 32;
*iptr = v.v;
u.v -= v.v;
u.s.dbl_sign = v.s.dbl_sign;
return (u.v);
}

View File

@ -1,66 +0,0 @@
/*-
* Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
#include <sys/syscall.h>
/* #include <machine/pal.h> */
/*
* This is pretty evil and based mostly on examples from other syscall
* stubs and code that gcc generated. Correctness is uncertain, but it
* seems to work quite happily.
*/
LEAF(rfork_thread, 1)
br gp,L1 /* XXX profiling */
L1:
LDGP(pv)
lda sp,-16(sp)
stq ra,0(sp)
mov a3,a5
CALLSYS_ERROR(rfork)
beq v0,$child
addl v0,zero,v0
ldq ra,0(sp)
lda sp,16(sp)
RET
$child:
mov a1,sp
lda sp,-16(sp)
stq zero,0(sp)
mov a5,a0
mov a2,t12
jsr ra,(t12),0
ldgp gp,0(ra)
mov v0,a0
#ifdef SYS_exit
CALLSYS_NOERROR(exit)
#else
CALLSYS_NOERROR(sys_exit)
#endif
END(rfork_thread)

View File

@ -1,138 +0,0 @@
/* $NetBSD: setjmp.S,v 1.3 1997/12/05 02:06:27 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from
* the last call to
* setjmp(a)
* by restoring registers from the stack,
* and the previous signal state.
*/
.set noreorder
LEAF(setjmp, 1)
LDGP(pv)
stq ra, (2 * 8)(a0) /* sc_pc = return address */
stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
stq s1, ((10 + 4) * 8)(a0)
stq s2, ((11 + 4) * 8)(a0)
stq s3, ((12 + 4) * 8)(a0)
stq s4, ((13 + 4) * 8)(a0)
stq s5, ((14 + 4) * 8)(a0)
stq s6, ((15 + 4) * 8)(a0)
stq ra, ((26 + 4) * 8)(a0)
stq t12,((27 + 4) * 8)(a0)
stq sp, ((30 + 4) * 8)(a0)
/*
* get signal information
*/
mov a0, s0 /* squirrel away ptr to sc */
/* see what's blocked */
lda a2, (71 * 8)(a0) /* oset: sc_reserved */
mov zero, a1 /* set: NULL */
addq a1, 1, a0 /* how: SIG_BLOCK */
CALL(_sigprocmask) /* see what's blocked */
lda sp, -24(sp) /* sizeof struct sigaltstack */
mov zero, a0
mov sp, a1
CALL(_sigaltstack)
ldl t0, 16(sp) /* offset of ss_flags */
lda sp, 24(sp) /* sizeof struct sigaltstack */
ldq ra, ((26 + 4) * 8)(s0) /* restore return address */
blt v0, botch /* check for error */
and t0, 0x1, t0 /* get SA_ONSTACK flag */
stq t0, (0 * 8)(s0) /* and save it in sc_onstack */
/*
* Restore old s0 and a0, and continue saving registers
*/
mov s0, a0
ldq s0, (( 9 + 4) * 8)(a0)
ldiq t0, 0xacedbadd /* sigcontext magic number */
stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */
/* Too bad we can't check if we actually used FP */
ldiq t0, 1
stq t0, (36 * 8)(a0) /* say we've used FP. */
stt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */
stt fs1, ((3 + 37) * 8)(a0)
stt fs2, ((4 + 37) * 8)(a0)
stt fs3, ((5 + 37) * 8)(a0)
stt fs4, ((6 + 37) * 8)(a0)
stt fs5, ((7 + 37) * 8)(a0)
stt fs6, ((8 + 37) * 8)(a0)
stt fs7, ((9 + 37) * 8)(a0)
mf_fpcr ft0 /* get FP control reg */
stt ft0, (69 * 8)(a0) /* and store it in sc_fpcr */
stq zero, (70 * 8)(a0) /* FP software control XXX */
stq zero, (71 * 8)(a0) /* sc_reserved[0] */
stq zero, (72 * 8)(a0) /* sc_reserved[1] */
stq zero, (73 * 8)(a0) /* sc_xxx[0] */
stq zero, (74 * 8)(a0) /* sc_xxx[1] */
stq zero, (75 * 8)(a0) /* sc_xxx[2] */
stq zero, (76 * 8)(a0) /* sc_xxx[3] */
stq zero, (77 * 8)(a0) /* sc_xxx[4] */
stq zero, (78 * 8)(a0) /* sc_xxx[5] */
stq zero, (79 * 8)(a0) /* sc_xxx[6] */
stq zero, (80 * 8)(a0) /* sc_xxx[7] */
mov zero, v0 /* return zero */
RET
END(setjmp)
XLEAF(longjmp, 2)
LEAF(__longjmp, 2)
LDGP(pv)
mov a1, s1 /* save return value */
mov a0, s0 /* save the sc pointer */
/* restore the mask */
mov zero, a2 /* oset: NULL */
lda a1, (71 * 8)(a0) /* set: sc_reserved */
addq a2, 3, a0 /* how: SIG_SET */
CALL(_sigprocmask) /* restore the mask */
mov s0, a0 /* restore the sc pointer */
mov s1, a1 /* restore the return value */
jmp zero, ___longjmp /* use ___longjmp to return */
botch:
CALL(longjmperror)
CALL(abort)
RET /* "can't" get here... */
END(__longjmp)

View File

@ -1,103 +0,0 @@
/*
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/ucontext.h>
#include <signal.h>
#include <stdlib.h>
#include <strings.h>
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_regs[FRAME_SP] - 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;
/*
* 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_format = _MC_REV0_TRAPFRAME;
ucp->uc_mcontext.mc_regs[FRAME_A0] = (register_t)ucp;
ucp->uc_mcontext.mc_regs[FRAME_A1] = (register_t)func;
ucp->uc_mcontext.mc_regs[FRAME_A1] = (register_t)args;
ucp->uc_mcontext.mc_regs[FRAME_SP] = (register_t)sp;
ucp->uc_mcontext.mc_regs[FRAME_PC] = (register_t)ctx_wrapper;
ucp->uc_mcontext.mc_regs[FRAME_RA] = (register_t)ctx_wrapper;
ucp->uc_mcontext.mc_regs[FRAME_T12] = (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 */
}

View File

@ -1,64 +0,0 @@
/* $NetBSD: sigsetjmp.S,v 1.2 1996/10/17 03:08:07 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
/*
* C library -- sigsetjmp, siglongjmp
*
* siglongjmp(a,v)
* will generate a "return(v)" from
* the last call to
* sigsetjmp(a, mask)
* by restoring registers from the stack.
* If `mask' is non-zero, the previous signal
* state will be restored.
*/
.set noreorder
LEAF(sigsetjmp, 2)
LDGP(pv)
stq a1, (81 * 8)(a0) /* save the mask */
bne a1, Lsavesig /* if !zero, save signals */
jmp zero, _setjmp /* else don't. */
Lsavesig:
jmp zero, setjmp
END(sigsetjmp)
XLEAF(siglongjmp, 2)
LEAF(__siglongjmp, 2)
LDGP(pv)
ldq t0, (81 * 8)(a0) /* get the mask */
bne t0, Lrestoresig /* if !zero, restore signals */
jmp zero, ___longjmp
Lrestoresig:
jmp zero, __longjmp
END(__siglongjmp)

View File

@ -1,3 +0,0 @@
# $FreeBSD$
SRCS+= htonl.S htons.S ntohl.S ntohs.S

View File

@ -1,49 +0,0 @@
/* $NetBSD: byte_swap_2.S,v 1.2 1996/10/17 03:08:08 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#if !defined(ALIAS) || !defined(NAME)
#error ALIAS or NAME not defined
#endif
/*
* Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.)
*
* Argument is an unsigned 2-byte integer (u_int16_t).
*/
XLEAF(ALIAS, 1)
LEAF(NAME, 1) /* a0 contains 0x0123 */
extbl a0, 0, t0 /* t0 = 0x 23 */
extbl a0, 1, t1 /* t1 = 0x 01 */
sll t0, 8, t0 /* t1 = 0x23 */
or t0, t1, v0 /* v0 = 0x2301 */
RET
END(NAME)

View File

@ -1,55 +0,0 @@
/* $NetBSD: byte_swap_4.S,v 1.2 1996/10/17 03:08:09 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#if !defined(ALIAS) || !defined(NAME)
#error ALIAS or NAME not defined
#endif
/*
* Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.)
*
* Argument is an unsigned 4-byte integer (u_int32_t).
*/
XLEAF(ALIAS, 1)
LEAF(NAME, 1) /* a0 contains 0x01234567 */
extbl a0, 0, t0 /* t0 = 0x 67 */
extbl a0, 1, t1 /* t1 = 0x 45 */
extbl a0, 2, t2 /* t2 = 0x 23 */
extbl a0, 3, t3 /* t3 = 0x 01 */
sll t0, 24, t0 /* t0 = 0x67 */
sll t1, 16, t1 /* t1 = 0x 45 */
sll t2, 8, t2 /* t2 = 0x 23 */
or t3, t0, v0 /* v0 = 0x67 01 */
or t1, t2, t1 /* t1 = 0x 4523 */
or t1, v0, v0 /* v0 = 0x67452301 */
RET
END(NAME)

View File

@ -1,36 +0,0 @@
/* $NetBSD: htonl.S,v 1.1 1996/04/17 22:36:52 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#define ALIAS htonl
#define NAME __htonl
#include "byte_swap_4.S"

View File

@ -1,36 +0,0 @@
/* $NetBSD: htons.S,v 1.1 1996/04/17 22:36:54 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#define ALIAS htons
#define NAME __htons
#include "byte_swap_2.S"

View File

@ -1,36 +0,0 @@
/* $NetBSD: ntohl.S,v 1.1 1996/04/17 22:36:57 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#define ALIAS ntohl
#define NAME __ntohl
#include "byte_swap_4.S"

View File

@ -1,36 +0,0 @@
/* $NetBSD: ntohs.S,v 1.1 1996/04/17 22:37:02 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#define ALIAS ntohs
#define NAME __ntohs
#include "byte_swap_2.S"

View File

@ -1,3 +0,0 @@
# $FreeBSD$
MDSRCS+= abs.c div.c labs.c ldiv.c

View File

@ -1,3 +0,0 @@
# $FreeBSD$
MDSRCS+= bcopy.S bzero.S ffs.S memcpy.S memmove.S

View File

@ -1,289 +0,0 @@
/* $NetBSD: bcopy.S,v 1.3 1996/10/17 03:08:11 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Trevor Blackwell. Support for use as memcpy() and memmove()
* added by Chris Demetriou.
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#if defined(MEMCOPY) || defined(MEMMOVE)
#ifdef MEMCOPY
#define FUNCTION memcpy
#else
#define FUNCTION memmove
#endif
#define SRCREG a1
#define DSTREG a0
#else /* !(defined(MEMCOPY) || defined(MEMMOVE)) */
#define FUNCTION bcopy
#define SRCREG a0
#define DSTREG a1
#endif /* !(defined(MEMCOPY) || defined(MEMMOVE)) */
#define SIZEREG a2
/*
* Copy bytes.
*
* void bcopy(char *from, char *to, size_t len);
* char *memcpy(void *to, const void *from, size_t len);
* char *memmove(void *to, const void *from, size_t len);
*
* No matter how invoked, the source and destination registers
* for calculation. There's no point in copying them to "working"
* registers, since the code uses their values "in place," and
* copying them would be slower.
*/
LEAF(FUNCTION,3)
#if defined(MEMCOPY) || defined(MEMMOVE)
/* set up return value, while we still can */
mov DSTREG,v0
#endif
/* Check for negative length */
ble SIZEREG,bcopy_done
/* Check for overlap */
subq DSTREG,SRCREG,t5
cmpult t5,SIZEREG,t5
bne t5,bcopy_overlap
/* a3 = end address */
addq SRCREG,SIZEREG,a3
/* Get the first word */
ldq_u t2,0(SRCREG)
/* Do they have the same alignment? */
xor SRCREG,DSTREG,t0
and t0,7,t0
and DSTREG,7,t1
bne t0,bcopy_different_alignment
/* src & dst have same alignment */
beq t1,bcopy_all_aligned
ldq_u t3,0(DSTREG)
addq SIZEREG,t1,SIZEREG
mskqh t2,SRCREG,t2
mskql t3,SRCREG,t3
or t2,t3,t2
/* Dst is 8-byte aligned */
bcopy_all_aligned:
/* If less than 8 bytes,skip loop */
subq SIZEREG,1,t0
and SIZEREG,7,SIZEREG
bic t0,7,t0
beq t0,bcopy_samealign_lp_end
bcopy_samealign_lp:
stq_u t2,0(DSTREG)
addq DSTREG,8,DSTREG
ldq_u t2,8(SRCREG)
subq t0,8,t0
addq SRCREG,8,SRCREG
bne t0,bcopy_samealign_lp
bcopy_samealign_lp_end:
/* If we're done, exit */
bne SIZEREG,bcopy_small_left
stq_u t2,0(DSTREG)
RET
bcopy_small_left:
mskql t2,SIZEREG,t4
ldq_u t3,0(DSTREG)
mskqh t3,SIZEREG,t3
or t4,t3,t4
stq_u t4,0(DSTREG)
RET
bcopy_different_alignment:
/*
* this is the fun part
*/
addq SRCREG,SIZEREG,a3
cmpule SIZEREG,8,t0
bne t0,bcopy_da_finish
beq t1,bcopy_da_noentry
/* Do the initial partial word */
subq zero,DSTREG,t0
and t0,7,t0
ldq_u t3,7(SRCREG)
extql t2,SRCREG,t2
extqh t3,SRCREG,t3
or t2,t3,t5
insql t5,DSTREG,t5
ldq_u t6,0(DSTREG)
mskql t6,DSTREG,t6
or t5,t6,t5
stq_u t5,0(DSTREG)
addq SRCREG,t0,SRCREG
addq DSTREG,t0,DSTREG
subq SIZEREG,t0,SIZEREG
ldq_u t2,0(SRCREG)
bcopy_da_noentry:
subq SIZEREG,1,t0
bic t0,7,t0
and SIZEREG,7,SIZEREG
beq t0,bcopy_da_finish2
bcopy_da_lp:
ldq_u t3,7(SRCREG)
addq SRCREG,8,SRCREG
extql t2,SRCREG,t4
extqh t3,SRCREG,t5
subq t0,8,t0
or t4,t5,t5
stq t5,0(DSTREG)
addq DSTREG,8,DSTREG
beq t0,bcopy_da_finish1
ldq_u t2,7(SRCREG)
addq SRCREG,8,SRCREG
extql t3,SRCREG,t4
extqh t2,SRCREG,t5
subq t0,8,t0
or t4,t5,t5
stq t5,0(DSTREG)
addq DSTREG,8,DSTREG
bne t0,bcopy_da_lp
bcopy_da_finish2:
/* Do the last new word */
mov t2,t3
bcopy_da_finish1:
/* Do the last partial word */
ldq_u t2,-1(a3)
extql t3,SRCREG,t3
extqh t2,SRCREG,t2
or t2,t3,t2
br zero,bcopy_samealign_lp_end
bcopy_da_finish:
/* Do the last word in the next source word */
ldq_u t3,-1(a3)
extql t2,SRCREG,t2
extqh t3,SRCREG,t3
or t2,t3,t2
insqh t2,DSTREG,t3
insql t2,DSTREG,t2
lda t4,-1(zero)
mskql t4,SIZEREG,t5
cmovne t5,t5,t4
insqh t4,DSTREG,t5
insql t4,DSTREG,t4
addq DSTREG,SIZEREG,a4
ldq_u t6,0(DSTREG)
ldq_u t7,-1(a4)
bic t6,t4,t6
bic t7,t5,t7
and t2,t4,t2
and t3,t5,t3
or t2,t6,t2
or t3,t7,t3
stq_u t3,-1(a4)
stq_u t2,0(DSTREG)
RET
bcopy_overlap:
/*
* Basically equivalent to previous case, only backwards.
* Not quite as highly optimized
*/
addq SRCREG,SIZEREG,a3
addq DSTREG,SIZEREG,a4
/* less than 8 bytes - don't worry about overlap */
cmpule SIZEREG,8,t0
bne t0,bcopy_ov_short
/* Possibly do a partial first word */
and a4,7,t4
beq t4,bcopy_ov_nostart2
subq a3,t4,a3
subq a4,t4,a4
ldq_u t1,0(a3)
subq SIZEREG,t4,SIZEREG
ldq_u t2,7(a3)
ldq t3,0(a4)
extql t1,a3,t1
extqh t2,a3,t2
or t1,t2,t1
mskqh t3,t4,t3
mskql t1,t4,t1
or t1,t3,t1
stq t1,0(a4)
bcopy_ov_nostart2:
bic SIZEREG,7,t4
and SIZEREG,7,SIZEREG
beq t4,bcopy_ov_lp_end
bcopy_ov_lp:
/* This could be more pipelined, but it doesn't seem worth it */
ldq_u t0,-8(a3)
subq a4,8,a4
ldq_u t1,-1(a3)
subq a3,8,a3
extql t0,a3,t0
extqh t1,a3,t1
subq t4,8,t4
or t0,t1,t0
stq t0,0(a4)
bne t4,bcopy_ov_lp
bcopy_ov_lp_end:
beq SIZEREG,bcopy_done
ldq_u t0,0(SRCREG)
ldq_u t1,7(SRCREG)
ldq_u t2,0(DSTREG)
extql t0,SRCREG,t0
extqh t1,SRCREG,t1
or t0,t1,t0
insql t0,DSTREG,t0
mskql t2,DSTREG,t2
or t2,t0,t2
stq_u t2,0(DSTREG)
bcopy_done:
RET
bcopy_ov_short:
ldq_u t2,0(SRCREG)
br zero,bcopy_da_finish
END(FUNCTION)

View File

@ -1,111 +0,0 @@
/* $NetBSD: bzero.S,v 1.2 1996/10/17 03:08:12 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Trevor Blackwell
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
LEAF(bzero,2)
ble a1,bzero_done
bic a1,63,t3 /* t3 is # bytes to do 64 bytes at a time */
/* If nothing in first word, ignore it */
subq zero,a0,t0
and t0,7,t0 /* t0 = (0-size)%8 */
beq t0,bzero_nostart1
cmpult a1,t0,t1 /* if size > size%8 goto noshort */
beq t1,bzero_noshort
/*
* The whole thing is less than a word.
* Mask off 1..7 bytes, and finish.
*/
ldq_u t2,0(a0)
lda t0,-1(zero) /* t0=-1 */
mskql t0,a1,t0 /* Get ff in bytes (a0%8)..((a0+a1-1)%8) */
insql t0,a0,t0
bic t2,t0,t2 /* zero those bytes in word */
stq_u t2,0(a0)
RET
bzero_noshort:
/* Handle the first partial word */
ldq_u t2,0(a0)
subq a1,t0,a1
mskql t2,a0,t2 /* zero bytes (a0%8)..7 in word */
stq_u t2,0(a0)
addq a0,t0,a0 /* round a0 up to next word */
bic a1,63,t3 /* recalc t3 (# bytes to do 64 bytes at a
time) */
bzero_nostart1:
/*
* Loop, zeroing 64 bytes at a time
*/
beq t3,bzero_lp_done
bzero_lp:
stq zero,0(a0)
stq zero,8(a0)
stq zero,16(a0)
stq zero,24(a0)
subq t3,64,t3
stq zero,32(a0)
stq zero,40(a0)
stq zero,48(a0)
stq zero,56(a0)
addq a0,64,a0
bne t3,bzero_lp
bzero_lp_done:
/*
* Handle the last 0..7 words.
* We mask off the low bits, so we don't need an extra
* compare instruction for the loop (just a bne. heh-heh)
*/
and a1,0x38,t4
beq t4,bzero_finish_lp_done
bzero_finish_lp:
stq zero,0(a0)
subq t4,8,t4
addq a0,8,a0
bne t4,bzero_finish_lp
/* Do the last partial word */
bzero_finish_lp_done:
and a1,7,t5 /* 0..7 bytes left */
beq t5,bzero_done /* mskqh won't change t0 if t5==0, but I
don't want to touch, say, a new VM page */
ldq t0,0(a0)
mskqh t0,t5,t0
stq t0,0(a0)
bzero_done:
RET
END(bzero)

View File

@ -1,92 +0,0 @@
/* $NetBSD: ffs.S,v 1.3 1996/10/17 03:08:13 cgd Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
LEAF(ffs, 1)
addl a0, 0, t0
beq t0, Lallzero
/*
* Initialize return value (v0), and set up t1 so that it
* contains the mask with only the lowest bit set.
*/
subl zero, t0, t1
ldil v0, 1
and t0, t1, t1
and t1, 0xff, t2
bne t2, Ldo8
/*
* If lower 16 bits empty, add 16 to result and use upper 16.
*/
zapnot t1, 0x03, t3
bne t3, Ldo16
sra t1, 16, t1
addl v0, 16, v0
Ldo16:
/*
* If lower 8 bits empty, add 8 to result and use upper 8.
*/
and t1, 0xff, t4
bne t4, Ldo8
sra t1, 8, t1
addl v0, 8, v0
Ldo8:
and t1, 0x0f, t5 /* lower 4 of 8 empty? */
and t1, 0x33, t6 /* lower 2 of each 4 empty? */
and t1, 0x55, t7 /* lower 1 of each 2 empty? */
/* If lower 4 bits empty, add 4 to result. */
bne t5, Ldo4
addl v0, 4, v0
Ldo4: /* If lower 2 bits of each 4 empty, add 2 to result. */
bne t6, Ldo2
addl v0, 2, v0
Ldo2: /* If lower bit of each 2 empty, add 1 to result. */
bne t7, Ldone
addl v0, 1, v0
Ldone:
RET
Lallzero:
bis zero, zero, v0
RET
END(ffs)

View File

@ -1,8 +0,0 @@
/* $NetBSD: memcpy.S,v 1.1 1995/08/13 00:40:47 cgd Exp $ */
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#define MEMCOPY
#include "bcopy.S"

View File

@ -1,7 +0,0 @@
/* $NetBSD: memmove.S,v 1.1 1995/08/13 00:40:48 cgd Exp $ */
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#define MEMMOVE
#include "bcopy.S"

View File

@ -1,12 +0,0 @@
# $FreeBSD$
MDASM+= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.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

View File

@ -1,38 +0,0 @@
/* $NetBSD: Ovfork.S,v 1.1 1995/02/10 17:50:29 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
SYSCALL(vfork)
cmovne a4, zero, v0 /* a4 (rv[1]) != 0, child */
RET
END(__sys_vfork)

View File

@ -1,53 +0,0 @@
/* $NetBSD: brk.S,v 1.4 1996/10/17 03:08:15 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
.globl _end
IMPORT(curbrk, 8)
.data
EXPORT(minbrk)
.quad _end
.text
LEAF(brk, 1)
br pv, L1 /* XXX profiling */
L1: LDGP(pv)
ldq v0, minbrk
cmpult a0, v0, t0
cmovne t0, v0, a0
CALLSYS_ERROR(break)
stq a0, curbrk
mov zero, v0
RET
END(brk)

View File

@ -1,56 +0,0 @@
/* $NetBSD: cerror.S,v 1.4 1996/11/08 00:52:46 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
#define FRAME_SIZE 16
#define FRAME_RA_OFFSET 0
#define FRAME_V0_OFFSET 8
NESTED(.cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0)
br t0, L1
L1: LDGP(t0)
lda sp, -FRAME_SIZE(sp)
stq ra, FRAME_RA_OFFSET(sp)
stq v0, FRAME_V0_OFFSET(sp)
CALL(__error)
ldq t0, FRAME_V0_OFFSET(sp)
stl t0, 0(v0)
ldiq v0, -1
ldq ra, FRAME_RA_OFFSET(sp)
lda sp, FRAME_SIZE(sp)
RET
END(.cerror)

View File

@ -1,38 +0,0 @@
/* $NetBSD: exect.S,v 1.2 1996/10/17 03:08:18 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
LEAF(exect, 3)
CALLSYS_ERROR(execve)
RET
END(exect)

View File

@ -1,38 +0,0 @@
/* $NetBSD: fork.S,v 1.1 1995/02/10 17:50:34 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
SYSCALL(fork)
cmovne a4, zero, v0 /* a4 (rv[1]) != 0, child */
RET
END(__sys_fork)

View File

@ -1,40 +0,0 @@
/* $NetBSD: pipe.S,v 1.1 1995/02/10 17:50:35 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
SYSCALL(pipe)
stl v0, 0(a0)
stl a4, 4(a0)
mov zero, v0
RET
END(__sys_pipe)

View File

@ -1,40 +0,0 @@
/* $NetBSD: ptrace.S,v 1.4 1996/11/08 00:51:24 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
LEAF(ptrace, 4)
LDGP(pv)
stl zero, errno
CALLSYS_ERROR(ptrace)
RET
END(ptrace)

View File

@ -1,53 +0,0 @@
/* $NetBSD: sbrk.S,v 1.4 1996/10/17 03:08:20 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
.globl _end
.data
EXPORT(curbrk)
.quad _end
.text
LEAF(sbrk, 1)
br pv, L1 /* XXX profiling */
L1: LDGP(pv)
ldq a1, curbrk
beq a0, L2
addq a0, a1, a0
CALLSYS_ERROR(break)
stq a0, curbrk
L2:
mov a1, v0
RET
END(sbrk)

View File

@ -1,40 +0,0 @@
/* $NetBSD: setlogin.S,v 1.1 1995/02/10 17:50:39 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
IMPORT(_logname_valid, 4) /* in _getlogin() */
SYSCALL(setlogin)
stl zero, _logname_valid /* clear it */
RET
END(__sys_setlogin)

View File

@ -1,41 +0,0 @@
/* $NetBSD: sigreturn.S,v 1.1 1995/02/10 17:50:42 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include "SYS.h"
/*
* We must preserve the state of the registers as the user has set them up.
* However, that doesn't involve any special work on the Alpha.
* (XXX PROFILING)
*/
RSYSCALL(sigreturn)

View File

@ -86,7 +86,7 @@ FILE __sF[3] = {
* with future versions of libc. Or rather it allows us to work with
* libraries that have been built with a newer libc that defines these
* symbols and expects libc to provide them. We only have need to support
* i386 and alpha because they are the only "old" systems we have deployed.
* i386 because it is the only "old" system we have deployed.
*/
FILE *__stdinp = &__sF[0];
FILE *__stdoutp = &__sF[1];

View File

@ -25,7 +25,7 @@ PRECIOUSLIB=
.include "${.CURDIR}/uthread/Makefile.inc"
.include "${.CURDIR}/sys/Makefile.inc"
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
.if ${MACHINE_ARCH} == "sparc64"
SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
.if !defined(NO_PIC)
SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
* copyright Douglas Santry 1996
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the above copyright is retained
* in the source form.
*
* THIS SOFTWARE IS PROVIDED BY Douglas Santry 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 Douglas Santry 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$
*
*/
#include <machine/asm.h>
/*
* Atomicly lock a location with an identifier provided the location
* is not currently locked.
*
* long _atomic_lock(long *);
* v0 will contain the return value (zero if lock obtained).
*/
LEAF(_atomic_lock,0)
LDGP(pv)
0: ldq_l v0, 0(a0) /* read existing lock value */
mov 1, t0 /* locked value to store */
stq_c t0, 0(a0) /* attempt to store, status in t0 */
beq t0, 1f /* branch foward to optimise prediction */
mb /* sync with other processors */
RET /* return with v0==0 if lock obtained */
1: br 0b /* loop to try again */
END(_atomic_lock)

View File

@ -1,9 +0,0 @@
# $FreeBSD$
LIB= io
SHLIB_MAJOR= 1
SRCS= io.c swiz.c bwx.c alpha_sethae.c
CFLAGS+= -Wall -Wa,-mev56
.include <bsd.lib.mk>

View File

@ -1,46 +0,0 @@
/*-
* Copyright (c) 1998 Doug Rabson
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <machine/sysarch.h>
struct parms {
u_int64_t hae;
};
int
alpha_sethae(u_int64_t hae)
{
struct parms p;
p.hae = hae;
return (sysarch(ALPHA_SETHAE, &p));
}

View File

@ -1,244 +0,0 @@
/*-
* Copyright (c) 1998 Doug Rabson
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/fcntl.h>
#include <sys/sysctl.h>
#include <err.h>
#include <paths.h>
#include <machine/bwx.h>
#include <machine/sysarch.h>
#include <stdlib.h>
#include "io.h"
#define mb() __asm__ __volatile__("mb" : : : "memory")
#define wmb() __asm__ __volatile__("wmb" : : : "memory")
static int mem_fd; /* file descriptor to /dev/mem */
static void *bwx_int1_ports; /* mapped int1 io ports */
static void *bwx_int2_ports; /* mapped int2 io ports */
static void *bwx_int4_ports; /* mapped int4 io ports */
static u_int64_t bwx_io_base; /* physical address of ports */
static u_int64_t bwx_mem_base; /* physical address of bwx mem */
static void
bwx_init()
{
size_t len = sizeof(u_int64_t);
int error;
mem_fd = open(_PATH_MEM, O_RDWR);
if (mem_fd < 0)
err(1, _PATH_MEM);
bwx_int1_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);
bwx_int2_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);
bwx_int4_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);
if ((error = sysctlbyname("hw.chipset.ports", &bwx_io_base, &len,
0, 0)) < 0)
err(1, "hw.chipset.ports");
if ((error = sysctlbyname("hw.chipset.memory", &bwx_mem_base, &len,
0, 0)) < 0)
err(1, "hw.chipset.memory");
}
static int
bwx_ioperm(u_int32_t from, u_int32_t num, int on)
{
u_int32_t start, end;
if (!bwx_int1_ports)
bwx_init();
if (!on)
return -1; /* XXX can't unmap yet */
start = trunc_page(from);
end = round_page(from + num);
munmap(bwx_int1_ports + start, end-start);
munmap(bwx_int2_ports + start, end-start);
munmap(bwx_int4_ports + start, end-start);
mmap(bwx_int1_ports + start, end-start, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd, bwx_io_base + BWX_EV56_INT1 + start);
mmap(bwx_int2_ports + start, end-start, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd, bwx_io_base + BWX_EV56_INT2 + start);
mmap(bwx_int4_ports + start, end-start, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd, bwx_io_base + BWX_EV56_INT4 + start);
return 0;
}
static u_int8_t
bwx_inb(u_int32_t port)
{
mb();
return ldbu((vm_offset_t)bwx_int1_ports + port);
}
static u_int16_t
bwx_inw(u_int32_t port)
{
mb();
return ldwu((vm_offset_t)bwx_int2_ports + port);
}
static u_int32_t
bwx_inl(u_int32_t port)
{
mb();
return ldl((vm_offset_t)bwx_int4_ports + port);
}
static void
bwx_outb(u_int32_t port, u_int8_t val)
{
stb((vm_offset_t)bwx_int1_ports + port, val);
wmb();
}
static void
bwx_outw(u_int32_t port, u_int16_t val)
{
stw((vm_offset_t)bwx_int2_ports + port, val);
wmb();
}
static void
bwx_outl(u_int32_t port, u_int32_t val)
{
stl((vm_offset_t)bwx_int4_ports + port, val);
wmb();
}
struct bwx_mem_handle {
void *virt1; /* int1 address in user address-space */
void *virt2; /* int2 address in user address-space */
void *virt4; /* int4 address in user address-space */
};
static void *
bwx_map_memory(u_int32_t address, u_int32_t size)
{
struct bwx_mem_handle *h;
h = malloc(sizeof(struct bwx_mem_handle));
if (!h) return 0;
h->virt1 = mmap(0, size << 5, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd, bwx_mem_base + BWX_EV56_INT1 + address);
if ((long) h->virt1 == -1) {
free(h);
return 0;
}
h->virt2 = mmap(0, size << 5, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd, bwx_mem_base + BWX_EV56_INT2 + address);
if ((long) h->virt2 == -1) {
munmap(h->virt1, size);
free(h);
return 0;
}
h->virt4 = mmap(0, size << 5, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd, bwx_mem_base + BWX_EV56_INT4 + address);
if ((long) h->virt4 == -1) {
munmap(h->virt1, size);
munmap(h->virt2, size);
free(h);
return 0;
}
return h;
}
static void
bwx_unmap_memory(void *handle, u_int32_t size)
{
struct bwx_mem_handle *h = handle;
munmap(h->virt1, size);
munmap(h->virt2, size);
munmap(h->virt4, size);
free(h);
}
static u_int8_t
bwx_readb(void *handle, u_int32_t offset)
{
struct bwx_mem_handle *h = handle;
return ldbu((vm_offset_t)h->virt1 + offset);
}
static u_int16_t
bwx_readw(void *handle, u_int32_t offset)
{
struct bwx_mem_handle *h = handle;
return ldwu((vm_offset_t)h->virt2 + offset);
}
static u_int32_t
bwx_readl(void *handle, u_int32_t offset)
{
struct bwx_mem_handle *h = handle;
return ldl((vm_offset_t)h->virt4 + offset);
}
static void
bwx_writeb(void *handle, u_int32_t offset, u_int8_t val)
{
struct bwx_mem_handle *h = handle;
stb_nb((vm_offset_t)h->virt1 + offset, val);
}
static void
bwx_writew(void *handle, u_int32_t offset, u_int16_t val)
{
struct bwx_mem_handle *h = handle;
stw_nb((vm_offset_t)h->virt2 + offset, val);
}
static void
bwx_writel(void *handle, u_int32_t offset, u_int32_t val)
{
struct bwx_mem_handle *h = handle;
stl_nb((vm_offset_t)h->virt4 + offset, val);
}
struct io_ops bwx_io_ops = {
bwx_ioperm,
bwx_inb,
bwx_inw,
bwx_inl,
bwx_outb,
bwx_outw,
bwx_outl,
bwx_map_memory,
bwx_unmap_memory,
bwx_readb,
bwx_readw,
bwx_readl,
bwx_writeb,
bwx_writew,
bwx_writel,
};

View File

@ -1,173 +0,0 @@
/*-
* Copyright (c) 1998 Doug Rabson
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/sysctl.h>
#include <err.h>
#include "io.h"
static struct io_ops *ops;
int
ioperm(unsigned long from, unsigned long num, int on)
{
int error;
int bwx;
size_t len = sizeof(bwx);
if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0)
return error;
if (bwx)
ops = &bwx_io_ops;
else
ops = &swiz_io_ops;
return ops->ioperm(from, num, on);
}
u_int8_t
inb(u_int32_t port)
{
return ops->inb(port);
}
u_int16_t
inw(u_int32_t port)
{
return ops->inw(port);
}
u_int32_t
inl(u_int32_t port)
{
return ops->inl(port);
}
void
outb(u_int32_t port, u_int8_t val)
{
ops->outb(port, val);
}
void
outw(u_int32_t port, u_int16_t val)
{
ops->outw(port, val);
}
void
outl(u_int32_t port, u_int32_t val)
{
ops->outl(port, val);
}
void *
map_memory(u_int32_t address, u_int32_t size)
{
return ops->map_memory(address, size);
}
void
unmap_memory(void *handle, u_int32_t size)
{
ops->unmap_memory(handle, size);
}
u_int8_t
readb(void *handle, u_int32_t offset)
{
return ops->readb(handle, offset);
}
u_int16_t
readw(void *handle, u_int32_t offset)
{
return ops->readw(handle, offset);
}
u_int32_t
readl(void *handle, u_int32_t offset)
{
return ops->readl(handle, offset);
}
void
writeb(void *handle, u_int32_t offset, u_int8_t val)
{
ops->writeb(handle, offset, val);
__asm__ __volatile__ ("mb");
}
void
writew(void *handle, u_int32_t offset, u_int16_t val)
{
ops->writew(handle, offset, val);
__asm__ __volatile__ ("mb");
}
void
writel(void *handle, u_int32_t offset, u_int32_t val)
{
ops->writel(handle, offset, val);
__asm__ __volatile__ ("mb");
}
void
writeb_nb(void *handle, u_int32_t offset, u_int8_t val)
{
return ops->writeb(handle, offset, val);
}
void
writew_nb(void *handle, u_int32_t offset, u_int16_t val)
{
return ops->writew(handle, offset, val);
}
void
writel_nb(void *handle, u_int32_t offset, u_int32_t val)
{
return ops->writel(handle, offset, val);
}
u_int64_t
dense_base(void)
{
static u_int64_t base = 0;
if (base == 0) {
size_t len = sizeof(base);
int error;
if ((error = sysctlbyname("hw.chipset.dense", &base, &len,
0, 0)) < 0)
err(1, "hw.chipset.dense");
}
return base;
}

View File

@ -1,48 +0,0 @@
/*-
* Copyright (c) 1998 Doug Rabson
* 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$
*/
struct io_ops {
int (*ioperm)(u_int32_t, u_int32_t, int);
u_int8_t (*inb)(u_int32_t);
u_int16_t (*inw)(u_int32_t);
u_int32_t (*inl)(u_int32_t);
void (*outb)(u_int32_t, u_int8_t);
void (*outw)(u_int32_t, u_int16_t);
void (*outl)(u_int32_t, u_int32_t);
void * (*map_memory)(u_int32_t, u_int32_t);
void (*unmap_memory)(void *, u_int32_t);
u_int8_t (*readb)(void *, u_int32_t);
u_int16_t (*readw)(void *, u_int32_t);
u_int32_t (*readl)(void *, u_int32_t);
void (*writeb)(void *, u_int32_t, u_int8_t);
void (*writew)(void *, u_int32_t, u_int16_t);
void (*writel)(void *, u_int32_t, u_int32_t);
};
extern struct io_ops swiz_io_ops;
extern struct io_ops bwx_io_ops;

View File

@ -1,248 +0,0 @@
/*-
* Copyright (c) 1998 Doug Rabson
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/fcntl.h>
#include <sys/sysctl.h>
#include <err.h>
#include <paths.h>
#include <machine/swiz.h>
#include <machine/sysarch.h>
#include <stdlib.h>
#include "io.h"
#define mb() __asm__ __volatile__("mb" : : : "memory")
#define wmb() __asm__ __volatile__("wmb" : : : "memory")
static int mem_fd; /* file descriptor to /dev/mem */
static void *swiz_ports; /* mapped io ports */
static u_int64_t swiz_io_base; /* physical address of ports */
static u_int64_t swiz_mem_base; /* physical address of sparse mem */
static u_int64_t swiz_dense_base; /* physical address of dense mem */
static u_int64_t swiz_hae_mask; /* mask address bits for hae */
static u_int32_t swiz_hae; /* cache of current hae */
static void
swiz_init()
{
size_t len = sizeof(u_int64_t);
int error;
mem_fd = open(_PATH_MEM, O_RDWR);
if (mem_fd < 0)
err(1, _PATH_MEM);
swiz_ports = mmap(0, 1L<<32, PROT_READ, MAP_ANON, -1, 0);
if ((error = sysctlbyname("hw.chipset.ports", &swiz_io_base, &len,
0, 0)) < 0)
err(1, "hw.chipset.ports");
if ((error = sysctlbyname("hw.chipset.memory", &swiz_mem_base, &len,
0, 0)) < 0)
err(1, "hw.chipset.memory");
if ((error = sysctlbyname("hw.chipset.dense", &swiz_dense_base, &len,
0, 0)) < 0)
err(1, "hw.chipset.memory");
if ((error = sysctlbyname("hw.chipset.hae_mask", &swiz_hae_mask, &len,
0, 0)) < 0)
err(1, "hw.chipset.memory");
}
static int
swiz_ioperm(u_int32_t from, u_int32_t num, int on)
{
u_int64_t start, end;
void *addr;
if (!swiz_ports)
swiz_init();
if (!on)
return -1; /* XXX can't unmap yet */
start = trunc_page(from << 5);
end = round_page((from + num) << 5);
addr = swiz_ports + start;
munmap(addr, end - start);
mmap(addr, end - start, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd, swiz_io_base + start);
return 0;
}
static u_int8_t
swiz_inb(u_int32_t port)
{
mb();
return SPARSE_READ_BYTE(swiz_ports, port);
}
static u_int16_t
swiz_inw(u_int32_t port)
{
mb();
return SPARSE_READ_WORD(swiz_ports, port);
}
static u_int32_t
swiz_inl(u_int32_t port)
{
mb();
return SPARSE_READ_LONG(swiz_ports, port);
}
static void
swiz_outb(u_int32_t port, u_int8_t val)
{
SPARSE_WRITE_BYTE(swiz_ports, port, val);
wmb();
}
static void
swiz_outw(u_int32_t port, u_int16_t val)
{
SPARSE_WRITE_WORD(swiz_ports, port, val);
wmb();
}
static void
swiz_outl(u_int32_t port, u_int32_t val)
{
SPARSE_WRITE_LONG(swiz_ports, port, val);
wmb();
}
struct swiz_mem_handle {
u_int32_t phys; /* address in PCI address-space */
void *virt; /* address in user address-space */
u_int32_t size; /* size of mapped region */
};
static void *
swiz_map_memory(u_int32_t address, u_int32_t size)
{
struct swiz_mem_handle *h;
h = malloc(sizeof(struct swiz_mem_handle));
if (!h) return 0;
h->phys = address;
h->virt = mmap(0, size << 5, PROT_READ|PROT_WRITE, MAP_SHARED,
mem_fd,
swiz_mem_base + ((address & ~swiz_hae_mask) << 5));
if ((long) h->virt == -1) {
free(h);
return 0;
}
h->size = size << 5;
return h;
}
static void
swiz_unmap_memory(void *handle, u_int32_t size)
{
struct swiz_mem_handle *h = handle;
munmap(h->virt, h->size);
free(h);
}
static void
swiz_sethae(vm_offset_t phys)
{
u_int32_t hae = phys & swiz_hae_mask;
if (hae != swiz_hae) {
alpha_sethae(hae);
swiz_hae = hae;
}
}
static u_int8_t
swiz_readb(void *handle, u_int32_t offset)
{
struct swiz_mem_handle *h = handle;
swiz_sethae(h->phys + offset);
return SPARSE_READ_BYTE(h->virt, offset);
}
static u_int16_t
swiz_readw(void *handle, u_int32_t offset)
{
struct swiz_mem_handle *h = handle;
swiz_sethae(h->phys + offset);
return SPARSE_READ_WORD(h->virt, offset);
}
static u_int32_t
swiz_readl(void *handle, u_int32_t offset)
{
struct swiz_mem_handle *h = handle;
swiz_sethae(h->phys + offset);
return SPARSE_READ_LONG(h->virt, offset);
}
static void
swiz_writeb(void *handle, u_int32_t offset, u_int8_t val)
{
struct swiz_mem_handle *h = handle;
swiz_sethae(h->phys + offset);
SPARSE_WRITE_BYTE(h->virt, offset, val);
}
static void
swiz_writew(void *handle, u_int32_t offset, u_int16_t val)
{
struct swiz_mem_handle *h = handle;
swiz_sethae(h->phys + offset);
SPARSE_WRITE_WORD(h->virt, offset, val);
}
static void
swiz_writel(void *handle, u_int32_t offset, u_int32_t val)
{
struct swiz_mem_handle *h = handle;
swiz_sethae(h->phys + offset);
SPARSE_WRITE_LONG(h->virt, offset, val);
}
struct io_ops swiz_io_ops = {
swiz_ioperm,
swiz_inb,
swiz_inw,
swiz_inl,
swiz_outb,
swiz_outw,
swiz_outl,
swiz_map_memory,
swiz_unmap_memory,
swiz_readb,
swiz_readw,
swiz_readl,
swiz_writeb,
swiz_writew,
swiz_writel,
};

View File

@ -7,7 +7,7 @@
# To included legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS
# (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the
# system call stubs.
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
.if ${MACHINE_ARCH} == "sparc64"
LIB=kse
.else
LIB=pthread

View File

@ -7,7 +7,7 @@
# To included legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS
# (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the
# system call stubs.
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
.if ${MACHINE_ARCH} == "sparc64"
LIB=kse
.else
LIB=pthread

View File

@ -1,5 +0,0 @@
# $FreeBSD$
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
SRCS+= enter_uts.S context.S pthread_md.c

View File

@ -1,353 +0,0 @@
/*
* Copyright (c) 2001,3 Daniel Eischen <deischen@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of the author 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 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.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
/* #include <machine/frame.h> */
#define FRAME_V0 0
#define FRAME_T0 1
#define FRAME_T1 2
#define FRAME_T2 3
#define FRAME_T3 4
#define FRAME_T4 5
#define FRAME_T5 6
#define FRAME_T6 7
#define FRAME_T7 8
#define FRAME_S0 9
#define FRAME_S1 10
#define FRAME_S2 11
#define FRAME_S3 12
#define FRAME_S4 13
#define FRAME_S5 14
#define FRAME_S6 15
#define FRAME_A3 16
#define FRAME_A4 17
#define FRAME_A5 18
#define FRAME_RA 23
#define FRAME_T12 24
#define FRAME_AT 25
#define FRAME_SP 26
#define FRAME_TRAPARG_A0 28
#define FRAME_TRAPARG_A1 29
#define FRAME_TRAPARG_A2 30
#define FRAME_PC (FRAME_TRAPARG_A2 + 1 + 1)
/* #include <machine/reg.h> */
#define R_V0 0
#define R_T0 1
#define R_T1 2
#define R_T2 3
#define R_T3 4
#define R_T4 5
#define R_T5 6
#define R_T6 7
#define R_T7 8
#define R_S0 9
#define R_S1 10
#define R_S2 11
#define R_S3 12
#define R_S4 13
#define R_S5 14
#define R_S6 15
#define R_A0 16
#define R_A1 17
#define R_A2 18
#define R_A3 19
#define R_A4 20
#define R_A5 21
#define R_T8 22
#define R_T9 23
#define R_T10 24
#define R_T11 25
#define R_RA 26
#define R_T12 27
#define R_SP 30
#define R_ZERO 31
/*
* XXX - The rev id's are defined in <machine/ucontext.h>
*/
#define MC_FMT_OFFSET 73*8 /* offset to format from mcontext */
#define REV0_SIGFRAME 0x0001 /* rev R0 sigcontext format */
#define REV0_TRAPFRAME 0x0002 /* rev R0 trapframe format */
/*
* int _alpha_restore_context(const mcontext_t *mcp,
* intptr_t val, intptr_t *loc);
*
* The format of the context is verified at the beginning.
* Returns -1 if invalid format.
*/
.set noreorder
LEAF(_alpha_restore_context, 3)
LDGP(pv)
bne a0, Lsc1 /* argument null? */
Lscbad: ldiq v0, -1 /* return -1 */
br Lscend
Lsc1: ldq t1, MC_FMT_OFFSET(a0) /* is mcontext valid format? */
ldiq t0, REV0_TRAPFRAME
cmpeq t0, t1, t0 /* is it trapframe format? */
bne t0, Lsc_fp /* if so, check fp state */
ldiq t0, REV0_SIGFRAME
cmpeq t0, t1, t0 /* is it sigcontext format? */
beq t0, Lscbad
/* supposedly sigcontext format, check magic number */
ldiq t0, 0xACEDBADE /* check magic number */
ldq t1, ((R_ZERO + 1) * 8)(a0) /* magic in mc_regs[R_ZERO] */
cmpeq t0, t1, t0
beq t0, Lscbad
/* restore floating point regs first */
Lsc_fp: ldq t0, ((71 + 1) * 8)(a0) /* if FP regs not saved, */
beq t0, Lsc2 /* skip setting FP regs */
ldt $f0, ((37 + 1) * 8)(a0) /* restore FP regs using */
ldt $f1, ((38 + 1) * 8)(a0) /* hw name */
ldt $f2, ((39 + 1) * 8)(a0)
ldt $f3, ((40 + 1) * 8)(a0)
ldt $f4, ((41 + 1) * 8)(a0)
ldt $f5, ((42 + 1) * 8)(a0)
ldt $f6, ((43 + 1) * 8)(a0)
ldt $f7, ((44 + 1) * 8)(a0)
ldt $f8, ((45 + 1) * 8)(a0)
ldt $f9, ((46 + 1) * 8)(a0)
ldt $f10, ((47 + 1) * 8)(a0)
ldt $f11, ((48 + 1) * 8)(a0)
ldt $f12, ((49 + 1) * 8)(a0)
ldt $f13, ((50 + 1) * 8)(a0)
ldt $f14, ((51 + 1) * 8)(a0)
ldt $f15, ((52 + 1) * 8)(a0)
ldt $f16, ((53 + 1) * 8)(a0)
ldt $f17, ((54 + 1) * 8)(a0)
ldt $f18, ((55 + 1) * 8)(a0)
ldt $f19, ((56 + 1) * 8)(a0)
ldt $f20, ((57 + 1) * 8)(a0)
ldt $f21, ((58 + 1) * 8)(a0)
ldt $f22, ((59 + 1) * 8)(a0)
ldt $f23, ((60 + 1) * 8)(a0)
ldt $f24, ((61 + 1) * 8)(a0)
ldt $f25, ((62 + 1) * 8)(a0)
ldt $f26, ((63 + 1) * 8)(a0)
ldt $f27, ((64 + 1) * 8)(a0)
.set noat
ldt $f28, ((65 + 1) * 8)(a0)
.set at
ldt $f29, ((66 + 1) * 8)(a0)
ldt $f30, ((67 + 1) * 8)(a0)
/* $f31 is hardwired zero */
ldt ft0, ((69 + 1) * 8)(a0) /* restore FP control reg */
mt_fpcr ft0
Lsc2: ldiq t0, REV0_SIGFRAME /* check the context format */
ldq t1, MC_FMT_OFFSET(a0) /* again. */
cmpeq t0, t1, t0 /* is it sigcontext format? */
bne t0, Lsc_sc
/* trapframe format */
ldq v0, ((FRAME_V0 + 1) * 8)(a0) /* restore v0 */
ldq t0, ((FRAME_T0 + 1) * 8)(a0) /* restore t0-t7 */
ldq t1, ((FRAME_T1 + 1) * 8)(a0)
ldq t2, ((FRAME_T2 + 1) * 8)(a0)
ldq t3, ((FRAME_T3 + 1) * 8)(a0)
ldq t4, ((FRAME_T4 + 1) * 8)(a0)
ldq t5, ((FRAME_T5 + 1) * 8)(a0)
ldq t6, ((FRAME_T6 + 1) * 8)(a0)
ldq t7, ((FRAME_T7 + 1) * 8)(a0)
ldq s0, ((FRAME_S0 + 1) * 8)(a0) /* restore s0-s6 */
ldq s1, ((FRAME_S1 + 1) * 8)(a0)
ldq s2, ((FRAME_S2 + 1) * 8)(a0)
ldq s3, ((FRAME_S3 + 1) * 8)(a0)
ldq s4, ((FRAME_S4 + 1) * 8)(a0)
ldq s5, ((FRAME_S5 + 1) * 8)(a0)
ldq s6, ((FRAME_S6 + 1) * 8)(a0)
ldq a4, ((FRAME_A4 + 1) * 8)(a0) /* restore a4, a5 */
ldq a5, ((FRAME_A5 + 1) * 8)(a0)
ldq ra, ((FRAME_RA + 1) * 8)(a0)
ldq sp, ((FRAME_SP + 1) * 8)(a0)
subq sp, 16, sp /* save room on stack */
ldq a3, ((FRAME_TRAPARG_A1 + 1) * 8)(a0)
stq a3, 0(a0) /* save a1 on stack */
ldq a3, ((FRAME_TRAPARG_A2 + 1) * 8)(a0)
stq a3, 8(a0) /* save a2 on stack */
.set noat
ldq at_reg, ((FRAME_PC + 1) * 8)(a0) /* PC at time of trap? */
.set at
ldq a3, ((FRAME_A3 + 1) * 8)(a0) /* restore a3 */
ldq a0, ((FRAME_TRAPARG_A0 + 1) * 8)(a0) /* restore a0 */
br Lsc3
Lsc_sc: /* sigcontext format */
ldq v0, ((R_V0 + 1) * 8)(a0) /* restore v0 */
ldq t0, ((R_T0 + 1) * 8)(a0) /* restore t0-t7 */
ldq t1, ((R_T1 + 1) * 8)(a0)
ldq t2, ((R_T2 + 1) * 8)(a0)
ldq t3, ((R_T3 + 1) * 8)(a0)
ldq t4, ((R_T4 + 1) * 8)(a0)
ldq t5, ((R_T5 + 1) * 8)(a0)
ldq t6, ((R_T6 + 1) * 8)(a0)
ldq t7, ((R_T7 + 1) * 8)(a0)
ldq s0, ((R_S0 + 1) * 8)(a0) /* restore s0-s6 */
ldq s1, ((R_S1 + 1) * 8)(a0)
ldq s2, ((R_S2 + 1) * 8)(a0)
ldq s3, ((R_S3 + 1) * 8)(a0)
ldq s4, ((R_S4 + 1) * 8)(a0)
ldq s5, ((R_S5 + 1) * 8)(a0)
ldq s6, ((R_S6 + 1) * 8)(a0)
ldq a4, ((R_A4 + 1) * 8)(a0) /* restore a4, a5 */
ldq a5, ((R_A5 + 1) * 8)(a0)
ldq ra, ((R_RA + 1) * 8)(a0)
ldq sp, ((R_SP + 1) * 8)(a0)
subq sp, 16, sp /* save room on stack */
ldq a3, ((R_A1 + 1) * 8)(a0) /* get a1 */
stq a3, 0(a0) /* save a1 on stack */
ldq a3, ((R_A2 + 1) * 8)(a0) /* get a2 */
stq a3, 8(a0) /* save a2 on stack */
ldq a3, ((R_A3 + 1) * 8)(a0) /* restore a3 */
ldq a0, ((R_A0 + 1) * 8)(a0) /* restore a0 */
Lsc3: beq a2, Lsc4
stq a1, 0(a2)
Lsc4: ldq a1, 0(sp) /* restore a1, a2 */
ldq a2, 8(sp)
addq sp, 16, sp /* restore stack */
Lscend: RET
END(_alpha_restore_context)
/*
* int _alpha_save_context(mcontext_t *);
*
* Always save in trapframe format. Floating point registers are
* saved but may be optimized away later (see comments below).
*/
LEAF(_alpha_save_context, 1)
LDGP(pv)
bne a0, Lgc1 /* argument null? */
ldiq v0, -1 /* return -1 */
br Lgcend
Lgc1: ldiq v0, 1 /* save_context returns 1, */
stq v0, ((FRAME_V0 + 1) * 8)(a0) /* so save 1 in v0 */
stq t0, ((FRAME_T0 + 1) * 8)(a0) /* save t0-t7 */
stq t1, ((FRAME_T1 + 1) * 8)(a0)
stq t2, ((FRAME_T2 + 1) * 8)(a0)
stq t3, ((FRAME_T3 + 1) * 8)(a0)
stq t4, ((FRAME_T4 + 1) * 8)(a0)
stq t5, ((FRAME_T5 + 1) * 8)(a0)
stq t6, ((FRAME_T6 + 1) * 8)(a0)
stq t7, ((FRAME_T7 + 1) * 8)(a0)
stq s0, ((FRAME_S0 + 1) * 8)(a0) /* save s0-s6 */
stq s1, ((FRAME_S1 + 1) * 8)(a0)
stq s2, ((FRAME_S2 + 1) * 8)(a0)
stq s3, ((FRAME_S3 + 1) * 8)(a0)
stq s4, ((FRAME_S4 + 1) * 8)(a0)
stq s5, ((FRAME_S5 + 1) * 8)(a0)
stq s6, ((FRAME_S6 + 1) * 8)(a0)
stq a0, ((FRAME_TRAPARG_A0 + 1) * 8)(a0) /* save a0-a5 */
stq a1, ((FRAME_TRAPARG_A1 + 1) * 8)(a0)
stq a2, ((FRAME_TRAPARG_A2 + 1) * 8)(a0)
stq a3, ((FRAME_A3 + 1) * 8)(a0)
stq a4, ((FRAME_A4 + 1) * 8)(a0)
stq a5, ((FRAME_A5 + 1) * 8)(a0)
stq ra, ((FRAME_RA + 1) * 8)(a0)
stq sp, ((FRAME_SP + 1) * 8)(a0)
ldiq t0, REV0_TRAPFRAME /* store trapframe format in */
stq t0, MC_FMT_OFFSET(a0) /* ucp->uc-rev */
/*
* XXX - Do we really need to save floating point registers?
*
* This is an explicit call to get the current context, so
* shouldn't the caller be done with the floating point registers?
* Contexts formed by involuntary switches, such as signal delivery,
* should have floating point registers saved by the kernel.
*/
#if 1
stq zero, ((71 + 1) * 8)(a0) /* FP regs are not saved */
#else
ldiq t0, 1 /* say we've used FP, */
stq t0, ((71 + 1) * 8)(a0) /* mc_ownedfp = 1 */
stt $f0, ((37 + 1) * 8)(a0) /* save first register, using */
stt $f1, ((38 + 1) * 8)(a0) /* hw name etc. */
stt $f2, ((39 + 1) * 8)(a0)
stt $f3, ((40 + 1) * 8)(a0)
stt $f4, ((41 + 1) * 8)(a0)
stt $f5, ((42 + 1) * 8)(a0)
stt $f6, ((43 + 1) * 8)(a0)
stt $f7, ((44 + 1) * 8)(a0)
stt $f8, ((45 + 1) * 8)(a0)
stt $f9, ((46 + 1) * 8)(a0)
stt $f10, ((47 + 1) * 8)(a0)
stt $f11, ((48 + 1) * 8)(a0)
stt $f12, ((49 + 1) * 8)(a0)
stt $f13, ((50 + 1) * 8)(a0)
stt $f14, ((51 + 1) * 8)(a0)
stt $f15, ((52 + 1) * 8)(a0)
stt $f16, ((53 + 1) * 8)(a0)
stt $f17, ((54 + 1) * 8)(a0)
stt $f18, ((55 + 1) * 8)(a0)
stt $f19, ((56 + 1) * 8)(a0)
stt $f20, ((57 + 1) * 8)(a0)
stt $f21, ((58 + 1) * 8)(a0)
stt $f22, ((59 + 1) * 8)(a0)
stt $f23, ((60 + 1) * 8)(a0)
stt $f24, ((61 + 1) * 8)(a0)
stt $f25, ((62 + 1) * 8)(a0)
stt $f26, ((63 + 1) * 8)(a0)
stt $f27, ((64 + 1) * 8)(a0)
.set noat
stt $f28, ((65 + 1) * 8)(a0)
.set at
stt $f29, ((66 + 1) * 8)(a0)
stt $f30, ((67 + 1) * 8)(a0)
/* $f31 is hardwired zero */
#endif
mf_fpcr ft0 /* get FP control reg */
stt ft0, ((69 + 1) * 8)(a0) /* and store it in mc_fpcr */
stq zero, ((70 + 1) * 8)(a0) /* FP software control XXX */
mov zero, v0 /* return zero */
Lgcend: RET
END(_alpha_save_context)

View File

@ -1,42 +0,0 @@
/*
* Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of the author 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 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.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
/*
* _alpha_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
* long stacksz);
*/
LEAF(_alpha_enter_uts, 4)
addq a2, a3, a2
ldiq a3, ~0xf
and a2, a3, a2
mov a2, sp
mov a1, ra
mov a1, t12
RET
END(_alpha_enter_uts)

View File

@ -1,76 +0,0 @@
/*
* Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of the author 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 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <strings.h>
#include "pthread_md.h"
/*
* The constructors.
*/
struct tcb *
_tcb_ctor(struct pthread *thread, int initial)
{
struct tcb *tcb;
if ((tcb = malloc(sizeof(struct tcb))) != NULL) {
bzero(tcb, sizeof(struct tcb));
tcb->tcb_thread = thread;
/* Allocate TDV */
}
return (tcb);
}
void
_tcb_dtor(struct tcb *tcb)
{
/* Free TDV */
free(tcb);
}
struct kcb *
_kcb_ctor(struct kse *kse)
{
struct kcb *kcb;
if ((kcb = malloc(sizeof(struct kcb))) != NULL) {
bzero(kcb, sizeof(struct kcb));
kcb->kcb_faketcb.tcb_isfake = 1;
kcb->kcb_faketcb.tcb_tmbx.tm_flags = TMF_NOUPCALL;
kcb->kcb_curtcb = &kcb->kcb_faketcb;
kcb->kcb_kse = kse;
}
return (kcb);
}
void
_kcb_dtor(struct kcb *kcb)
{
free(kcb);
}

View File

@ -1,75 +0,0 @@
/*-
* Copyright (c) 2003 Daniel Eischen <deischen@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of the author 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 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$
*/
#ifndef _ATOMIC_OPS_H_
#define _ATOMIC_OPS_H_
/*
* Atomic swap:
* Atomic (tmp = *dst, *dst = val), then *res = tmp
*
* void atomic_swap_long(long *dst, long val, long *res);
*/
static inline void
atomic_swap_long(long *dst, long val, long *res)
{
/* $1 and $2 are t0 and t1 respectively. */
__asm __volatile (
" ldq $1, %1\n" /* get cache line before lock */
"1: ldq_l $1, %1\n" /* load *dst asserting lock */
" mov %2, $2\n" /* save value to be swapped */
" stq_c $2, %1\n" /* attempt the store; $2 clobbered */
" beq $2, 1b\n" /* it didn't work, loop */
" stq $1, %0\n" /* save value of *dst in *res */
" mb \n"
: "+m"(*res)
: "m"(*dst), "r"(val)
: "memory", "$1", "$2"); /* clobber t0 and t1 */
}
static inline void
atomic_swap_int(int *dst, int val, int *res)
{
/* $1 and $2 are t0 and t1 respectively. */
__asm __volatile (
" ldl $1, %1\n" /* get cache line before lock */
"1: ldl_l $1, %1\n" /* load *dst asserting lock */
" mov %2, $2\n" /* save value to be swapped */
" stl_c $2, %1\n" /* attempt the store; $2 clobbered */
" beq $2, 1b\n" /* it didn't work, loop */
" stl $1, %0\n" /* save value of *dst in *res */
" mb \n"
: "+m"(*res)
: "m"(*dst), "r"(val)
: "memory", "$1", "$2"); /* clobber t0 and t1 */
}
#define atomic_swap_ptr(d, v, r) \
atomic_swap_long((long *)(d), (long)(v), (long *)(r))
#endif

View File

@ -1,247 +0,0 @@
/*
* 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$
*/
#ifndef _PTHREAD_MD_H_
#define _PTHREAD_MD_H_
#include <sys/kse.h>
#include <stddef.h>
#include <ucontext.h>
#define KSE_STACKSIZE 16384
#define DTV_OFFSET offsetof(struct tcb, tcb_tp.tp_tdv)
#define THR_GETCONTEXT(ucp) _alpha_save_context(&(ucp)->uc_mcontext)
#define THR_SETCONTEXT(ucp) PANIC("THR_SETCONTEXT() now in use!\n")
#define PER_THREAD
struct kcb;
struct kse;
struct pthread;
struct tcb;
struct tdv; /* We don't know what this is yet? */
/*
* tp points to one of these. We define the static TLS as an array
* of long double to enforce 16-byte alignment of the TLS memory,
* struct alpha_tp, struct tcb and also struct kcb. Both static and
* dynamic allocation of any of these structures will result in a
* valid, well-aligned thread pointer.
*/
struct alpha_tp {
struct tdv *tp_tdv; /* dynamic TLS */
uint64_t _reserved_;
long double tp_tls[0]; /* static TLS */
};
struct tcb {
struct kse_thr_mailbox tcb_tmbx;
struct pthread *tcb_thread;
struct kcb *tcb_curkcb;
long tcb_isfake;
struct alpha_tp tcb_tp;
};
struct kcb {
struct kse_mailbox kcb_kmbx;
struct tcb kcb_faketcb;
struct tcb *kcb_curtcb;
struct kse *kcb_kse;
};
#define _tp __builtin_thread_pointer()
#define _tcb ((struct tcb*)((char*)(_tp) - offsetof(struct tcb, tcb_tp)))
/*
* The kcb and tcb constructors.
*/
struct tcb *_tcb_ctor(struct pthread *, int);
void _tcb_dtor(struct tcb *);
struct kcb *_kcb_ctor(struct kse *kse);
void _kcb_dtor(struct kcb *);
/* Called from the KSE to set its private data. */
static __inline void
_kcb_set(struct kcb *kcb)
{
/* There is no thread yet; use the fake tcb. */
__builtin_set_thread_pointer(&kcb->kcb_faketcb.tcb_tp);
}
/*
* Get the current kcb.
*
* This can only be called while in a critical region; don't
* worry about having the kcb changed out from under us.
*/
static __inline struct kcb *
_kcb_get(void)
{
return (_tcb->tcb_curkcb);
}
/*
* Enter a critical region.
*
* Read and clear km_curthread in the kse mailbox.
*/
static __inline struct kse_thr_mailbox *
_kcb_critical_enter(void)
{
struct kse_thr_mailbox *crit;
uint32_t flags;
if (_tcb->tcb_isfake != 0) {
/*
* We already are in a critical region since
* there is no current thread.
*/
crit = NULL;
} else {
flags = _tcb->tcb_tmbx.tm_flags;
_tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
crit = _tcb->tcb_curkcb->kcb_kmbx.km_curthread;
_tcb->tcb_curkcb->kcb_kmbx.km_curthread = NULL;
_tcb->tcb_tmbx.tm_flags = flags;
}
return (crit);
}
static __inline void
_kcb_critical_leave(struct kse_thr_mailbox *crit)
{
/* No need to do anything if this is a fake tcb. */
if (_tcb->tcb_isfake == 0)
_tcb->tcb_curkcb->kcb_kmbx.km_curthread = crit;
}
static __inline int
_kcb_in_critical(void)
{
uint32_t flags;
int ret;
if (_tcb->tcb_isfake != 0) {
/*
* We are in a critical region since there is no
* current thread.
*/
ret = 1;
} else {
flags = _tcb->tcb_tmbx.tm_flags;
_tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
ret = (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
_tcb->tcb_tmbx.tm_flags = flags;
}
return (ret);
}
static __inline void
_tcb_set(struct kcb *kcb, struct tcb *tcb)
{
if (tcb == NULL)
tcb = &kcb->kcb_faketcb;
kcb->kcb_curtcb = tcb;
tcb->tcb_curkcb = kcb;
__builtin_set_thread_pointer(&tcb->tcb_tp);
}
static __inline struct tcb *
_tcb_get(void)
{
return (_tcb);
}
static __inline struct pthread *
_get_curthread(void)
{
return (_tcb->tcb_thread);
}
/*
* Get the current kse.
*
* Like _kcb_get(), this can only be called while in a critical region.
*/
static __inline struct kse *
_get_curkse(void)
{
return (_tcb->tcb_curkcb->kcb_kse);
}
void _alpha_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
size_t stacksz);
int _alpha_restore_context(mcontext_t *mc, intptr_t val, intptr_t *loc);
int _alpha_save_context(mcontext_t *mc);
static __inline int
_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
{
if (_alpha_save_context(&tcb->tcb_tmbx.tm_context.uc_mcontext) == 0) {
/* Make the fake tcb the current thread. */
kcb->kcb_curtcb = &kcb->kcb_faketcb;
__builtin_set_thread_pointer(&kcb->kcb_faketcb.tcb_tp);
_alpha_enter_uts(&kcb->kcb_kmbx, kcb->kcb_kmbx.km_func,
kcb->kcb_kmbx.km_stack.ss_sp,
kcb->kcb_kmbx.km_stack.ss_size);
/* We should not reach here. */
return (-1);
}
return (0);
}
static __inline int
_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
{
extern int _libkse_debug;
_tcb_set(kcb, tcb);
if (_libkse_debug == 0) {
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
if (setmbox != 0)
_alpha_restore_context(
&tcb->tcb_tmbx.tm_context.uc_mcontext,
(intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_alpha_restore_context(
&tcb->tcb_tmbx.tm_context.uc_mcontext,
0, NULL);
} else {
if (setmbox)
kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
else
kse_switchin(&tcb->tcb_tmbx, 0);
}
/* We should not reach here. */
return (-1);
}
#endif /* _PTHREAD_MD_H_ */

View File

@ -15,9 +15,6 @@ MAN= libstand.3
CFLAGS+= -ffreestanding -Wformat
CFLAGS+= -I${.CURDIR}
.if ${MACHINE_ARCH} == "alpha"
CFLAGS+= -mno-fp-regs
.endif
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
CFLAGS+= -mpreferred-stack-boundary=2
CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2
@ -57,53 +54,6 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.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
.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
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} == "ia64"
.PATH: ${.CURDIR}/../libc/ia64/string
SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \

View File

@ -1,120 +0,0 @@
/* $NetBSD: _setjmp.S,v 1.2 1996/10/17 03:08:03 cgd Exp $ */
/* $FreeBSD$ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v)" from
* the last call to
* _setjmp(a)
* by restoring registers from the stack,
* The previous signal state is NOT restored.
*/
.set noreorder
LEAF(_setjmp, 1)
LDGP(pv)
stq ra, (2 * 8)(a0) /* sc_pc = return address */
stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
stq s1, ((10 + 4) * 8)(a0)
stq s2, ((11 + 4) * 8)(a0)
stq s3, ((12 + 4) * 8)(a0)
stq s4, ((13 + 4) * 8)(a0)
stq s5, ((14 + 4) * 8)(a0)
stq s6, ((15 + 4) * 8)(a0)
stq ra, ((26 + 4) * 8)(a0)
stq sp, ((30 + 4) * 8)(a0)
ldiq t0, 0xacedbadd /* sigcontext magic number */
stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */
/* Too bad we can't check if we actually used FP */
ldiq t0, 1
stq t0, (36 * 8)(a0) /* say we've used FP. */
#if 0
stt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */
stt fs1, ((3 + 37) * 8)(a0)
stt fs2, ((4 + 37) * 8)(a0)
stt fs3, ((5 + 37) * 8)(a0)
stt fs4, ((6 + 37) * 8)(a0)
stt fs5, ((7 + 37) * 8)(a0)
stt fs6, ((8 + 37) * 8)(a0)
stt fs7, ((9 + 37) * 8)(a0)
mf_fpcr ft0 /* get FP control reg */
stt ft0, (69 * 8)(a0) /* and store it in sc_fpcr */
stq zero, (70 * 8)(a0) /* FP software control XXX */
#endif
stq zero, (71 * 8)(a0) /* sc_reserved[0] */
stq zero, (72 * 8)(a0) /* sc_reserved[1] */
stq zero, (73 * 8)(a0) /* sc_xxx[0] */
stq zero, (74 * 8)(a0) /* sc_xxx[1] */
stq zero, (75 * 8)(a0) /* sc_xxx[2] */
stq zero, (76 * 8)(a0) /* sc_xxx[3] */
stq zero, (77 * 8)(a0) /* sc_xxx[4] */
stq zero, (78 * 8)(a0) /* sc_xxx[5] */
stq zero, (79 * 8)(a0) /* sc_xxx[6] */
stq zero, (80 * 8)(a0) /* sc_xxx[7] */
mov zero, v0 /* return zero */
RET
END(_setjmp)
LEAF(_longjmp, 2)
LDGP(pv)
ldq ra, (2 * 8)(a0) /* sc_pc = return address */
ldq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
ldq s1, ((10 + 4) * 8)(a0)
ldq s2, ((11 + 4) * 8)(a0)
ldq s3, ((12 + 4) * 8)(a0)
ldq s4, ((13 + 4) * 8)(a0)
ldq s5, ((14 + 4) * 8)(a0)
ldq s6, ((15 + 4) * 8)(a0)
/* ldq ra, ((26 + 4) * 8)(a0) set above */
ldq sp, ((30 + 4) * 8)(a0)
#if 0
ldt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */
ldt fs1, ((3 + 37) * 8)(a0)
ldt fs2, ((4 + 37) * 8)(a0)
ldt fs3, ((5 + 37) * 8)(a0)
ldt fs4, ((6 + 37) * 8)(a0)
ldt fs5, ((7 + 37) * 8)(a0)
ldt fs6, ((8 + 37) * 8)(a0)
ldt fs7, ((9 + 37) * 8)(a0)
ldt ft0, (69 * 8)(a0) /* get sc_fpcr */
mt_fpcr ft0 /* and restore it. */
#endif
mov a1, v0 /* return second arg */
RET
END(_longjmp)

View File

@ -8,7 +8,7 @@
# (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the
# system call stubs.
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
.if ${MACHINE_ARCH} == "sparc64"
SHLIBDIR?= /lib
.endif
@ -42,7 +42,7 @@ PRECIOUSLIB=
.include "${.CURDIR}/sys/Makefile.inc"
.include "${.CURDIR}/thread/Makefile.inc"
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
.if ${MACHINE_ARCH} == "sparc64"
SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
.if !defined(NO_PIC)
SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so

View File

@ -1,5 +0,0 @@
# $FreeBSD$
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
SRCS+= pthread_md.c

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of the author 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 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$
*/
#include <stdlib.h>
#include <string.h>
#include "pthread_md.h"
/*
* The constructors.
*/
struct tcb *
_tcb_ctor(struct pthread *thread, int initial)
{
struct tcb *tcb;
if ((tcb = malloc(sizeof(struct tcb))) != NULL) {
memset(tcb, 0, sizeof(struct tcb));
tcb->tcb_thread = thread;
}
return (tcb);
}
void
_tcb_dtor(struct tcb *tcb)
{
free(tcb);
}

View File

@ -1,75 +0,0 @@
/*
* 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$
*/
#ifndef _PTHREAD_MD_H_
#define _PTHREAD_MD_H_
#include <stddef.h>
#include <sys/types.h>
#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
/*
* Variant I tcb. The structure layout is fixed, don't blindly
* change it!
*/
struct tcb {
void *tcb_dtv;
struct pthread *tcb_thread;
};
#define _tp __builtin_thread_pointer()
#define _tcb ((struct tcb *)_tp)
struct tcb *_tcb_ctor(struct pthread *, int);
void _tcb_dtor(struct tcb *);
/* Called from the thread to set its private data. */
static __inline void
_tcb_set(struct tcb *tcb)
{
__builtin_set_thread_pointer(tcb);
}
static __inline struct tcb *
_tcb_get(void)
{
return (_tcb);
}
extern struct pthread *_thr_initial;
static __inline struct pthread *
_get_curthread(void)
{
if (_thr_initial)
return (_tcb->tcb_thread);
return (NULL);
}
#endif /* _PTHREAD_MD_H_ */

View File

@ -1,11 +0,0 @@
# $FreeBSD$
ARCH_SRCS = s_copysign.S s_copysignf.S
LDBL_PREC = 53
SYM_MAPS += ${.CURDIR}/alpha/Symbol.map
# XXX Comment from NetBSD/Alpha:
# XXX LINT SIGFPEs in e_exp.c's strtod(). FP underflow/denorm software
# handling is broken (doesn't exist!) on the Alpha port.
# Stock gcc 2.7.2.1 doesn't understand these options.
#CFLAGS += -mtrap-precision=i -mfp-trap-mode=su

View File

@ -1,13 +0,0 @@
# $FreeBSD$
FBSD_1.0 {
fegetenv;
feholdexcept;
fesetenv;
feupdateenv;
__feenableexcept;
__fedisableexcept;
__fegetexcept;
feenableexcept;
fedisableexcept;
fegetexcept;
};

View File

@ -1,144 +0,0 @@
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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$
*/
#include <sys/cdefs.h>
#include <machine/sysarch.h>
#include <fenv.h>
const fenv_t __fe_dfl_env = 0x680e000000000000ULL;
struct mask_args {
fenv_t mask;
};
/*
* The lower 49 bits of the FPCR are unused by the hardware, so we use
* the lower order bits to store the kernel's idea of the FP mask as
* described in the Alpha Architecture Manual.
*/
int
fegetenv(fenv_t *envp)
{
struct mask_args p;
union __fpcr r;
/*
* The syscall acts as an implicit exception barrier, so we
* only need to issue an excb after the mf_fpcr to ensure that
* the read is executed before any subsequent FP ops.
*/
sysarch(ALPHA_GET_FPMASK, (char *)&p);
__mf_fpcr(&r.__d);
*envp = r.__bits | p.mask;
__excb();
return (0);
}
int
feholdexcept(fenv_t *envp)
{
struct mask_args p;
union __fpcr r;
sysarch(ALPHA_GET_FPMASK, (char *)&p);
__mf_fpcr(&r.__d);
*envp = r.__bits | p.mask;
r.__bits &= ~((fenv_t)FE_ALL_EXCEPT << _FPUSW_SHIFT);
__mt_fpcr(r.__d);
if (p.mask & FE_ALL_EXCEPT) {
p.mask = 0;
sysarch(ALPHA_SET_FPMASK, &p);
}
__excb();
return (0);
}
int
fesetenv(const fenv_t *envp)
{
struct mask_args p;
union __fpcr r;
p.mask = *envp & FE_ALL_EXCEPT;
sysarch(ALPHA_SET_FPMASK, &p);
r.__bits = *envp & ~FE_ALL_EXCEPT;
__mt_fpcr(r.__d);
__excb();
return (0);
}
int
feupdateenv(const fenv_t *envp)
{
struct mask_args p;
union __fpcr oldr, newr;
p.mask = *envp & FE_ALL_EXCEPT;
sysarch(ALPHA_SET_FPMASK, &p);
__mf_fpcr(&oldr.__d);
newr.__bits = *envp & ~FE_ALL_EXCEPT;
__excb();
__mt_fpcr(newr.__d);
feraiseexcept((oldr.__bits >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
return (0);
}
int
__feenableexcept(int mask)
{
struct mask_args p;
sysarch(ALPHA_GET_FPMASK, &p);
p.mask |= (mask & FE_ALL_EXCEPT);
sysarch(ALPHA_SET_FPMASK, &p);
return (p.mask);
}
int
__fedisableexcept(int mask)
{
struct mask_args p;
sysarch(ALPHA_GET_FPMASK, &p);
p.mask &= ~(mask & FE_ALL_EXCEPT);
sysarch(ALPHA_SET_FPMASK, &p);
return (p.mask);
}
int
__fegetexcept(void)
{
struct mask_args p;
sysarch(ALPHA_GET_FPMASK, &p);
return (p.mask);
}
__weak_reference(__feenableexcept, feenableexcept);
__weak_reference(__fedisableexcept, fedisableexcept);
__weak_reference(__fegetexcept, fegetexcept);

View File

@ -1,185 +0,0 @@
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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$
*/
#ifndef _FENV_H_
#define _FENV_H_
#include <sys/_types.h>
typedef __uint64_t fenv_t;
typedef __uint16_t fexcept_t;
/* Exception flags */
#define FE_INVALID 0x02
#define FE_DIVBYZERO 0x04
#define FE_OVERFLOW 0x08
#define FE_UNDERFLOW 0x10
#define FE_INEXACT 0x20
#define FE_INTOVF 0x40 /* not maskable */
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INTOVF | \
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
/* Rounding modes */
#define FE_TOWARDZERO 0x00
#define FE_DOWNWARD 0x01
#define FE_TONEAREST 0x02
#define FE_UPWARD 0x03
#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
FE_UPWARD | FE_TOWARDZERO)
#define _ROUND_SHIFT 58
#define _FPUSW_SHIFT 51
#define __excb() __asm __volatile("excb")
#define __mf_fpcr(__cw) __asm __volatile("mf_fpcr %0" : "=f" (*(__cw)))
#define __mt_fpcr(__cw) __asm __volatile("mt_fpcr %0" : : "f" (__cw))
union __fpcr {
double __d;
fenv_t __bits;
};
__BEGIN_DECLS
/* Default floating-point environment */
extern const fenv_t __fe_dfl_env;
#define FE_DFL_ENV (&__fe_dfl_env)
static __inline int
feclearexcept(int __excepts)
{
union __fpcr __r;
__excb();
__mf_fpcr(&__r.__d);
__r.__bits &= ~((fenv_t)__excepts << _FPUSW_SHIFT);
__mt_fpcr(__r.__d);
__excb();
return (0);
}
static __inline int
fegetexceptflag(fexcept_t *__flagp, int __excepts)
{
union __fpcr __r;
__excb();
__mf_fpcr(&__r.__d);
__excb();
*__flagp = (__r.__bits >> _FPUSW_SHIFT) & __excepts;
return (0);
}
static __inline int
fesetexceptflag(const fexcept_t *__flagp, int __excepts)
{
union __fpcr __r;
fenv_t __xflag, __xexcepts;
__xflag = (fenv_t)*__flagp << _FPUSW_SHIFT;
__xexcepts = (fenv_t)__excepts << _FPUSW_SHIFT;
__excb();
__mf_fpcr(&__r.__d);
__r.__bits &= ~__xexcepts;
__r.__bits |= __xflag & __xexcepts;
__mt_fpcr(__r.__d);
__excb();
return (0);
}
static __inline int
feraiseexcept(int __excepts)
{
/*
* XXX Generating exceptions this way does not actually invoke
* a userland trap handler when enabled, but neither do
* arithmetic operations as far as I can tell. Perhaps there
* are more bugs in the kernel trap handler.
*/
fexcept_t __ex = __excepts;
fesetexceptflag(&__ex, __excepts);
return (0);
}
static __inline int
fetestexcept(int __excepts)
{
union __fpcr __r;
__excb();
__mf_fpcr(&__r.__d);
__excb();
return ((__r.__bits >> _FPUSW_SHIFT) & __excepts);
}
static __inline int
fegetround(void)
{
union __fpcr __r;
/*
* No exception barriers should be required here if we assume
* that only fesetround() can change the rounding mode.
*/
__mf_fpcr(&__r.__d);
return ((int)(__r.__bits >> _ROUND_SHIFT) & _ROUND_MASK);
}
static __inline int
fesetround(int __round)
{
union __fpcr __r;
if (__round & ~_ROUND_MASK)
return (-1);
__excb();
__mf_fpcr(&__r.__d);
__r.__bits &= ~((fenv_t)_ROUND_MASK << _ROUND_SHIFT);
__r.__bits |= (fenv_t)__round << _ROUND_SHIFT;
__mt_fpcr(__r.__d);
__excb();
return (0);
}
int fegetenv(fenv_t *__envp);
int feholdexcept(fenv_t *__envp);
int fesetenv(const fenv_t *__envp);
int feupdateenv(const fenv_t *__envp);
#if __BSD_VISIBLE
int feenableexcept(int __mask);
int fedisableexcept(int __mask);
int fegetexcept(void);
#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* !_FENV_H_ */

View File

@ -1,45 +0,0 @@
/* $FreeBSD$ */
/* From: NetBSD: s_copysign.S,v 1.3 1997/07/30 23:58:38 jtc Exp */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by J.T. Conklin.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
LEAF(copysign, 2)
cpys fa1, fa0, fv0
RET
END(copysign)

View File

@ -1,45 +0,0 @@
/* $FreeBSD$ */
/* From: NetBSD: s_copysignf.S,v 1.3 1997/07/30 23:58:41 jtc Exp */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by J.T. Conklin.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
LEAF(copysignf, 2)
cpys fa1, fa0, fv0
RET
END(copysignf)

View File

@ -1,4 +0,0 @@
# $FreeBSD$
CFLAGS+= -mno-fp-regs
LDFLAGS+= -Wl,--script,${.CURDIR}/alpha/ld.so.script

View File

@ -1,135 +0,0 @@
/* $NetBSD: ld.so.script,v 1.2 2001/12/13 20:31:31 thorpej Exp $ */
/* $FreeBSD$ */
OUTPUT_FORMAT("elf64-alpha-freebsd", "elf64-alpha-freebsd",
"elf64-alpha-freebsd")
OUTPUT_ARCH(alpha)
ENTRY(__start)
/* SEARCH_DIR(/usr/lib); JRT */
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0 + SIZEOF_HEADERS;
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.text :
{ *(.rel.text) *(.rel.gnu.linkonce.t*) }
.rela.text :
{ *(.rela.text) *(.rela.gnu.linkonce.t*) }
.rel.data :
{ *(.rel.data) *(.rel.gnu.linkonce.d*) }
.rela.data :
{ *(.rela.data) *(.rela.gnu.linkonce.d*) }
.rel.rodata :
{ *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
.rela.rodata :
{ *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) } =0x47ff041f
.text :
{
*(.text)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
} =0x47ff041f
_etext = .;
PROVIDE (etext = .);
.fini : { *(.fini) } =0x47ff041f
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
.reginfo : { *(.reginfo) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN(0x100000) + (. & (0x100000 - 1));
.data :
{
*(.data)
*(.gnu.linkonce.d*)
CONSTRUCTORS
}
.data1 : { *(.data1) }
.ctors :
{
*(.ctors)
}
.dtors :
{
*(.dtors)
}
.plt : { *(.plt) }
.got : { *(.got.plt) *(.got) }
PROVIDE (_GOT_END_ = .);
.dynamic : { *(.dynamic) }
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata : { *(.sdata) }
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.sbss : { *(.sbss) *(.scommon) }
.bss :
{
*(.dynbss)
*(.bss)
*(COMMON)
}
. = ALIGN(64 / 8);
_end = . ;
PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* These must appear regardless of . */
}

View File

@ -1,531 +0,0 @@
/*-
* Copyright 1996, 1997, 1998, 1999 John D. Polstra.
* 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$
*/
/*
* Dynamic linker for ELF.
*
* John Polstra <jdp@polstra.com>.
*/
#include <sys/param.h>
#include <sys/mman.h>
#include <dlfcn.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "debug.h"
#include "rtld.h"
extern Elf_Dyn _GOT_END_;
/*
* Macros for loading/storing unaligned 64-bit values. These are
* needed because relocations can point to unaligned data. This
* occurs in the DWARF2 exception frame tables generated by the
* compiler, for instance.
*
* We don't use these when relocating jump slots and GOT entries,
* since they are guaranteed to be aligned.
*/
struct ualong {
Elf_Addr x __attribute__((packed));
};
#define load64(p) (((struct ualong *)(p))->x)
#define store64(p,v) (((struct ualong *)(p))->x = (v))
/* Relocate a non-PLT object with addend. */
static int
reloc_non_plt_obj(Obj_Entry *obj_rtld, Obj_Entry *obj, const Elf_Rela *rela,
SymCache *cache)
{
Elf_Addr *where = (Elf_Addr *) (obj->relocbase + rela->r_offset);
switch (ELF_R_TYPE(rela->r_info)) {
case R_ALPHA_NONE:
break;
case R_ALPHA_REFQUAD: {
const Elf_Sym *def;
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj,
&defobj, false, cache);
if (def == NULL)
return -1;
store64(where,
(Elf_Addr) (defobj->relocbase + def->st_value) +
load64(where) + rela->r_addend);
}
break;
case R_ALPHA_GLOB_DAT: {
const Elf_Sym *def;
const Obj_Entry *defobj;
Elf_Addr val;
def = find_symdef(ELF_R_SYM(rela->r_info), obj,
&defobj, false, cache);
if (def == NULL)
return -1;
val = (Elf_Addr) (defobj->relocbase + def->st_value +
rela->r_addend);
if (load64(where) != val)
store64(where, val);
}
break;
case R_ALPHA_RELATIVE: {
if (obj != obj_rtld ||
(caddr_t)where < (caddr_t)_GLOBAL_OFFSET_TABLE_ ||
(caddr_t)where >= (caddr_t)&_GOT_END_)
store64(where,
load64(where) + (Elf_Addr) obj->relocbase);
}
break;
case R_ALPHA_COPY: {
/*
* These are deferred until all other relocations
* have been done. All we do here is make sure
* that the COPY relocation is not in a shared
* library. They are allowed only in executable
* files.
*/
if (!obj->mainprog) {
_rtld_error("%s: Unexpected R_COPY "
" relocation in shared library",
obj->path);
return -1;
}
}
break;
default:
_rtld_error("%s: Unsupported relocation type %u"
" in non-PLT relocations\n", obj->path,
(unsigned int)ELF_R_TYPE(rela->r_info));
return -1;
}
return(0);
}
/* Process the non-PLT relocations. */
int
reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
{
const Elf_Rel *rellim;
const Elf_Rel *rel;
const Elf_Rela *relalim;
const Elf_Rela *rela;
SymCache *cache;
int bytes = obj->nchains * sizeof(SymCache);
int r = -1;
/*
* The dynamic loader may be called from a thread, we have
* limited amounts of stack available so we cannot use alloca().
*/
cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
if (cache == MAP_FAILED)
cache = NULL;
/* Perform relocations without addend if there are any: */
rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize);
for (rel = obj->rel; obj->rel != NULL && rel < rellim; rel++) {
Elf_Rela locrela;
locrela.r_info = rel->r_info;
locrela.r_offset = rel->r_offset;
locrela.r_addend = 0;
if (reloc_non_plt_obj(obj_rtld, obj, &locrela, cache))
goto done;
}
/* Perform relocations with addend if there are any: */
relalim = (const Elf_Rela *) ((caddr_t) obj->rela + obj->relasize);
for (rela = obj->rela; obj->rela != NULL && rela < relalim; rela++) {
if (reloc_non_plt_obj(obj_rtld, obj, rela, cache))
goto done;
}
r = 0;
done:
if (cache)
munmap(cache, bytes);
return(r);
}
/* Process the PLT relocations. */
int
reloc_plt(Obj_Entry *obj)
{
/* All PLT relocations are the same kind: either Elf_Rel or Elf_Rela. */
if (obj->pltrelsize != 0) {
const Elf_Rel *rellim;
const Elf_Rel *rel;
rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize);
for (rel = obj->pltrel; rel < rellim; rel++) {
Elf_Addr *where;
assert(ELF_R_TYPE(rel->r_info) == R_ALPHA_JMP_SLOT);
/* Relocate the GOT slot pointing into the PLT. */
where = (Elf_Addr *)(obj->relocbase + rel->r_offset);
*where += (Elf_Addr)obj->relocbase;
}
} else {
const Elf_Rela *relalim;
const Elf_Rela *rela;
relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
for (rela = obj->pltrela; rela < relalim; rela++) {
Elf_Addr *where;
assert(ELF_R_TYPE(rela->r_info) == R_ALPHA_JMP_SLOT);
/* Relocate the GOT slot pointing into the PLT. */
where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
*where += (Elf_Addr)obj->relocbase;
}
}
return 0;
}
/* Relocate the jump slots in an object. */
int
reloc_jmpslots(Obj_Entry *obj)
{
if (obj->jmpslots_done)
return 0;
/* All PLT relocations are the same kind: either Elf_Rel or Elf_Rela. */
if (obj->pltrelsize != 0) {
const Elf_Rel *rellim;
const Elf_Rel *rel;
rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize);
for (rel = obj->pltrel; rel < rellim; rel++) {
Elf_Addr *where;
const Elf_Sym *def;
const Obj_Entry *defobj;
assert(ELF_R_TYPE(rel->r_info) == R_ALPHA_JMP_SLOT);
where = (Elf_Addr *)(obj->relocbase + rel->r_offset);
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true,
NULL);
if (def == NULL)
return -1;
reloc_jmpslot(where,
(Elf_Addr)(defobj->relocbase + def->st_value),
defobj, obj, rel);
}
} else {
const Elf_Rela *relalim;
const Elf_Rela *rela;
relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
for (rela = obj->pltrela; rela < relalim; rela++) {
Elf_Addr *where;
const Elf_Sym *def;
const Obj_Entry *defobj;
assert(ELF_R_TYPE(rela->r_info) == R_ALPHA_JMP_SLOT);
where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true,
NULL);
if (def == NULL)
return -1;
reloc_jmpslot(where,
(Elf_Addr)(defobj->relocbase + def->st_value),
defobj, obj, (Elf_Rel *)rela);
}
}
obj->jmpslots_done = true;
return 0;
}
/* Fixup the jump slot at "where" to transfer control to "target". */
Elf_Addr
reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *obj,
const Obj_Entry *refobj, const Elf_Rel *rel)
{
Elf_Addr stubaddr;
dbg(" reloc_jmpslot: where=%p, target=%p", (void *)where, (void *)target);
stubaddr = *where;
if (stubaddr != target) {
int64_t delta;
u_int32_t inst[3];
int instct;
Elf_Addr pc;
int64_t idisp;
u_int32_t *stubptr;
/* Point this GOT entry directly at the target. */
*where = target;
/*
* There may be multiple GOT tables, each with an entry
* pointing to the stub in the PLT. But we can only find and
* fix up the first GOT entry. So we must rewrite the stub as
* well, to perform a call to the target if it is executed.
*
* When the stub gets control, register pv ($27) contains its
* address. We adjust its value so that it points to the
* target, and then jump indirect through it.
*
* Each PLT entry has room for 3 instructions. If the
* adjustment amount fits in a signed 32-bit integer, we can
* simply add it to register pv. Otherwise we must load the
* GOT entry itself into the pv register.
*/
delta = target - stubaddr;
dbg(" stubaddr=%p, where-stubaddr=%ld, delta=%ld", (void *)stubaddr,
(long)where - (long)stubaddr, (long)delta);
instct = 0;
if ((int32_t)delta == delta) {
/*
* We can adjust pv with a LDA, LDAH sequence.
*
* First build an LDA instruction to adjust the low 16 bits.
*/
inst[instct++] = 0x08 << 26 | 27 << 21 | 27 << 16 |
(delta & 0xffff);
dbg(" LDA $27,%d($27)", (int16_t)delta);
/*
* Adjust the delta to account for the effects of the LDA,
* including sign-extension.
*/
delta -= (int16_t)delta;
if (delta != 0) {
/* Build an LDAH instruction to adjust the high 16 bits. */
inst[instct++] = 0x09 << 26 | 27 << 21 | 27 << 16 |
(delta >> 16 & 0xffff);
dbg(" LDAH $27,%d($27)", (int16_t)(delta >> 16));
}
} else {
int64_t dhigh;
/* We must load the GOT entry from memory. */
delta = (Elf_Addr)where - stubaddr;
/*
* If the GOT entry is too far away from the PLT entry,
* then punt. This PLT entry will have to be looked up
* manually for all GOT entries except the first one.
* The program will still run, albeit very slowly. It's
* extremely unlikely that this case could ever arise in
* practice, but we might as well handle it correctly if
* it does.
*/
if ((int32_t)delta != delta) {
dbg(" PLT stub too far from GOT to relocate");
return target;
}
dhigh = delta - (int16_t)delta;
if (dhigh != 0) {
/* Build an LDAH instruction to adjust the high 16 bits. */
inst[instct++] = 0x09 << 26 | 27 << 21 | 27 << 16 |
(dhigh >> 16 & 0xffff);
dbg(" LDAH $27,%d($27)", (int16_t)(dhigh >> 16));
}
/* Build an LDQ to load the GOT entry. */
inst[instct++] = 0x29 << 26 | 27 << 21 | 27 << 16 |
(delta & 0xffff);
dbg(" LDQ $27,%d($27)", (int16_t)delta);
}
/*
* Build a JMP or BR instruction to jump to the target. If
* the instruction displacement fits in a sign-extended 21-bit
* field, we can use the more efficient BR instruction.
* Otherwise we have to jump indirect through the pv register.
*/
pc = stubaddr + 4 * (instct + 1);
idisp = (int64_t)(target - pc) >> 2;
if (-0x100000 <= idisp && idisp < 0x100000) {
inst[instct++] = 0x30 << 26 | 31 << 21 | (idisp & 0x1fffff);
dbg(" BR $31,%p", (void *)target);
} else {
inst[instct++] = 0x1a << 26 | 31 << 21 | 27 << 16 |
(idisp & 0x3fff);
dbg(" JMP $31,($27),%d", (int)(idisp & 0x3fff));
}
/*
* Fill in the tail of the PLT entry first for reentrancy.
* Until we have overwritten the first instruction (an
* unconditional branch), the remaining instructions have no
* effect.
*/
stubptr = (u_int32_t *)stubaddr;
while (instct > 1) {
instct--;
stubptr[instct] = inst[instct];
}
/*
* Commit the tail of the instruction sequence to memory
* before overwriting the first instruction.
*/
__asm__ __volatile__("wmb" : : : "memory");
stubptr[0] = inst[0];
}
return target;
}
/* Process an R_ALPHA_COPY relocation. */
static int
do_copy_relocation(Obj_Entry *dstobj, const Elf_Rela *rela)
{
void *dstaddr;
const Elf_Sym *dstsym;
const char *name;
unsigned long hash;
size_t size;
const void *srcaddr;
const Elf_Sym *srcsym;
const Ver_Entry *ve;
Obj_Entry *srcobj;
dstaddr = (void *) (dstobj->relocbase + rela->r_offset);
dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info);
name = dstobj->strtab + dstsym->st_name;
hash = elf_hash(name);
size = dstsym->st_size;
ve = fetch_ventry(dstobj, ELF_R_SYM(rela->r_info));
for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next)
if ((srcsym = symlook_obj(name, hash, srcobj, ve, 0)) != NULL)
break;
if (srcobj == NULL) {
_rtld_error("Undefined symbol \"%s\" referenced from COPY"
" relocation in %s", name, dstobj->path);
return -1;
}
srcaddr = (const void *) (srcobj->relocbase + srcsym->st_value);
memcpy(dstaddr, srcaddr, size);
return 0;
}
/*
* Process the special R_ALPHA_COPY relocations in the main program. These
* copy data from a shared object into a region in the main program's BSS
* segment.
*
* Returns 0 on success, -1 on failure.
*/
int
do_copy_relocations(Obj_Entry *dstobj)
{
const Elf_Rel *rellim;
const Elf_Rel *rel;
const Elf_Rela *relalim;
const Elf_Rela *rela;
assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */
rellim = (const Elf_Rel *) ((caddr_t) dstobj->rel + dstobj->relsize);
for (rel = dstobj->rel; dstobj->rel != NULL && rel < rellim; rel++) {
if (ELF_R_TYPE(rel->r_info) == R_ALPHA_COPY) {
Elf_Rela locrela;
locrela.r_info = rel->r_info;
locrela.r_offset = rel->r_offset;
locrela.r_addend = 0;
if (do_copy_relocation(dstobj, &locrela))
return -1;
}
}
relalim = (const Elf_Rela *) ((caddr_t) dstobj->rela +
dstobj->relasize);
for (rela = dstobj->rela; dstobj->rela != NULL && rela < relalim;
rela++) {
if (ELF_R_TYPE(rela->r_info) == R_ALPHA_COPY) {
if (do_copy_relocation(dstobj, rela))
return -1;
}
}
return 0;
}
/* Initialize the special PLT entries. */
void
init_pltgot(Obj_Entry *obj)
{
u_int32_t *pltgot;
if (obj->pltgot != NULL &&
(obj->pltrelsize != 0 || obj->pltrelasize != 0)) {
/*
* This function will be called to perform the relocation.
* Look for the ldah instruction from the old PLT format since
* that will tell us what format we are trying to relocate.
*/
pltgot = (u_int32_t *) obj->pltgot;
if ((pltgot[8] & 0xffff0000) == 0x279f0000)
obj->pltgot[2] = (Elf_Addr) &_rtld_bind_start_old;
else
obj->pltgot[2] = (Elf_Addr) &_rtld_bind_start;
/* Identify this shared object */
obj->pltgot[3] = (Elf_Addr) obj;
}
}
void
allocate_initial_tls(Obj_Entry *list)
{
void *tls;
/*
* Fix the size of the static TLS block by using the maximum
* offset allocated so far and adding a bit for dynamic modules to
* use.
*/
tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA;
tls = allocate_tls(list, 0, 16, 16);
alpha_pal_wrunique((u_int64_t) tls);
}
void *__tls_get_addr(tls_index* ti)
{
Elf_Addr** tp = (Elf_Addr**) alpha_pal_rdunique();
return tls_get_addr_common(tp, ti->ti_module, ti->ti_offset);
}

View File

@ -1,78 +0,0 @@
/*-
* Copyright (c) 1999, 2000 John D. Polstra.
* 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$
*/
#ifndef RTLD_MACHDEP_H
#define RTLD_MACHDEP_H 1
#include <sys/types.h>
#include <machine/atomic.h>
/*
* This value of CACHE_LINE_SIZE is conservative. The actual size
* is 32 on the 21064, 21064A, 21066, 21066A, and 21164. It is 64
* on the 21264. Compaq recommends sequestering each lock in its own
* 128-byte block to allow for future implementations with larger
* cache lines.
*/
#define CACHE_LINE_SIZE 128
struct Struct_Obj_Entry;
/* Return the address of the .dynamic section in the dynamic linker. */
#define rtld_dynamic(obj) (&_DYNAMIC)
Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr,
const struct Struct_Obj_Entry *,
const struct Struct_Obj_Entry *,
const Elf_Rel *);
#define make_function_pointer(def, defobj) \
((defobj)->relocbase + (def)->st_value)
#define call_initfini_pointer(obj, target) \
(((InitFunc)(target))())
/* Lazy binding entry point, called via PLT. */
void _rtld_bind_start_old(void);
#define round(size, align) \
(((size) + (align) - 1) & ~((align) - 1))
#define calculate_first_tls_offset(size, align) \
round(16, align)
#define calculate_tls_offset(prev_offset, prev_size, size, align) \
round(prev_offset + prev_size, align)
#define calculate_tls_end(off, size) ((off) + (size))
typedef struct {
unsigned long ti_module;
unsigned long ti_offset;
} tls_index;
extern void *__tls_get_addr(tls_index *ti);
#endif

View File

@ -1,211 +0,0 @@
/* $FreeBSD$ */
/* From: NetBSD: rtld_start.S,v 1.1 1996/12/16 20:38:09 cgd Exp */
/*
* Copyright 1996 Matt Thomas <matt@3am-software.com>
* Copyright 2000 John D. Polstra
* 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <machine/pal.h>
.extern _GLOBAL_OFFSET_TABLE_
.extern _GOT_END_
LEAF(_rtld_start, 0) /* XXX */
.set noreorder
br pv, $33
$33: LDGP(pv)
/* save away the stack pointer */
lda s0, 0(sp) /* get argc from stack */
lda sp, -16(sp) /* space for arguments */
/* save ps_strings pointer */
mov a3, s1
/* Step 1 -- Figure out the displacement */
br t2, $34 /* get our PC */
$34: ldiq t3, $34 /* get where the linker thought we were */
subq t2, t3, t8 /* calculate the displacement */
/* Step 2 -- Find bounds of global offset table */
lda t5, _GLOBAL_OFFSET_TABLE_
addq t8, t5, t9 /* add the displacement */
lda t4, _GOT_END_
addq t8, t4, t10 /* add the displacement */
/*
* Step 3 -- Every entry in the global offset table needs to
* modified for the displacement before any code will work.
*/
$35: ldq t1, 0(t9) /* load the value */
addq t8, t1, t1 /* add the displacement */
stq t1, 0(t9) /* save the new value */
lda t9, 8(t9) /* point to next entry */
cmpult t9, t10, t1 /* are we done? */
bne t1, $35 /* no, do more */
/*
* Ya! Things are far enough so we can do some dynamic linking!
*/
lda a0, 0(s0) /* initial sp */
lda a1, -16(s0) /* address for exit proc */
lda a2, -8(s0) /* address for obj_main */
CALL(_rtld) /* v0 = _rtld(sp, &exit_proc, &obj_main); */
ldq a1, -16(s0) /* our atexit function */
ldq a2, -8(s0) /* obj_main entry */
lda sp, 16(sp) /* readjust our stack */
mov s0, a0 /* stack pointer */
mov s1, a3 /* ps_strings pointer */
mov v0, pv
jsr ra, (v0), 0 /* (*_start)(sp, cleanup, obj); */
ldgp gp, 0(ra)
CALL(exit)
halt
END(_rtld_start)
#define RTLD_BIND_START_PROLOGUE \
/* at_reg already used by PLT code. */ \
.set noat ; \
\
/* \
* Allocate stack frame and preserve all registers that the \
* caller would have normally saved themselves. \
*/ \
lda sp, -168(sp) ; \
stq ra, 0(sp) ; \
stq v0, 8(sp) ; \
stq t0, 16(sp) ; \
stq t1, 24(sp) ; \
stq t2, 32(sp) ; \
stq t3, 40(sp) ; \
stq t4, 48(sp) ; \
stq t5, 56(sp) ; \
stq t6, 64(sp) ; \
stq t7, 72(sp) ; \
stq a0, 80(sp) ; \
stq a1, 88(sp) ; \
stq a2, 96(sp) ; \
stq a3, 104(sp) ; \
stq a4, 112(sp) ; \
stq a5, 120(sp) ; \
stq t8, 128(sp) ; \
stq t9, 136(sp) ; \
stq t10, 144(sp) ; \
stq t11, 152(sp) ; \
stq gp, 160(sp) ; \
\
/* \
* Load our global pointer. Note, can't use pv, since it is \
* already used by the PLT code. \
*/ \
br t0, 1f ; \
1: LDGP(t0)
#define RTLD_BIND_START_EPILOGUE \
/* Move the destination address into position. */ \
mov v0, pv ; \
\
/* Restore program registers. */ \
ldq ra, 0(sp) ; \
ldq v0, 8(sp) ; \
ldq t0, 16(sp) ; \
ldq t1, 24(sp) ; \
ldq t2, 32(sp) ; \
ldq t3, 40(sp) ; \
ldq t4, 48(sp) ; \
ldq t5, 56(sp) ; \
ldq t6, 64(sp) ; \
ldq t7, 72(sp) ; \
ldq a0, 80(sp) ; \
ldq a1, 88(sp) ; \
ldq a2, 96(sp) ; \
ldq a3, 104(sp) ; \
ldq a4, 112(sp) ; \
ldq a5, 120(sp) ; \
ldq t8, 128(sp) ; \
ldq t9, 136(sp) ; \
ldq t10, 144(sp) ; \
ldq t11, 152(sp) ; \
ldq gp, 160(sp) ; \
/* XXX LDGP? */ \
\
/* \
* We've patched the PLT; sync the I-stream. \
*/ \
imb ; \
\
/* Pop the stack frame and turn control to the destination. */ \
lda sp, 168(sp) ; \
jmp zero, (pv)
/*
* Lazy binding entry point, called via PLT.
*/
NESTED_NOPROFILE(_rtld_bind_start, 0, 168, ra, 0, 0)
RTLD_BIND_START_PROLOGUE
/* Set up the arguments for _rtld_bind. */
subq at_reg, pv, a1 /* calculate reloc offset */
ldq a0, 8(pv) /* object structure */
subq a1, 20, a1 /* = (at - t11 - 20) / 12 * 24 */
addq a1, a1, a1
CALL(_rtld_bind)
RTLD_BIND_START_EPILOGUE
END(_rtld_bind_start)
/*
* Lazy binding entry point, called via PLT. This version is for the
* old PLT entry format.
*/
NESTED_NOPROFILE(_rtld_bind_start_old, 0, 168, ra, 0, 0)
RTLD_BIND_START_PROLOGUE
/* Set up the arguments for _rtld_bind. */
ldq a0, 8(pv) /* object structure */
mov at_reg, a1 /* offset of reloc entry */
CALL(_rtld_bind)
RTLD_BIND_START_EPILOGUE
END(_rtld_bind_start_old)

View File

@ -206,17 +206,6 @@ BOOTINODE= 80000
MFSSIZE= 4320
MFSINODE= 8000
MFSLABEL= minimum3
.elif ${TARGET_ARCH} == "alpha"
MAKE_FLOPPIES= true
FLOPPYSIZE= 1440
FLOPPYSPLITSIZE= 1392
FLOPPYINODE= 40000
FLOPPYLABEL= fd1440
BOOTINODE= 80000
MFSSIZE= 4320
MFSINODE= 8000
MFSLABEL= auto
SPLIT_MFSROOT=
.elif ${TARGET_ARCH} == "sparc64"
DISKLABEL= sunlabel
MFSSIZE= 4096

View File

@ -1,44 +0,0 @@
# $FreeBSD$
buildopts -DRELEASE_CRUNCH -Dlint
srcdirs /usr/src/bin
progs hostname
progs pwd
progs rm
progs sh
progs test
ln sh -sh
ln test [
srcdirs /usr/src/gnu/usr.bin
progs cpio
srcdirs /usr/src/sbin
progs camcontrol
progs dhclient
progs fsck_ffs
progs ifconfig
progs mount_nfs
progs newfs
progs route
progs rtsol
progs slattach
progs tunefs
srcdirs /usr/src/usr.bin
progs find
progs minigzip
progs sed
ln minigzip gzip
ln minigzip gunzip
ln minigzip zcat
srcdirs /usr/src/usr.sbin
progs arp
progs ppp
progs sysinstall
progs usbdevs
libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs

View File

@ -1,72 +0,0 @@
#!/bin/sh
#
# Module: mkisoimages.sh
# Author: Jordan K Hubbard
# Date: 22 June 2001
#
# $FreeBSD$
#
# This script is used by release/Makefile to build the (optional) ISO images
# for a FreeBSD release. It is considered architecture dependent since each
# platform has a slightly unique way of making bootable CDs. This script
# is also allowed to generate any number of images since that is more of
# publishing decision than anything else.
#
# Usage:
#
# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
#
# Where -b is passed if the ISO image should be made "bootable" by
# whatever standards this architecture supports (may be unsupported),
# image-label is the ISO image label, image-name is the filename of the
# resulting ISO image, base-bits-dir contains the image contents and
# extra-bits-dir, if provided, contains additional files to be merged
# into base-bits-dir as part of making the image.
publisher="The FreeBSD Project. http://www.freebsd.org/"
if [ "x$1" = "x-b" ]; then
bootable="yes"
shift
fi
if [ $# -lt 3 ]; then
echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
exit 1
fi
type mkisofs 2>&1 | grep " is " >/dev/null
if [ $? -ne 0 ]; then
echo The cdrtools port is not installed. Trying to get it now.
if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then
cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean
else
if ! pkg_add -r cdrtools; then
echo "Could not get it via pkg_add - please go install this"
echo "from the ports collection and run this script again."
exit 2
fi
fi
fi
LABEL=$1; shift
NAME=$1; shift
mkisofs -r -J -V $LABEL -publisher "$publisher" -o $NAME $*
type setcdboot 2>&1 | grep " is " >/dev/null
if [ $? -ne 0 ]; then
echo The setcdboot port is not installed. Trying to get it now.
if [ -f /usr/ports/sysutils/setcdboot/Makefile ]; then
cd /usr/ports/sysutils/setcdboot && make install BATCH=yes && make clean
else
if ! pkg_add -r setcdboot; then
echo "Could not get it via pkg_add - please go install this"
echo "from the ports collection and run this script again."
exit 2
fi
fi
fi
if [ "x$bootable" != "x" ]; then
setcdboot $NAME /boot/cdboot
fi

View File

@ -163,10 +163,6 @@ CRUNCH_PROGS_sbin+= mca gpt fdisk
CRUNCH_PROGS_sbin+= sunlabel
.endif
.if ${MACHINE_ARCH} == "alpha"
CRUNCH_ALIAS_bsdlabel= disklabel
.endif
.if ${MACHINE_ARCH} == "amd64"
CRUNCH_PROGS_sbin+= fdisk
CRUNCH_ALIAS_bsdlabel= disklabel

View File

@ -8,8 +8,7 @@ SRCS= bsdlabel.c geom_bsd_enc.c
#MAN= bsdlabel.5
MAN+= bsdlabel.8
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "amd64"
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
LINKS= ${BINDIR}/bsdlabel ${BINDIR}/disklabel
MLINKS= bsdlabel.8 disklabel.8
.endif

View File

@ -6,7 +6,7 @@ SUBDIR= ${_ggatec} \
${_ggated} \
ggatel
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
.if ${MACHINE_ARCH} == "sparc64"
.if ${MK_LIBTHR} != "no"
_ggatec= ggatec
_ggated= ggated

View File

@ -5,9 +5,6 @@ PROG= ping
MAN= ping.8
BINOWN= root
BINMODE=4555
.if ${MACHINE_ARCH} == "alpha"
CFLAGS+=-fno-builtin # GCC's builtin memcpy doesn't do unaligned copies
.endif
WARNS?= 2
DPADD= ${LIBM}
LDADD= -lm

View File

@ -15,8 +15,6 @@ CFLAGS+= -DOPENSSL_NO_IDEA
.if ${MACHINE_ARCH} == "i386"
CFLAGS+= -DL_ENDIAN
.elif ${MACHINE_ARCH} == "alpha"
# no ENDIAN stuff defined for alpha (64-bit)
.endif
MANDIR= ${SHAREDIR}/openssl/man/man

Some files were not shown because too many files have changed in this diff Show More