ia64 libc MD stuff #1. Pushing in everything before my harddisk pops.

This commit is contained in:
cherry 2006-09-22 17:59:47 +00:00
parent 729d0a0184
commit 64f11261d1
10 changed files with 333 additions and 8 deletions

View File

@ -1,2 +1,3 @@
# $NetBSD: Makefile.inc,v 1.1 2006/09/10 21:22:33 cherry Exp $
# XXX: Stub
# $NetBSD: Makefile.inc,v 1.2 2006/09/22 17:59:47 cherry Exp $
SRCS+= __sigaction14_sigtramp.c

View File

@ -1,4 +1,5 @@
# $NetBSD: Makefile.inc,v 1.2 2006/09/22 12:09:25 cherry Exp $
# $NetBSD: Makefile.inc,v 1.3 2006/09/22 17:59:47 cherry Exp $
SRCS+= bswap16.c bswap32.c bswap64.c
SRCS+= flt_rounds.c fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c

View File

@ -0,0 +1,25 @@
/*
* Written by J.T. Conklin, Apr 10, 1995
* Public domain.
*/
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/lib/libc/ia64/gen/flt_rounds.c,v 1.1 2004/07/19 08:17:24 das Exp $"); */
#include <float.h>
static const int map[] = {
1, /* round to nearest */
3, /* round to zero */
2, /* round to negative infinity */
0 /* round to positive infinity */
};
int
__flt_rounds(void)
{
int x;
__asm("mov %0=ar.fpsr" : "=r" (x));
return (map[(x >> 10) & 0x03]);
}

View File

@ -0,0 +1,41 @@
/*-
* Copyright (c) 2001 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: src/lib/libc/ia64/gen/fpgetmask.c,v 1.4 2003/10/22 09:00:07 marcel Exp $"); */
#include <sys/types.h>
#include <ieeefp.h>
/* XXX: Move to sysarchs() */
fp_except
fpgetmask(void)
{
uint64_t fpsr;
__asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr));
return (~fpsr & 0x3d);
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2003 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/lib/libc/ia64/gen/fpgetround.c,v 1.1 2003/01/11 07:24:54 marcel Exp $
*/
#include <sys/types.h>
#include <ieeefp.h>
fp_rnd
fpgetround(void)
{
uint64_t fpsr;
__asm __volatile("mov %0=ar.fpsr" : "=r"(fpsr));
return ((fp_rnd)((fpsr >> 10) & 3));
}

View File

@ -0,0 +1,44 @@
/*-
* Copyright (c) 2001 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: src/lib/libc/ia64/gen/fpsetmask.c,v 1.4 2003/10/22 09:00:07 marcel Exp $"); */
#include <sys/types.h>
#include <ieeefp.h>
fp_except
fpsetmask(fp_except mask)
{
int64_t fpsr;
int64_t oldmask;
__asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr));
oldmask = ~fpsr & 0x3d;
fpsr = (fpsr & ~0x3d) | (~mask & 0x3d);
__asm __volatile("mov ar.fpsr=%0" :: "r" (fpsr));
return (oldmask);
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2003 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/lib/libc/ia64/gen/fpsetround.c,v 1.1 2003/01/11 07:24:54 marcel Exp $
*/
#include <sys/types.h>
#include <ieeefp.h>
fp_rnd
fpsetround(fp_rnd rnd)
{
uint64_t fpsr;
fp_rnd prev;
__asm __volatile("mov %0=ar.fpsr" : "=r"(fpsr));
prev = (fp_rnd)((fpsr >> 10) & 3);
fpsr = (fpsr & ~0xC00ULL) | ((unsigned int)rnd << 10);
__asm __volatile("mov ar.fpsr=%0" :: "r"(fpsr));
return (prev);
}

View File

@ -0,0 +1,81 @@
/* $NetBSD: __sigaction14_sigtramp.c,v 1.1 2006/09/22 17:59:47 cherry Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* 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 <sys/types.h>
#include <stddef.h>
#include <signal.h>
#include <errno.h>
#include "extern.h"
__weak_alias(__sigaction14, __libc_sigaction14)
int
__libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
{
extern const int __sigtramp_siginfo_2[];
/*
* If no sigaction, use the "default" trampoline since it won't
* be used.
*/
if (act == NULL)
return __sigaction_sigtramp(sig, act, oact, NULL, 0);
#ifdef __LIBC12_SOURCE__
/*
* We select the non-SA_SIGINFO trampoline if SA_SIGINFO is not
* set in the sigaction.
*/
if ((act->sa_flags & SA_SIGINFO) == 0) {
extern const int __sigtramp_sigcontext_1[];
int sav = errno;
int rv = __sigaction_sigtramp(sig, act, oact,
__sigtramp_sigcontext_1, 1);
if (rv >= 0 || errno != EINVAL)
return rv;
errno = sav;
}
#endif
/*
* If SA_SIGINFO was specified or the compatibility trampolines
* can't be used, use the siginfo trampoline.
*/
return __sigaction_sigtramp(sig, act, oact, __sigtramp_siginfo_2, 2);
}

View File

@ -1,3 +1,8 @@
/* $NetBSD: __vfork14.S,v 1.1 2006/09/10 21:22:34 cherry Exp $ */
/* XXX: Stub */
/* $NetBSD: __vfork14.S,v 1.2 2006/09/22 17:59:47 cherry Exp $ */
#include "SYS.h"
SYSCALL(__vfork14)
/* XXX: watchout for return values for child/parent */
RET
END(__vfork14)

View File

@ -1,3 +1,48 @@
/* $NetBSD: cerror.S,v 1.1 2006/09/10 21:22:34 cherry Exp $ */
/* $NetBSD: cerror.S,v 1.2 2006/09/22 17:59:47 cherry Exp $ */
/* XXX: Stub */
/*-
* Copyright (c) 2000 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 <machine/asm.h>
/* __FBSDID("$FreeBSD: src/lib/libc/ia64/sys/cerror.S,v 1.2 2003/03/03 01:09:46 obrien Exp $"); */
ENTRY(__cerror, 0)
alloc loc0=ar.pfs,0,3,1,0
;;
mov loc1=rp
mov loc2=ret0
mov out0=ret0
;;
br.call.sptk.few rp=__errno
st4 [ret0]=loc2
;;
mov ret0=-1
mov ar.pfs=loc0
mov rp=loc1
;;
br.ret.sptk.few rp
END(__cerror)