Libc update to simplify merge.

Bumping libc files for unsupported architectures, to simplify merging.
A bunch of small fixes:
 * in libutil update
 * the macro in endian.h
 * some undefined types due to clear separation from host.
 * Fix a warning for cdbr.c

Some modification which were required for the new build system:
 * inclusion path for const.h in sconst, still hacky
 * Removed default malloc.c which conflicts on some occasions.
This commit is contained in:
Lionel Sambuc 2012-09-17 11:09:12 +02:00
parent dba3562d78
commit e415d48872
183 changed files with 3292 additions and 2385 deletions

View file

@ -127,10 +127,10 @@ __END_DECLS
#define htonl(x) bswap32(__CAST(uint32_t, (x)))
#define htons(x) bswap16(__CAST(uint16_t, (x)))
#define NTOHL(x) (x) = ntohl(__CAST(uint32_t, (x)))
#define NTOHS(x) (x) = ntohs(__CAST(uint16_t, (x)))
#define HTONL(x) (x) = htonl(__CAST(uint32_t, (x)))
#define HTONS(x) (x) = htons(__CAST(uint16_t, (x)))
#define NTOHL(x) ntohl(__CAST(uint32_t, (x)))
#define NTOHS(x) ntohs(__CAST(uint16_t, (x)))
#define HTONL(x) htonl(__CAST(uint32_t, (x)))
#define HTONS(x) htons(__CAST(uint16_t, (x)))
#endif /* LITTLE_ENDIAN || !defined(__lint__) */
/*

View file

@ -1,8 +1,13 @@
#ifndef __SCONST_H__
#define __SCONST_H__
/*
* LSC Weirdness going on with the const.h header: FIXME
#include "kernel/const.h"
#include "kernel/procoffsets.h"
*/
#include "const.h"
#include "procoffsets.h"
/*
* offset to current process pointer right after trap, we assume we always have

View file

@ -1,4 +1,4 @@
/* $NetBSD: __setjmp14.S,v 1.4 2004/03/21 18:04:27 matt Exp $ */
/* $NetBSD: __setjmp14.S,v 1.5 2011/06/12 05:44:36 matt Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -96,7 +96,9 @@ LEAF(__setjmp14, 1)
stt fs5, (7*8 + SC_FPREGS)(a0)
stt fs6, (8*8 + SC_FPREGS)(a0)
stt fs7, (9*8 + SC_FPREGS)(a0)
excb /* required 4.7.8.1 Alpha ARM */
mf_fpcr ft0 /* get FP control reg */
excb /* required 4.7.8.1 Alpha ARM */
stt ft0, SC_FPCR(a0) /* and store it in sc_fpcr */
stq zero, SC_FP_CONTROL(a0) /* FP software control XXX */
stq zero, (SC_RESERVED + 0*8)(a0) /* sc_reserved[0] */

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:55 martin Exp $ */
/* $NetBSD: _lwp.c,v 1.7 2012/09/12 14:13:43 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:55 martin Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.7 2012/09/12 14:13:43 manu Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -60,4 +60,7 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *),
gr[_REG_A0] = (unsigned long) arg;
gr[_REG_SP] = ((unsigned long) (stack_base + stack_size)) & ~0x7;
gr[_REG_S6] = 0;
gr[_REG_UNIQUE] = (unsigned long)private;
u->uc_flags |= _UC_TLSBASE;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: flt_rounds.c,v 1.8 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: flt_rounds.c,v 1.9 2011/06/12 05:44:36 matt Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
@ -36,29 +36,33 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.8 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: flt_rounds.c,v 1.9 2011/06/12 05:44:36 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieeefp.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 */
};
/*
* These come from <float.h> defintion
*/
#define FLT_ROUND_MAP \
( (0 << (FP_RZ*2)) /* round to zero */ \
| (1 << (FP_RN*2)) /* round to nearest */ \
| (3 << (FP_RM*2)) /* round to negative infinity */ \
| (2 << (FP_RP*2))) /* round to positive infinity */
int
__flt_rounds()
__flt_rounds(void)
{
double fpcrval;
u_int64_t old;
union {
double d;
uint64_t u64;
} fpcrval;
uint64_t old;
__asm("trapb");
__asm("mf_fpcr %0" : "=f" (fpcrval));
__asm("trapb");
old = *(u_int64_t *)(void *)&fpcrval;
__asm("excb; mf_fpcr %0; excb" : "=f" (fpcrval.d));
old = (fpcrval.u64 >> 58) & 3;
return map[(old >> 58) & 0x3];
return (FLT_ROUND_MAP >> (old << 1)) & 3;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetround.c,v 1.9 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetround.c,v 1.11 2012/03/21 20:07:52 he Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetround.c,v 1.9 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetround.c,v 1.11 2012/03/21 20:07:52 he Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -49,13 +49,14 @@ __weak_alias(fpgetround,_fpgetround)
#endif
fp_rnd
fpgetround()
fpgetround(void)
{
double fpcrval;
u_int64_t old;
union {
double d;
uint64_t u64;
} fpcrval;
__asm("mf_fpcr %0" : "=f" (fpcrval));
old = *(u_int64_t *)(void *)&fpcrval;
__asm("excb; mf_fpcr %0; excb" : "=f" (fpcrval.d));
return ((old >> 58) & 0x3);
return ((fp_rnd)(fpcrval.u64 >> 58) & 0x3);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetround.c,v 1.10 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetround.c,v 1.12 2012/03/21 20:07:52 he Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.10 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetround.c,v 1.12 2012/03/21 20:07:52 he Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -49,22 +49,22 @@ __weak_alias(fpsetround,_fpsetround)
#endif
fp_rnd
fpsetround(rnd_dir)
fp_rnd rnd_dir;
fpsetround(fp_rnd rnd_dir)
{
double fpcrval;
u_int64_t old, new;
union {
double d;
uint64_t u64;
} fpcrval;
fp_rnd old;
__asm("excb");
__asm("mf_fpcr %0" : "=f" (fpcrval));
old = *(u_int64_t *)(void *)&fpcrval;
__asm("excb; mf_fpcr %0; excb" : "=f" (fpcrval.d));
old = (fp_rnd)(fpcrval.u64 >> 58) & 0x3;
new = old & ~(long)0x0c00000000000000;
new = (long)rnd_dir << 58;
*(u_int64_t *)(void *)&fpcrval = new;
rnd_dir ^= old;
__asm("mt_fpcr %0" : : "f" (fpcrval));
__asm("excb");
fpcrval.u64 ^= (long)rnd_dir << 58;
return ((old >> 58) & 0x3);
__asm("excb; mt_fpcr %0; excb" : : "f" (fpcrval.d));
return old;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: makecontext.c,v 1.4 2008/04/28 20:22:55 martin Exp $ */
/* $NetBSD: makecontext.c,v 1.6 2011/09/20 08:42:29 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: makecontext.c,v 1.4 2008/04/28 20:22:55 martin Exp $");
__RCSID("$NetBSD: makecontext.c,v 1.6 2011/09/20 08:42:29 joerg Exp $");
#endif
#include <stddef.h>
@ -41,6 +41,8 @@ __RCSID("$NetBSD: makecontext.c,v 1.4 2008/04/28 20:22:55 martin Exp $");
#include <stdarg.h>
void __resumecontext(void) __dead;
void
makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
{
@ -49,8 +51,6 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
unsigned long *sp;
va_list ap;
void __resumecontext(void);
/* Compute and align stack pointer. */
sp = (unsigned long *)
(((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & ~0x7);

View file

@ -1,4 +1,4 @@
/* $NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:55 martin Exp $ */
/* $NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:57 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:55 martin Exp $");
__RCSID("$NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:57 joerg Exp $");
#endif
#include "namespace.h"
@ -41,7 +41,7 @@ __RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:55 martin Exp $");
#include "extern.h"
void
_resumecontext()
_resumecontext(void)
{
ucontext_t uct;

View file

@ -1,4 +1,4 @@
/* $NetBSD: __longjmp14.c,v 1.4 2008/04/28 20:22:55 martin Exp $ */
/* $NetBSD: __longjmp14.c,v 1.5 2012/03/22 12:31:32 skrll Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -81,6 +81,7 @@ __longjmp14(jmp_buf env, int val)
uc.uc_mcontext.__gregs[18] = regs[18];
/* Preserve the current value of DP */
/* LINTED dp is r27, so is "initialized" */
uc.uc_mcontext.__gregs[27] = dp;
/* Set the desired return value. */

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.4 2010/01/07 12:31:10 skrll Exp $ */
/* $NetBSD: _lwp.c,v 1.5 2011/02/24 04:28:42 joerg Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.4 2010/01/07 12:31:10 skrll Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.5 2011/02/24 04:28:42 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -69,4 +69,5 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *),
gr[_REG_RP] = (__greg_t) _lwp_exit;
gr[_REG_ARG0] = (__greg_t) arg;
gr[_REG_SP] = (__greg_t) sp;
gr[_REG_CR27] = (__greg_t) private;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: flt_rounds.c,v 1.4 2005/12/24 21:42:32 perry Exp $ */
/* $NetBSD: flt_rounds.c,v 1.5 2012/03/23 09:34:09 skrll Exp $ */
/* $OpenBSD: flt_rounds.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.4 2005/12/24 21:42:32 perry Exp $");
__RCSID("$NetBSD: flt_rounds.c,v 1.5 2012/03/23 09:34:09 skrll Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -27,5 +27,5 @@ __flt_rounds(void)
uint64_t fpsr;
__asm volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
return map[(fpsr >> 41) & 0x03];
return map[(unsigned int)(fpsr >> 41) & 0x03];
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetmask.c,v 1.4 2005/12/24 21:42:32 perry Exp $ */
/* $NetBSD: fpgetmask.c,v 1.5 2012/03/23 09:34:09 skrll Exp $ */
/* $OpenBSD: fpgetmask.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetmask.c,v 1.4 2005/12/24 21:42:32 perry Exp $");
__RCSID("$NetBSD: fpgetmask.c,v 1.5 2012/03/23 09:34:09 skrll Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -20,5 +20,5 @@ fpgetmask(void)
uint64_t fpsr;
__asm volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
return ((fpsr >> 32) & 0x1f);
return ((fp_except)(fpsr >> 32) & 0x1f);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetround.c,v 1.4 2005/12/24 21:42:32 perry Exp $ */
/* $NetBSD: fpgetround.c,v 1.5 2012/03/23 09:34:09 skrll Exp $ */
/* $OpenBSD: fpgetround.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetround.c,v 1.4 2005/12/24 21:42:32 perry Exp $");
__RCSID("$NetBSD: fpgetround.c,v 1.5 2012/03/23 09:34:09 skrll Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -20,5 +20,5 @@ fpgetround(void)
uint64_t fpsr;
__asm volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
return ((fpsr >> 41) & 0x3);
return ((fp_rnd)(fpsr >> 41) & 0x3);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetsticky.c,v 1.4 2005/12/24 21:42:32 perry Exp $ */
/* $NetBSD: fpgetsticky.c,v 1.5 2012/03/23 09:34:09 skrll Exp $ */
/* $OpenBSD: fpgetsticky.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetsticky.c,v 1.4 2005/12/24 21:42:32 perry Exp $");
__RCSID("$NetBSD: fpgetsticky.c,v 1.5 2012/03/23 09:34:09 skrll Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -20,5 +20,5 @@ fpgetsticky(void)
uint64_t fpsr;
__asm volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
return ((fpsr >> 59) & 0x1f);
return ((fp_except)(fpsr >> 59) & 0x1f);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetmask.c,v 1.5 2009/01/25 16:44:41 skrll Exp $ */
/* $NetBSD: fpsetmask.c,v 1.6 2012/03/23 09:34:09 skrll Exp $ */
/* $OpenBSD: fpsetmask.c,v 1.4 2004/01/05 06:06:16 otto Exp $ */
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetmask.c,v 1.5 2009/01/25 16:44:41 skrll Exp $");
__RCSID("$NetBSD: fpsetmask.c,v 1.6 2012/03/23 09:34:09 skrll Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -21,7 +21,7 @@ fpsetmask(fp_except mask)
fp_except old;
__asm volatile("fstd %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr) : "memory");
old = (fpsr >> 32) & 0x1f;
old = (fp_except)(fpsr >> 32) & 0x1f;
fpsr = (fpsr & 0xffffffe000000000LL) | ((uint64_t)(mask & 0x1f) << 32);
__asm volatile("fldd 0(%0),%%fr0" : : "r"(&fpsr) : "memory");
return (old);

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetround.c,v 1.5 2009/01/25 16:44:41 skrll Exp $ */
/* $NetBSD: fpsetround.c,v 1.6 2012/03/23 09:34:09 skrll Exp $ */
/* $OpenBSD: fpsetround.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.5 2009/01/25 16:44:41 skrll Exp $");
__RCSID("$NetBSD: fpsetround.c,v 1.6 2012/03/23 09:34:09 skrll Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -21,7 +21,7 @@ fpsetround(fp_rnd rnd_dir)
fp_rnd old;
__asm volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr) : "memory");
old = (fpsr >> 41) & 0x03;
old = (fp_rnd)(fpsr >> 41) & 0x03;
fpsr = (fpsr & 0xfffff9ff00000000LL) |
((uint64_t)(rnd_dir & 0x03) << 41);
__asm volatile("fldd 0(%0),%%fr0" : : "r" (&fpsr) : "memory");

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetsticky.c,v 1.5 2009/01/25 16:44:41 skrll Exp $ */
/* $NetBSD: fpsetsticky.c,v 1.6 2012/03/23 09:34:09 skrll Exp $ */
/* $OpenBSD: fpsetsticky.c,v 1.4 2004/01/05 06:06:16 otto Exp $ */
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2009/01/25 16:44:41 skrll Exp $");
__RCSID("$NetBSD: fpsetsticky.c,v 1.6 2012/03/23 09:34:09 skrll Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -21,7 +21,7 @@ fpsetsticky(fp_except mask)
fp_except old;
__asm volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr) : "memory");
old = (fpsr >> 59) & 0x1f;
old = (fp_except)(fpsr >> 59) & 0x1f;
fpsr = (fpsr & 0x07ffffff00000000LL) | ((uint64_t)(mask & 0x1f) << 59);
__asm volatile("fldd 0(%0),%%fr0" : : "r" (&fpsr) : "memory");

View file

@ -1,4 +1,4 @@
/* $NetBSD: makecontext.c,v 1.3 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: makecontext.c,v 1.6 2012/03/22 12:31:32 skrll Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: makecontext.c,v 1.3 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: makecontext.c,v 1.6 2012/03/22 12:31:32 skrll Exp $");
#endif
#include <inttypes.h>
@ -44,6 +44,8 @@ __RCSID("$NetBSD: makecontext.c,v 1.3 2008/04/28 20:22:56 martin Exp $");
#include <sys/types.h>
#include <machine/frame.h>
void __resumecontext(void) __dead;
void
makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
{
@ -54,8 +56,6 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
int i;
va_list ap;
void __resumecontext(void);
/* LINTED uintptr_t is safe */
sp = (uintptr_t *)ucp->uc_stack.ss_sp;
/* LINTED uintptr_t is safe */
@ -81,6 +81,7 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
}
gr[_REG_PCOQH] = fp | HPPA_PC_PRIV_USER;
gr[_REG_PCOQT] = (fp + 4) | HPPA_PC_PRIV_USER;
/* LINTED dp is reg27, ref. above, so initialized */
gr[_REG_DP] = dp;
/* Construct argument list. */

View file

@ -1,4 +1,4 @@
/* $NetBSD: resumecontext.c,v 1.3 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: resumecontext.c,v 1.4 2011/09/19 21:24:57 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: resumecontext.c,v 1.3 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: resumecontext.c,v 1.4 2011/09/19 21:24:57 joerg Exp $");
#endif
#include "namespace.h"
@ -41,7 +41,7 @@ __RCSID("$NetBSD: resumecontext.c,v 1.3 2008/04/28 20:22:56 martin Exp $");
#include "extern.h"
void
_resumecontext()
_resumecontext(void)
{
ucontext_t uct;

View file

@ -1,4 +1,4 @@
/* $NetBSD: swapcontext.S,v 1.4 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: swapcontext.S,v 1.5 2012/09/12 02:00:52 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -33,7 +33,7 @@
#include <machine/mcontext.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: swapcontext.S,v 1.4 2008/04/28 20:22:56 martin Exp $")
RCSID("$NetBSD: swapcontext.S,v 1.5 2012/09/12 02:00:52 manu Exp $")
#endif /* SYSLIBC_SCCS && !lint */
LEAF_ENTRY(swapcontext)
@ -44,10 +44,15 @@ LEAF_ENTRY(swapcontext)
ldw HPPA_FRAME_ARG(0)(%sp), %arg1
ldw HPPA_FRAME_ARG(1)(%sp), %arg0
stw %r0, (_OFFSETOF_UC_GREGS + _REG_RET0 * SZREG)(%arg1)
ldw HPPA_FRAME_CRP(%sp), %rp
ldo 4(%rp), %r1
stw %r1, (_OFFSETOF_UC_GREGS + _REG_PCOQT * SZREG)(%arg1)
stw %rp, (_OFFSETOF_UC_GREGS + _REG_PCOQH * SZREG)(%arg1)
SYSCALL(setcontext)
bl setcontext, %rp
stw %r0, (_OFFSETOF_UC_GREGS + _REG_RET0 * SZREG)(%arg1)
ldw HPPA_FRAME_CRP(%sp), %rp
bv,n %r0(%rp)
EXIT(swapcontext)
.end

View file

@ -1,4 +1,4 @@
/* $NetBSD: brk.S,v 1.4 2009/11/03 05:07:25 snj Exp $ */
/* $NetBSD: brk.S,v 1.5 2012/03/14 14:18:10 skrll Exp $ */
/* $OpenBSD: brk.S,v 1.7 2001/06/04 23:14:04 mickey Exp $ */
@ -31,11 +31,11 @@
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: brk.S,v 1.4 2009/11/03 05:07:25 snj Exp $")
RCSID("$NetBSD: brk.S,v 1.5 2012/03/14 14:18:10 skrll Exp $")
#endif /* LIBC_SCCS and not lint */
.import curbrk, data
.import end, data
.global _end
#ifdef WEAK_ALIAS
WEAK_ALIAS(brk, _brk)
@ -44,7 +44,7 @@
.data
.export __minbrk, data
__minbrk:
.long end
.long _end
ENTRY(_brk,0)
#ifdef PIC

View file

@ -1,4 +1,4 @@
/* $NetBSD: sbrk.S,v 1.4 2009/11/03 05:07:25 snj Exp $ */
/* $NetBSD: sbrk.S,v 1.5 2012/03/14 14:18:10 skrll Exp $ */
/* $OpenBSD: sbrk.S,v 1.7 2001/06/04 23:14:04 mickey Exp $ */
@ -31,10 +31,10 @@
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: sbrk.S,v 1.4 2009/11/03 05:07:25 snj Exp $")
RCSID("$NetBSD: sbrk.S,v 1.5 2012/03/14 14:18:10 skrll Exp $")
#endif /* LIBC_SCCS and not lint */
.import end, data
.global _end
#ifdef WEAK_ALIAS
WEAK_ALIAS(sbrk, _sbrk)
@ -43,7 +43,7 @@
.data
.export curbrk, data
curbrk:
.long end
.long _end
ENTRY(_sbrk,0)
#ifdef PIC

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile.inc,v 1.13 2008/02/09 02:41:06 mrg Exp $
# $NetBSD: Makefile.inc,v 1.14 2011/11/22 15:25:28 joerg Exp $
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S __mmap.S
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S __m68k_read_tp.S __mmap.S
ASM+= _lwp_getprivate.S mremap.S

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.30 2009/12/06 07:12:17 uebayasi Exp $
# $NetBSD: Makefile.inc,v 1.31 2011/11/22 15:25:28 joerg Exp $
SRCS+= alloca.S fabs.S
@ -26,6 +26,7 @@ SRCS+= ashlsi3.S ashrsi3.S \
negdf2.S negsf2.S
SRCS+= bswap16.S bswap32.S bswap64.S
SRCS+= _lwp.c
CPPFLAGS._lwp.c += -D_LIBC_SOURCE
# 68000-based machines build with a libgcc that includes
# much of the (soft)float and integer support that would

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: _lwp.c,v 1.8 2012/03/18 16:26:34 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,18 +31,19 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.8 2012/03/18 16:26:34 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <sys/tls.h>
#include <ucontext.h>
#include <lwp.h>
#include <stdlib.h>
void
_lwp_makecontext(ucontext_t *u, void (*start)(void *),
void *arg, void *private, caddr_t stack_base, size_t stack_size)
void *arg, void *tcb, caddr_t stack_base, size_t stack_size)
{
void **sp;
@ -54,10 +55,13 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *),
u->uc_mcontext.__gregs[_REG_PC] = (int)start;
sp = (void **) (stack_base + stack_size);
sp = (void **)(void *)(stack_base + stack_size);
*--sp = arg;
*--sp = (void *) _lwp_exit;
u->uc_mcontext.__gregs[_REG_A7] = (int) sp;
u->uc_mcontext._mc_tlsbase = (uintptr_t)tcb + TLS_TP_OFFSET +
sizeof(struct tls_tcb);
u->uc_flags |= _UC_TLSBASE;
}

View file

@ -18,18 +18,21 @@ fpgetsticky(void)
return 0;
}
/* ARGSUSED */
fp_except
fpsetmask(fp_except mask)
{
return 0;
}
/* ARGSUSED */
fp_rnd
fpsetround(fp_rnd rnd_dir)
{
return 0;
}
/* ARGSUSED */
fp_except
fpsetsticky(fp_except sticky)
{

View file

@ -1,4 +1,4 @@
/* $NetBSD: softfloat.h,v 1.2 2006/05/16 20:55:51 mrg Exp $ */
/* $NetBSD: softfloat.h,v 1.4 2011/07/07 07:14:57 matt Exp $ */
/* This is a derivative work. */
@ -84,12 +84,10 @@ Software IEC/IEEE floating-point rounding mode.
-------------------------------------------------------------------------------
*/
extern fp_rnd float_rounding_mode;
enum {
float_round_nearest_even = FP_RN,
float_round_to_zero = FP_RZ,
float_round_down = FP_RM,
float_round_up = FP_RP
};
#define float_round_nearest_even FP_RN
#define float_round_to_zero FP_RZ
#define float_round_down FP_RM
#define float_round_up FP_RP
/*
-------------------------------------------------------------------------------
@ -119,13 +117,17 @@ void float_raise( fp_except );
Software IEC/IEEE integer-to-floating-point conversion routines.
-------------------------------------------------------------------------------
*/
float32 int32_to_float32( int );
float64 int32_to_float64( int );
float32 int32_to_float32( int32 );
float32 uint32_to_float32( uint32 );
float64 int32_to_float64( int32 );
float64 uint32_to_float64( uint32 );
#ifdef FLOATX80
floatx80 int32_to_floatx80( int );
floatx80 int32_to_floatx80( int32 );
floatx80 uint32_to_floatx80( uint32 );
#endif
#ifdef FLOAT128
float128 int32_to_float128( int );
float128 int32_to_float128( int32 );
float128 uint32_to_float128( uint32 );
#endif
float32 int64_to_float32( long long );
float64 int64_to_float64( long long );

View file

@ -0,0 +1,7 @@
#include "SYS.h"
ENTRY(__m68k_read_tp)
SYSTRAP(_lwp_getprivate)
movl %d0,%a0
rts
.size __m68k_read_tp, .-__m68k_read_tp

View file

@ -1,4 +1,6 @@
# $NetBSD: Makefile.inc,v 1.9 2009/12/14 01:07:41 matt Exp $
# $NetBSD: Makefile.inc,v 1.12 2011/07/09 04:12:01 matt Exp $
.include <bsd.own.mk>
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S
@ -7,5 +9,17 @@ CPPFLAGS.assym.h+=-D__LIBC12_SOURCE__
.if ${MKSOFTFLOAT} != "no"
.include <softfloat/Makefile.inc>
CPPFLAGS+= -DSOFTFLOAT_NEED_FIXUNS
CPPFLAGS+= -DSOFTFLOAT
SRCS+= fixunsgen_ieee754.c fixunssfsi_ieee754.c fixunsdfsi_ieee754.c
SRCS+= fixunsgen64_ieee754.c #fixunssfdi.c fixunsdfdi.c
.if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el") \
&& (!defined(CPUFLAGS) || empty(CPUFLAGS:M-mabi=32))
SRCS+= fixunstfsi_ieee754.c fixunstfdi_ieee754.c
.endif
.endif
.if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el") \
&& (!defined(CPUFLAGS) || empty(CPUFLAGS:M-mabi=32))
SRCS+= floatunditf_ieee754.c
.endif

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.32 2011/01/17 23:53:03 matt Exp $
# $NetBSD: Makefile.inc,v 1.33 2011/03/15 07:40:18 matt Exp $
.if ${MKSOFTFLOAT} == "no"
SRCS+= fabs.S ldexp.S modf.S
@ -32,6 +32,8 @@ SRCS+= makecontext.c resumecontext.c _resumecontext.S swapcontext.S _lwp.c
# mips abi builtin extensions (used by GCC for lexical-closure trampoline)
SRCS+= cacheflush.c
CPPFLAGS._lwp.c += -D_LIBC_SOURCE
LSRCS.mips.gen= Lint__setjmp.c Lint_bswap16.c Lint_bswap32.c Lint_swapcontext.c
LSRCS+= ${LSRCS.mips.gen}
DPSRCS+= ${LSRCS.mips.gen}

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: _lwp.c,v 1.8 2011/04/29 08:05:22 matt Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.8 2011/04/29 08:05:22 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -40,10 +40,15 @@ __RCSID("$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:56 martin Exp $");
#include <lwp.h>
#include <stdlib.h>
#define CALLFRAME_SIZ 24
#if defined(__mips_o32) || defined(__mips_o64)
#define CALLFRAME_SIZ (6 * sizeof(void *))
#else
#define CALLFRAME_SIZ (4 * sizeof(uint64_t))
#endif
void _lwp_makecontext(ucontext_t *u, void (*start)(void *),
void *arg, void *private, caddr_t stack_base, size_t stack_size)
void
_lwp_makecontext(ucontext_t *u, void (*start)(void *),
void *arg, void *tcb, caddr_t stack_base, size_t stack_size)
{
caddr_t sp;
__greg_t *gr;
@ -56,9 +61,12 @@ void _lwp_makecontext(ucontext_t *u, void (*start)(void *),
u->uc_stack.ss_size = stack_size;
sp = stack_base + stack_size - CALLFRAME_SIZ;
gr[_REG_EPC] = (unsigned long) start;
gr[_REG_T9] = (unsigned long) start; /* required for .abicalls */
gr[_REG_RA] = (unsigned long) _lwp_exit;
gr[_REG_A0] = (unsigned long) arg;
gr[_REG_SP] = (unsigned long) sp;
gr[_REG_EPC] = (uintptr_t) start;
gr[_REG_T9] = (uintptr_t) start; /* required for .abicalls */
gr[_REG_RA] = (uintptr_t) _lwp_exit;
gr[_REG_A0] = (uintptr_t) arg;
gr[_REG_SP] = (uintptr_t) sp;
u->uc_mcontext._mc_tlsbase =
(uintptr_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb);
u->uc_flags |= _UC_TLSBASE;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: _resumecontext.S,v 1.6 2009/12/14 01:07:42 matt Exp $ */
/* $NetBSD: _resumecontext.S,v 1.7 2012/09/12 02:00:52 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#include "assym.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: _resumecontext.S,v 1.6 2009/12/14 01:07:42 matt Exp $")
RCSID("$NetBSD: _resumecontext.S,v 1.7 2012/09/12 02:00:52 manu Exp $")
#endif /* SYSLIBC_SCCS && !lint */
.set reorder
@ -53,7 +53,7 @@ LEAF_NOPROFILE(__resumecontext)
PTR_L a0, _OFFSETOF_UC_LINK(a0) # linked context?
beq a0, zero, 1f # nope, exit process
nop
SYSTRAP(setcontext) # yes, become it.
PIC_TAILCALL(setcontext) # yes, become it.
/* NOTREACHED (in theory) */
li a0, -1 # failure,
1:

View file

@ -1,4 +1,4 @@
/* $NetBSD: _setjmp.S,v 1.22 2010/09/03 17:22:51 matt Exp $ */
/* $NetBSD: _setjmp.S,v 1.24 2012/07/08 00:59:34 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -46,7 +46,7 @@
#if 0
RCSID("from: @(#)_setjmp.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: _setjmp.S,v 1.22 2010/09/03 17:22:51 matt Exp $")
RCSID("$NetBSD: _setjmp.S,v 1.24 2012/07/08 00:59:34 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@ -88,7 +88,6 @@ LEAF(_setjmp)
*/
#ifndef SOFTFLOAT_FOR_GCC
cfc1 v0, $31 # too bad cant check if FP used
INT_S v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
#if defined(__mips_n64) || defined(__mips_n32)
FP_S $f30, _OFFSETOF_SC_FPREGS_F30(a0)
FP_S $f28, _OFFSETOF_SC_FPREGS_F28(a0)
@ -109,11 +108,12 @@ LEAF(_setjmp)
FP_S $f29, _OFFSETOF_SC_FPREGS_F29(a0)
FP_S $f31, _OFFSETOF_SC_FPREGS_F31(a0)
#endif
INT_S v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
#endif /* SOFTFLOAT_FOR_GCC */
REG_EPILOGUE
j ra
move v0, zero
move v0, zero
END(_setjmp)
LEAF(_longjmp)
@ -139,11 +139,13 @@ LEAF(_longjmp)
#if defined(__mips_n32) || defined(__mips_n64)
REG_L gp, _OFFSETOF_SC_REGS_GP(a0)
#endif
#ifndef SOFTFLOAT_FOR_GCC
# get fpu status
INT_L v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
#endif
REG_L sp, _OFFSETOF_SC_REGS_SP(a0)
REG_L s8, _OFFSETOF_SC_REGS_S8(a0)
#ifndef SOFTFLOAT_FOR_GCC
INT_L v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
ctc1 v0, $31
/*
* In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
@ -173,9 +175,8 @@ LEAF(_longjmp)
#endif /* SOFTFLOAT_FOR_GCC */
REG_EPILOGUE
move v0, a1 # get return value in 1st arg
j ra
nop
move v0, a1 # get return value in 1st arg
botch:
/*
@ -183,6 +184,8 @@ botch:
* our caller's GP.
*/
jal _C_LABEL(longjmperror)
nop
PIC_TAILCALL(abort)
nop
END(_longjmp)

View file

@ -1,4 +1,4 @@
/* $NetBSD: cacheflush.c,v 1.4 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: cacheflush.c,v 1.6 2012/03/29 21:21:04 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -34,14 +34,12 @@
#include <mips/sysarch.h>
int
_cacheflush(addr, nbytes, whichcache)
void * addr;
int nbytes, whichcache;
_cacheflush(void *addr, size_t nbytes, int whichcache)
{
struct mips_cacheflush_args cfa;
cfa.va = (vaddr_t) addr;
cfa.va = (vaddr_t)(intptr_t)addr;
cfa.nbytes = nbytes;
cfa.whichcache = whichcache;
return (sysarch(MIPS_CACHEFLUSH, (void *)&cfa));
return sysarch(MIPS_CACHEFLUSH, (void *)&cfa);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: flt_rounds.c,v 1.6 2010/09/03 17:22:51 matt Exp $ */
/* $NetBSD: flt_rounds.c,v 1.7 2012/06/24 15:26:02 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.6 2010/09/03 17:22:51 matt Exp $");
__RCSID("$NetBSD: flt_rounds.c,v 1.7 2012/06/24 15:26:02 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <machine/float.h>
@ -21,7 +21,7 @@ static const int map[] = {
};
int
__flt_rounds()
__flt_rounds(void)
{
#ifdef SOFTFLOAT_FOR_GCC
return map[fpgetround()];

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetmask.c,v 1.8 2012/03/20 16:19:56 matt Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetmask.c,v 1.8 2012/03/20 16:19:56 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,9 +19,9 @@ __weak_alias(fpgetmask,_fpgetmask)
#endif
fp_except
fpgetmask()
fpgetmask(void)
{
int x;
fp_except x;
__asm("cfc1 %0,$31" : "=r" (x));
return (x >> 7) & 0x1f;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetround.c,v 1.6 2012/03/19 22:23:10 matt Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetround.c,v 1.6 2012/03/19 22:23:10 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,9 +19,9 @@ __weak_alias(fpgetround,_fpgetround)
#endif
fp_rnd
fpgetround()
fpgetround(void)
{
int x;
fp_rnd x;
__asm("cfc1 %0,$31" : "=r" (x));
return x & 0x03;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetsticky.c,v 1.8 2012/03/20 16:19:56 matt Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetsticky.c,v 1.8 2012/03/20 16:19:56 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,9 +19,9 @@ __weak_alias(fpgetsticky,_fpgetsticky)
#endif
fp_except
fpgetsticky()
fpgetsticky(void)
{
int x;
fp_except x;
__asm("cfc1 %0,$31" : "=r" (x));
return (x >> 2) & 0x1f;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetmask.c,v 1.8 2012/03/20 16:19:56 matt Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetmask.c,v 1.8 2012/03/20 16:19:56 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,16 +19,14 @@ __weak_alias(fpsetmask,_fpsetmask)
#endif
fp_except
fpsetmask(mask)
fp_except mask;
fpsetmask(fp_except mask)
{
fp_except old;
fp_except new;
__asm("cfc1 %0,$31" : "=r" (old));
new = old;
new &= ~(0x1f << 7);
new = old & ~(0x1f << 7);
new |= ((mask & 0x1f) << 7);
__asm("ctc1 %0,$31" : : "r" (new));

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetround.c,v 1.6 2012/03/19 22:23:10 matt Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetround.c,v 1.6 2012/03/19 22:23:10 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,17 +19,15 @@ __weak_alias(fpsetround,_fpsetround)
#endif
fp_rnd
fpsetround(rnd_dir)
fp_rnd rnd_dir;
fpsetround(fp_rnd rnd_dir)
{
fp_rnd old;
fp_rnd new;
__asm("cfc1 %0,$31" : "=r" (old));
new = old;
new &= ~0x03;
new |= (rnd_dir & 0x03);
new = old & ~0x03;
new |= rnd_dir & 0x03;
__asm("ctc1 %0,$31" : : "r" (new));

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetsticky.c,v 1.8 2012/03/20 16:19:56 matt Exp $ */
/*
* Written by J.T. Conklin, Apr 11, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetsticky.c,v 1.8 2012/03/20 16:19:56 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,17 +19,15 @@ __weak_alias(fpsetsticky,_fpsetsticky)
#endif
fp_except
fpsetsticky(sticky)
fp_except sticky;
fpsetsticky(fp_except sticky)
{
fp_except old;
fp_except new;
__asm("cfc1 %0,$31" : "=r" (old));
new = old;
new &= ~(0x1f << 2);
new |= ((sticky & 0x1f) << 2);
new = old & ~(0x1f << 2);
new |= (sticky & 0x1f) << 2;
__asm("ctc1 %0,$31" : : "r" (new));

View file

@ -1,4 +1,4 @@
/* $NetBSD: longjmp.c,v 1.4 2010/09/03 17:22:51 matt Exp $ */
/* $NetBSD: longjmp.c,v 1.5 2012/03/29 19:27:05 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -49,7 +49,7 @@ __longjmp14(jmp_buf env, int val)
ucontext_t uc;
/* Ensure non-zero SP and sigcontext magic number is present */
if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != (mips_reg_t)0xACEDBADE)
if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != (mips_reg_t)0xACEDBADEU)
goto err;
/* Ensure non-zero return value */

View file

@ -1,4 +1,4 @@
/* $NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $ */
/* $NetBSD: makecontext.c,v 1.7 2011/09/20 08:42:29 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $");
__RCSID("$NetBSD: makecontext.c,v 1.7 2011/09/20 08:42:29 joerg Exp $");
#endif
#include <inttypes.h>
@ -41,6 +41,8 @@ __RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $");
#include <stdarg.h>
void __resumecontext(void) __dead;
void
makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
{
@ -49,8 +51,6 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
int i;
va_list ap;
void __resumecontext(void);
/* LINTED uintptr_t is safe */
sp = (__greg_t *)
((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);

View file

@ -1,4 +1,4 @@
/* $NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:57 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:57 joerg Exp $");
#endif
#include "namespace.h"
@ -41,7 +41,7 @@ __RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:56 martin Exp $");
#include "extern.h"
void
_resumecontext()
_resumecontext(void)
{
ucontext_t uct;

View file

@ -1,4 +1,4 @@
/* $NetBSD: swapcontext.S,v 1.4 2009/12/14 01:07:42 matt Exp $ */
/* $NetBSD: swapcontext.S,v 1.5 2012/09/12 02:00:52 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -33,7 +33,7 @@
#include "assym.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: swapcontext.S,v 1.4 2009/12/14 01:07:42 matt Exp $")
RCSID("$NetBSD: swapcontext.S,v 1.5 2012/09/12 02:00:52 manu Exp $")
#endif /* SYSLIBC_SCCS && !lint */
.set reorder
@ -57,7 +57,7 @@ NESTED(swapcontext, CALLFRAME_SIZ, ra)
REG_S v0, _OFFSETOF_UC_GREGS_SP(v1)
REG_EPILOGUE
SYSTRAP(setcontext)
PIC_TAILCALL(setcontext)
/* NOTREACHED */
1:
PTR_ADDU sp, sp, CALLFRAME_SIZ

View file

@ -1,4 +1,4 @@
/* $NetBSD: mips-gcc.h,v 1.2 2009/12/14 01:07:42 matt Exp $ */
/* $NetBSD: mips-gcc.h,v 1.5 2011/06/27 06:40:26 matt Exp $ */
/*
-------------------------------------------------------------------------------
@ -85,7 +85,7 @@ to be `static'.
/*
-------------------------------------------------------------------------------
The ARM FPA is odd in that it stores doubles high-order word first, no matter
The MIPS FPA is odd in that it stores doubles high-order word first, no matter
what the endianness of the CPU. VFP is sane.
-------------------------------------------------------------------------------
*/

View file

@ -1,4 +1,4 @@
/* $NetBSD: softfloat.h,v 1.3 2011/01/17 23:53:04 matt Exp $ */
/* $NetBSD: softfloat.h,v 1.5 2011/07/07 07:14:57 matt Exp $ */
/* This is a derivative work. */
@ -86,12 +86,10 @@ Software IEC/IEEE floating-point rounding mode.
-------------------------------------------------------------------------------
*/
extern fp_rnd float_rounding_mode;
enum {
float_round_nearest_even = FP_RN,
float_round_to_zero = FP_RZ,
float_round_down = FP_RM,
float_round_up = FP_RP
};
#define float_round_nearest_even FP_RN
#define float_round_to_zero FP_RZ
#define float_round_down FP_RM
#define float_round_up FP_RP
/*
-------------------------------------------------------------------------------
@ -121,13 +119,17 @@ void float_raise( fp_except );
Software IEC/IEEE integer-to-floating-point conversion routines.
-------------------------------------------------------------------------------
*/
float32 int32_to_float32( int );
float64 int32_to_float64( int );
float32 int32_to_float32( int32 );
float32 uint32_to_float32( uint32 );
float64 int32_to_float64( int32 );
float64 uint32_to_float64( uint32 );
#ifdef FLOATX80
floatx80 int32_to_floatx80( int );
floatx80 int32_to_floatx80( int32 );
floatx80 uint32_to_floatx80( uint32 );
#endif
#ifdef FLOAT128
float128 int32_to_float128( int );
float128 int32_to_float128( int32 );
float128 uint32_to_float128( uint32 );
#endif
#ifndef SOFTFLOAT_FOR_GCC /* __floatdi?f is in libgcc2.c */
float32 int64_to_float32( long long );

View file

@ -1,4 +1,4 @@
/* $NetBSD: cerror.S,v 1.16 2011/01/17 23:34:44 matt Exp $ */
/* $NetBSD: cerror.S,v 1.18 2012/02/27 14:48:34 tsutsui Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -38,12 +38,12 @@
#if 0
RCSID("from: @(#)cerror.s 8.1 (Berkeley) 6/16/93")
#else
RCSID("$NetBSD: cerror.S,v 1.16 2011/01/17 23:34:44 matt Exp $")
RCSID("$NetBSD: cerror.S,v 1.18 2012/02/27 14:48:34 tsutsui Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#ifdef PIC
.hidden __cerror
.protected __cerror
#endif
#ifdef _REENTRANT

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.24 2009/12/06 07:12:17 uebayasi Exp $
# $NetBSD: Makefile.inc,v 1.25 2011/03/12 07:55:09 matt Exp $
SRCS+= __setjmp14.S __sigsetjmp14.S _setjmp.S
SRCS+= bswap16.c bswap32.c bswap64.c
@ -21,6 +21,8 @@ SRCS+= fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c
SRCS+= fpgetsticky.c fpsetsticky.c
.endif
CPPFLAGS._lwp.c += -D_LIBC_SOURCE
LSRCS.powerpc.gen=Lint_swapcontext.c
LSRCS+= ${LSRCS.powerpc.gen}
DPSRCS+= ${LSRCS.powerpc.gen}

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.4 2005/06/12 05:21:26 lukem Exp $ */
/* $NetBSD: _lwp.c,v 1.7 2012/03/22 05:36:50 matt Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -37,10 +37,11 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.4 2005/06/12 05:21:26 lukem Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.7 2012/03/22 05:36:50 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/param.h>
#include <sys/types.h>
#include <ucontext.h>
#include <lwp.h>
@ -48,9 +49,9 @@ __RCSID("$NetBSD: _lwp.c,v 1.4 2005/06/12 05:21:26 lukem Exp $");
void
_lwp_makecontext(ucontext_t *u, void (*start)(void *), void *arg,
void *private, caddr_t stack_base, size_t stack_size)
void *tcb, caddr_t stack_base, size_t stack_size)
{
void **sp;
uintptr_t sp;
getcontext(u);
u->uc_link = NULL;
@ -58,10 +59,14 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), void *arg,
u->uc_stack.ss_sp = stack_base;
u->uc_stack.ss_size = stack_size;
sp = (void **) (stack_base + stack_size);
sp = (uintptr_t)stack_base + stack_size;
sp -= STACK_ALIGNBYTES + 1;
sp &= ~STACK_ALIGNBYTES;
u->uc_mcontext.__gregs[3] = (int) arg; /* arg1 */
u->uc_mcontext.__gregs[1] = ((int) sp) - 12; /* stack */
u->uc_mcontext.__gregs[33] = (int) _lwp_exit; /* LR */
u->uc_mcontext.__gregs[34] = (int) start; /* PC */
u->uc_mcontext.__gregs[3] = (uintptr_t) arg; /* arg1 */
u->uc_mcontext.__gregs[1] = sp; /* stack */
u->uc_mcontext.__gregs[33] = (uintptr_t) _lwp_exit; /* LR */
u->uc_mcontext.__gregs[34] = (uintptr_t) start; /* PC */
u->uc_mcontext.__gregs[_REG_R2] =
(uintptr_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: flt_rounds.c,v 1.10 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: flt_rounds.c,v 1.11 2011/07/10 21:18:47 matt Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.10 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: flt_rounds.c,v 1.11 2011/07/10 21:18:47 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include <ieeefp.h>
@ -54,9 +54,12 @@ __flt_rounds(void)
#ifdef _SOFT_FLOAT
return map[fpgetround()];
#else
uint64_t fpscr;
union {
double u_d;
uint64_t u_fpscr;
} ud;
__asm volatile("mffs %0" : "=f"(fpscr));
return map[((uint32_t)fpscr & FPSCR_RN)];
__asm volatile("mffs %0" : "=f"(ud.u_d));
return map[((uint32_t)ud.u_fpscr & FPSCR_RN)];
#endif
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetmask.c,v 1.9 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: fpgetmask.c,v 1.10 2011/07/10 21:18:47 matt Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetmask.c,v 1.9 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: fpgetmask.c,v 1.10 2011/07/10 21:18:47 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -50,8 +50,11 @@ __weak_alias(fpgetmask,_fpgetmask)
fp_except
fpgetmask(void)
{
uint64_t fpscr;
union {
double u_d;
uint64_t u_fpscr;
} ud;
__asm volatile("mffs %0" : "=f"(fpscr));
return (((uint32_t)fpscr & MASKBITS) >> MASKSHFT);
__asm volatile("mffs %0" : "=f"(ud.u_d));
return (((uint32_t)ud.u_fpscr & MASKBITS) >> MASKSHFT);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetround.c,v 1.9 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: fpgetround.c,v 1.10 2011/07/10 21:18:47 matt Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetround.c,v 1.9 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: fpgetround.c,v 1.10 2011/07/10 21:18:47 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -50,8 +50,11 @@ __weak_alias(fpgetround,_fpgetround)
fp_rnd
fpgetround(void)
{
uint64_t fpscr;
union {
double u_d;
uint64_t u_fpscr;
} ud;
__asm volatile("mffs %0" : "=f"(fpscr));
return (((uint32_t)fpscr & ROUNDBITS) >> ROUNDSHFT);
__asm volatile("mffs %0" : "=f"(ud.u_d));
return (((uint32_t)ud.u_fpscr & ROUNDBITS) >> ROUNDSHFT);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetsticky.c,v 1.9 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: fpgetsticky.c,v 1.10 2011/07/10 21:18:47 matt Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetsticky.c,v 1.9 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: fpgetsticky.c,v 1.10 2011/07/10 21:18:47 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -50,8 +50,11 @@ __weak_alias(fpgetsticky,_fpgetsticky)
fp_except
fpgetsticky(void)
{
uint64_t fpscr;
union {
double u_d;
uint64_t u_fpscr;
} ud;
__asm volatile("mffs %0" : "=f"(fpscr));
return (((uint32_t)fpscr & STICKYBITS) >> STICKYSHFT);
__asm volatile("mffs %0" : "=f"(ud.u_d));
return (((uint32_t)ud.u_fpscr & STICKYBITS) >> STICKYSHFT);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetmask.c,v 1.9 2008/04/28 20:22:56 martin Exp $ */
/* $NetBSD: fpsetmask.c,v 1.10 2011/07/10 21:18:47 matt Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetmask.c,v 1.9 2008/04/28 20:22:56 martin Exp $");
__RCSID("$NetBSD: fpsetmask.c,v 1.10 2011/07/10 21:18:47 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -50,13 +50,16 @@ __weak_alias(fpsetmask,_fpsetmask)
fp_except
fpsetmask(fp_except mask)
{
uint64_t fpscr;
union {
double u_d;
uint64_t u_fpscr;
} ud;
fp_except old;
__asm volatile("mffs %0" : "=f"(fpscr));
old = ((uint32_t)fpscr & MASKBITS) >> MASKSHFT;
fpscr &= ~MASKBITS;
fpscr |= ((uint32_t)mask << MASKSHFT) & MASKBITS;
__asm volatile("mtfsf 0xff,%0" :: "f"(fpscr));
__asm volatile("mffs %0" : "=f"(ud.u_d));
old = ((uint32_t)ud.u_fpscr & MASKBITS) >> MASKSHFT;
ud.u_fpscr &= ~MASKBITS;
ud.u_fpscr |= ((uint32_t)mask << MASKSHFT) & MASKBITS;
__asm volatile("mtfsf 0xff,%0" :: "f"(ud.u_d));
return (old);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetround.c,v 1.9 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: fpsetround.c,v 1.10 2011/07/10 21:18:47 matt Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.9 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: fpsetround.c,v 1.10 2011/07/10 21:18:47 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -49,13 +49,16 @@ __weak_alias(fpsetround,_fpsetround)
fp_rnd
fpsetround(fp_rnd rnd_dir)
{
uint64_t fpscr;
union {
double u_d;
uint64_t u_fpscr;
} ud;
fp_rnd old;
__asm volatile("mffs %0" : "=f"(fpscr));
old = (uint32_t)fpscr & ROUNDBITS;
fpscr &= ~ROUNDBITS;
fpscr |= rnd_dir & ROUNDBITS;
__asm volatile("mtfsf 0xff,%0" :: "f"(fpscr));
__asm volatile("mffs %0" : "=f"(ud.u_d));
old = (uint32_t)ud.u_fpscr & ROUNDBITS;
ud.u_fpscr &= ~ROUNDBITS;
ud.u_fpscr |= rnd_dir & ROUNDBITS;
__asm volatile("mtfsf 0xff,%0" :: "f"(ud.u_d));
return (old);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetsticky.c,v 1.10 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: fpsetsticky.c,v 1.11 2011/07/10 21:18:47 matt Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetsticky.c,v 1.10 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: fpsetsticky.c,v 1.11 2011/07/10 21:18:47 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -53,32 +53,35 @@ __weak_alias(fpsetsticky,_fpsetsticky)
fp_except
fpsetsticky(fp_except mask)
{
uint64_t fpscr;
union {
double u_d;
uint64_t u_fpscr;
} ud;
fp_except old;
__asm volatile("mffs %0" : "=f"(fpscr));
old = ((uint32_t)fpscr & STICKYBITS) >> STICKYSHFT;
__asm volatile("mffs %0" : "=f"(ud.u_d));
old = ((uint32_t)ud.u_fpscr & STICKYBITS) >> STICKYSHFT;
/*
* FPSCR_VX (aka FP_X_INV) is not a sticky bit but a summary of the
* all the FPSCR_VX* sticky bits. So when FP_X_INV is cleared then
* clear all of those bits, likewise when it's set, set them all.
*/
if ((mask & FP_X_INV) == 0)
fpscr &= ~INVBITS;
ud.u_fpscr &= ~INVBITS;
else
fpscr |= INVBITS;
fpscr &= ~STICKYBITS;
fpscr |= ((uint32_t)mask << STICKYSHFT) & STICKYBITS;
ud.u_fpscr |= INVBITS;
ud.u_fpscr &= ~STICKYBITS;
ud.u_fpscr |= ((uint32_t)mask << STICKYSHFT) & STICKYBITS;
/*
* Make FPSCR_FX reflect the presence of a set sticky bit (or not).
*/
if (fpscr & (STICKYBITS|INVBITS))
fpscr |= FPSCR_FX;
if (ud.u_fpscr & (STICKYBITS|INVBITS))
ud.u_fpscr |= FPSCR_FX;
else
fpscr &= ~FPSCR_FX;
ud.u_fpscr &= ~FPSCR_FX;
/*
* Write back the fpscr.
*/
__asm volatile("mtfsf 0xff,%0" :: "f"(fpscr));
__asm volatile("mtfsf 0xff,%0" :: "f"(ud.u_d));
return (old);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:58 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:58 joerg Exp $");
#endif
#include "namespace.h"
@ -41,7 +41,7 @@ __RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $");
#include "extern.h"
void
_resumecontext()
_resumecontext(void)
{
ucontext_t uct;

View file

@ -1,4 +1,4 @@
/* $NetBSD: softfloat.h,v 1.5 2006/05/16 20:55:51 mrg Exp $ */
/* $NetBSD: softfloat.h,v 1.7 2011/07/07 07:14:57 matt Exp $ */
/* This is a derivative work. */
@ -84,12 +84,10 @@ Software IEC/IEEE floating-point rounding mode.
-------------------------------------------------------------------------------
*/
extern fp_rnd float_rounding_mode;
enum {
float_round_nearest_even = FP_RN,
float_round_to_zero = FP_RZ,
float_round_down = FP_RM,
float_round_up = FP_RP
};
#define float_round_nearest_even FP_RN
#define float_round_to_zero FP_RZ
#define float_round_down FP_RM
#define float_round_up FP_RP
/*
-------------------------------------------------------------------------------
@ -119,13 +117,17 @@ void float_raise( fp_except );
Software IEC/IEEE integer-to-floating-point conversion routines.
-------------------------------------------------------------------------------
*/
float32 int32_to_float32( int );
float64 int32_to_float64( int );
float32 int32_to_float32( int32 );
float32 uint32_to_float32( uint32 );
float64 int32_to_float64( int32 );
float64 uint32_to_float64( uint32 );
#ifdef FLOATX80
floatx80 int32_to_floatx80( int );
floatx80 int32_to_floatx80( int32 );
floatx80 uint32_to_floatx80( uint32 );
#endif
#ifdef FLOAT128
float128 int32_to_float128( int );
float128 int32_to_float128( int32 );
float128 uint32_to_float128( uint32 );
#endif
float32 int64_to_float32( long long );
float64 int64_to_float64( long long );

View file

@ -1,4 +1,4 @@
/* $NetBSD: bzero.S,v 1.10 2011/01/19 02:47:01 matt Exp $ */
/* $NetBSD: bzero.S,v 1.11 2011/01/29 02:21:20 matt Exp $ */
/*-
* Copyright (C) 2001 Martin J. Laubach <mjl@NetBSD.org>
@ -32,7 +32,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: bzero.S,v 1.10 2011/01/19 02:47:01 matt Exp $")
__RCSID("$NetBSD: bzero.S,v 1.11 2011/01/29 02:21:20 matt Exp $")
#endif /* LIBC_SCCS && !lint */
#ifdef _KERNEL
@ -60,10 +60,10 @@ ENTRY(bzero)
END(bzero)
ENTRY(memset)
cmplwi cr1, %r5, 0
cmplwi %cr1, %r5, 0
mr. %r0, %r4
mr %r8, %r3
beqlr- cr1 /* Nothing to do */
beqlr- %cr1 /* Nothing to do */
rlwimi %r0, %r4, 8, 16, 23 /* word extend fill value */
rlwimi %r0, %r0, 16, 0, 15
@ -167,8 +167,8 @@ cb_memset:
lwz %r30, R30_SAVE(%r1)
#endif
addi %r1, %r1, STKFRAME_SZ
lwz %r0, 4(%r1)
mtlr %r0
lwz %r7, 4(%r1)
mtlr %r7
cntlzw %r6, %r9 /* compute shift value */
li %r5, 31
@ -213,10 +213,10 @@ cb_cacheline_known:
#endif /* _KERNEL */
/* Back in memory filling business */
cmplwi cr1, r_len, 0 /* Nothing to do? */
cmplwi %cr1, r_len, 0 /* Nothing to do? */
add %r5, %r9, %r9
cmplw r_len, %r5 /* <= 2*CL bytes to move? */
beqlr- cr1 /* then do nothing */
beqlr- %cr1 /* then do nothing */
blt+ simple_fill /* a trivial fill routine */
@ -277,9 +277,9 @@ cb_aligned_cb: /* no need to check r_len, see above */
bdnz 1b
cblocks_done: /* still CL aligned, but less than CL bytes left */
cmplwi cr1, r_len, 0
cmplwi %cr1, r_len, 0
cmplwi r_len, 8
beq- cr1, sf_return
beq- %cr1, sf_return
blt- sf_bytewise /* <8 remaining? */
b sf_aligned_w
@ -292,12 +292,12 @@ wbzero: li r_val, 0
simple_fill:
#if USE_STSWX
cmplwi cr1, r_len, 12 /* < 12 bytes to move? */
cmplwi %cr1, r_len, 12 /* < 12 bytes to move? */
#else
cmplwi cr1, r_len, 8 /* < 8 bytes to move? */
cmplwi %cr1, r_len, 8 /* < 8 bytes to move? */
#endif
andi. %r5, r_dst, 0x03 /* bytes to fill to align4 */
blt cr1, sf_bytewise /* trivial byte mover */
blt %cr1, sf_bytewise /* trivial byte mover */
li %r6, 4
subf %r5, %r5, %r6

View file

@ -1,17 +1,17 @@
/* $NetBSD: cerror.S,v 1.8 2011/01/16 02:43:10 matt Exp $ */
/* $NetBSD: cerror.S,v 1.10 2012/02/27 15:47:11 matt Exp $ */
#include "SYS.h"
#include "assym.h"
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: cerror.S,v 1.8 2011/01/16 02:43:10 matt Exp $")
__RCSID("$NetBSD: cerror.S,v 1.10 2012/02/27 15:47:11 matt Exp $")
#endif /* LIBC_SCCS && !lint */
#ifndef _REENTRANT
.globl _C_LABEL(errno)
#endif
#ifdef PIC
.hidden _C_LABEL(__cerror)
.protected _C_LABEL(__cerror)
#endif
ENTRY(__cerror)

View file

@ -1,4 +1,4 @@
/* $NetBSD: resumecontext.c,v 1.3 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: resumecontext.c,v 1.4 2011/09/19 21:24:58 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: resumecontext.c,v 1.3 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: resumecontext.c,v 1.4 2011/09/19 21:24:58 joerg Exp $");
#endif
#include "namespace.h"
@ -41,7 +41,7 @@ __RCSID("$NetBSD: resumecontext.c,v 1.3 2008/04/28 20:22:57 martin Exp $");
#include "extern.h"
void
_resumecontext()
_resumecontext(void)
{
ucontext_t uct;

View file

@ -1,4 +1,4 @@
/* $NetBSD: swapcontext.S,v 1.3 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: swapcontext.S,v 1.4 2012/09/12 02:00:52 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
.text
.asciz "$NetBSD: swapcontext.S,v 1.3 2008/04/28 20:22:57 martin Exp $"
.asciz "$NetBSD: swapcontext.S,v 1.4 2012/09/12 02:00:52 manu Exp $"
#endif /* LIBC_SCCS && !lint */
ENTRY(swapcontext)
@ -52,8 +52,8 @@ ENTRY(swapcontext)
std %r0,mc_off+34*8(%r11) # pc <- lr
la %r0,16(%r1)
std %r0,mc_off+1*8(%r11) # adjust sp
ld %r3,SF_PARAM+8(%r1) # load ucp
bl .setcontext # setcontext(ucp)
ld %r3,SF_PARAM+8(%r1) # load ucp
bl PIC_PLT(_C_LABEL(setcontext)) # setcontext(ucp)
nop
1:
ld %r0,SF_SZ+SF_LR(%r1)

View file

@ -1,4 +1,4 @@
/* $NetBSD: brk.S,v 1.3 2006/07/07 06:50:06 ross Exp $ */
/* $NetBSD: brk.S,v 1.4 2011/10/29 16:03:33 christos Exp $ */
#include "SYS.h"
@ -37,4 +37,5 @@ ENTRY(_brk)
blr # return 0
1:
b .__cerror
b PIC_PLT(_C_LABEL(__cerror))

View file

@ -1,4 +1,4 @@
/* $NetBSD: cerror.S,v 1.1 2006/07/01 16:37:20 ross Exp $ */
/* $NetBSD: cerror.S,v 1.4 2012/02/27 15:47:11 matt Exp $ */
#include <machine/asm.h>
#include "SYS.h"
@ -6,6 +6,9 @@
#ifndef _REENTRANT
.globl _C_LABEL(errno)
#endif
#ifdef PIC
.protected _C_LABEL(__cerror)
#endif
ENTRY(__cerror)
#ifdef _REENTRANT

View file

@ -1,4 +1,4 @@
/* $NetBSD: getcontext.S,v 1.3 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: getcontext.S,v 1.4 2011/10/29 16:03:33 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -33,7 +33,7 @@
#if defined(SYSLIBC_SCCS) && !defined(lint)
.text
.asciz "$NetBSD: getcontext.S,v 1.3 2008/04/28 20:22:57 martin Exp $"
.asciz "$NetBSD: getcontext.S,v 1.4 2011/10/29 16:03:33 christos Exp $"
#endif /* SYSLIBC_SCCS && !lint */
#ifdef WEAK_ALIAS
@ -50,4 +50,4 @@ ENTRY(_getcontext)
stw %r3,(48 + 3 * 4)(%r5) # arrange for return value 0
blr
1:
b .__cerror
b PIC_PLT(_C_LABEL(__cerror))

View file

@ -30,16 +30,17 @@
* SUCH DAMAGE.
*
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
* $NetBSD: SYS.h,v 1.9 2006/01/06 06:19:20 uwe Exp $
* $NetBSD: SYS.h,v 1.10 2011/01/23 14:08:53 joerg Exp $
*/
#include <machine/asm.h>
#include <sys/syscall.h>
#ifdef __STDC__
#define IMMEDIATE #
#define SYSTRAP(x) \
mov.l 903f, r0; \
.long 0xc380; /* trapa #0x80 */ \
trapa IMMEDIATE 0x80; \
bra 904f; \
nop; \
.align 2; \

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.4 2005/06/12 05:21:26 lukem Exp $ */
/* $NetBSD: _lwp.c,v 1.6 2012/03/22 09:32:04 he Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.4 2005/06/12 05:21:26 lukem Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.6 2012/03/22 09:32:04 he Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -50,7 +50,7 @@ void
_lwp_makecontext(ucontext_t *u, void (*start)(void *),
void *arg, void *private, caddr_t stack_base, size_t stack_size)
{
void **sp;
uintptr_t sp;
getcontext(u);
u->uc_link = NULL;
@ -58,10 +58,11 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *),
u->uc_stack.ss_sp = stack_base;
u->uc_stack.ss_size = stack_size;
sp = (void **) (stack_base + stack_size);
sp = (uintptr_t)stack_base + stack_size;
u->uc_mcontext.__gregs[_REG_R4] = (__greg_t) arg;
u->uc_mcontext.__gregs[_REG_SP] = ((__greg_t) sp) & ~3;
u->uc_mcontext.__gregs[_REG_PR] = (__greg_t) _lwp_exit;
u->uc_mcontext.__gregs[_REG_PC] = (__greg_t) start;
u->uc_mcontext.__gregs[_REG_GBR] = (__greg_t) private;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: flt_rounds.c,v 1.4 2007/01/17 23:24:22 hubertf Exp $ */
/* $NetBSD: flt_rounds.c,v 1.5 2012/03/22 08:58:39 he Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.4 2007/01/17 23:24:22 hubertf Exp $");
__RCSID("$NetBSD: flt_rounds.c,v 1.5 2012/03/22 08:58:39 he Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -75,7 +75,7 @@ static const int map[] = {
extern int __flt_rounds __P((void));
int
__flt_rounds()
__flt_rounds(void)
{
return(map[fpgetround()]);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:58 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:58 joerg Exp $");
#endif
#include "namespace.h"
@ -41,7 +41,7 @@ __RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $");
#include "extern.h"
void
_resumecontext()
_resumecontext(void)
{
ucontext_t uct;

View file

@ -1,4 +1,4 @@
/* $NetBSD: softfloat.h,v 1.9 2006/05/16 20:55:51 mrg Exp $ */
/* $NetBSD: softfloat.h,v 1.11 2011/07/07 07:14:57 matt Exp $ */
/* This is a derivative work. */
@ -84,12 +84,10 @@ Software IEC/IEEE floating-point rounding mode.
-------------------------------------------------------------------------------
*/
extern fp_rnd float_rounding_mode;
enum {
float_round_nearest_even = FP_RN,
float_round_to_zero = FP_RZ,
float_round_down = FP_RM,
float_round_up = FP_RP
};
#define float_round_nearest_even FP_RN
#define float_round_to_zero FP_RZ
#define float_round_down FP_RM
#define float_round_up FP_RP
/*
-------------------------------------------------------------------------------
@ -119,13 +117,17 @@ void float_raise( fp_except );
Software IEC/IEEE integer-to-floating-point conversion routines.
-------------------------------------------------------------------------------
*/
float32 int32_to_float32( int );
float64 int32_to_float64( int );
float32 int32_to_float32( int32 );
float32 uint32_to_float32( uint32 );
float64 int32_to_float64( int32 );
float64 uint32_to_float64( uint32 );
#ifdef FLOATX80
floatx80 int32_to_floatx80( int );
floatx80 int32_to_floatx80( int32 );
floatx80 uint32_to_floatx80( uint32 );
#endif
#ifdef FLOAT128
float128 int32_to_float128( int );
float128 int32_to_float128( int32 );
float128 uint32_to_float128( uint32 );
#endif
#ifndef SOFTFLOAT_FOR_GCC /* __floatdi?f is in libgcc2.c */
float32 int64_to_float32( long long );

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.13 2008/10/26 07:43:07 mrg Exp $
# $NetBSD: Makefile.inc,v 1.14 2011/04/12 03:35:47 mrg Exp $
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S
@ -9,24 +9,28 @@ CLEANFILES+=rem.S sdiv.S udiv.S urem.S
sdiv.S: ${LIBCDIR}/arch/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@rm -f ${.TARGET}
@(echo "define(NAME,\`.div')define(OP,\`div')define(S,\`true')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}
udiv.S: ${LIBCDIR}/arch/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@rm -f ${.TARGET}
@(echo "define(NAME,\`.udiv')define(OP,\`div')define(S,\`false')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}
rem.S: ${LIBCDIR}/arch/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@rm -f ${.TARGET}
@(echo "define(NAME,\`.rem')define(OP,\`rem')define(S,\`true')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}
urem.S: ${LIBCDIR}/arch/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@rm -f ${.TARGET}
@(echo "define(NAME,\`.urem')define(OP,\`rem')define(S,\`false')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}

View file

@ -33,7 +33,7 @@
* @(#)SYS.h 8.1 (Berkeley) 6/4/93
*
* from: Header: SYS.h,v 1.2 92/07/03 18:57:00 torek Exp
* $NetBSD: SYS.h,v 1.17 2007/10/08 13:06:00 uwe Exp $
* $NetBSD: SYS.h,v 1.18 2011/03/28 11:19:12 martin Exp $
*/
#include <machine/asm.h>
@ -59,10 +59,10 @@
*/
#ifdef PIC
#define CALL(name) \
PIC_PROLOGUE(%g1, %g2); \
set name, %g2; \
ld [%g1 + %g2], %g2; \
jmp %g2; \
PIC_PROLOGUE(%g1, %g5); \
set name, %g5; \
ld [%g1 + %g5], %g5; \
jmp %g5; \
nop
#else
#define CALL(name) \
@ -91,15 +91,15 @@ ENTRY(x); \
/*
* RSYSCALL is used when the system call should just return. Here we
* use the SYSCALL_G2RFLAG to put the `success' return address in %g2
* use the SYSCALL_G5RFLAG to put the `success' return address in %g5
* and avoid a branch.
*
* PSEUDO(x,y) is like RSYSCALL(y), except that the name is x.
*/
#define _RSYSCALL(x,y) \
ENTRY(x); \
mov (_CAT(SYS_,y)) | SYSCALL_G2RFLAG, %g1; \
add %o7, 8, %g2; \
mov (_CAT(SYS_,y)) | SYSCALL_G5RFLAG, %g1; \
add %o7, 8, %g5; \
t ST_SYSCALL; \
ERROR()
@ -141,8 +141,8 @@ ENTRY(x); \
*/
#define _RSYSCALL_NOERROR(x,y) \
ENTRY(x); \
mov (_CAT(SYS_,y)) | SYSCALL_G2RFLAG, %g1; \
add %o7, 8, %g2; \
mov (_CAT(SYS_,y)) | SYSCALL_G5RFLAG, %g1; \
add %o7, 8, %g5; \
t ST_SYSCALL
#define RSYSCALL_NOERROR(x) _RSYSCALL_NOERROR(x,x)

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: _lwp.c,v 1.7 2012/03/21 00:34:04 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.7 2012/03/21 00:34:04 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -53,7 +53,7 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), void *arg,
u->uc_stack.ss_size = stack_size;
sp = (ulong *)(stack_base + stack_size);
sp = (void *)(stack_base + stack_size);
sp = (ulong *)((ulong)sp & ~0x07);
/* Make room for the fake caller stack frame (CCFSZ, only in words) */
@ -65,6 +65,7 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), void *arg,
gr[_REG_O0] = (ulong)arg;
gr[_REG_O6] = (ulong)sp;
gr[_REG_O7] = (ulong)_lwp_exit - 8;
gr[_REG_G7] = (ulong)private;
/* XXX: uwe: why do we need this? */
/* create loopback in the window save area on the stack? */

View file

@ -1,4 +1,4 @@
/* $NetBSD: _setjmp.S,v 1.8 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: _setjmp.S,v 1.9 2011/04/30 23:41:12 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -33,7 +33,7 @@
#include <machine/trap.h>
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: _setjmp.S,v 1.8 2008/04/28 20:22:57 martin Exp $")
RCSID("$NetBSD: _setjmp.S,v 1.9 2011/04/30 23:41:12 martin Exp $")
#endif /* LIBC_SCCS and not lint */
/*
@ -47,6 +47,12 @@ RCSID("$NetBSD: _setjmp.S,v 1.8 2008/04/28 20:22:57 martin Exp $")
*/
ENTRY(_setjmp)
/* store important globals, sigsetjmp compatible */
st %g3, [%o0 + 16]
st %g2, [%o0 + 24]
st %g4, [%o0 + 48]
st %g7, [%o0 + 52]
st %sp, [%o0+0] /* store caller's stack pointer */
st %o7, [%o0+4] /* and the return pc */
retl
@ -60,6 +66,12 @@ ENTRY(_longjmp)
0:
t ST_FLUSHWIN ! flush register windows out to the stack
/* restore globals */
ld [%o0 + 16], %g3
ld [%o0 + 24], %g2
ld [%o0 + 48], %g4
ld [%o0 + 52], %g7
/*
* We restore the saved stack pointer to %fp, then issue
* a `restore' instruction which will reload the register

View file

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: Header: divrem.m4,v 1.4 92/06/25 13:23:57 torek Exp
* $NetBSD: divrem.m4,v 1.5 2003/08/07 16:42:23 agc Exp $
* $NetBSD: divrem.m4,v 1.6 2011/03/23 20:54:35 martin Exp $
*/
/*
@ -89,7 +89,7 @@ define(V, `%o5')
/* m4 reminder: ifelse(a,b,c,d) => if a is b, then c, else d */
define(T, `%g1')
define(SC, `%g7')
define(SC, `%g5')
ifelse(S, `true', `define(SIGN, `%g6')')
/*

View file

@ -1,4 +1,4 @@
/* $NetBSD: flt_rounds.c,v 1.6 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: flt_rounds.c,v 1.7 2012/03/21 00:38:34 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.6 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: flt_rounds.c,v 1.7 2012/03/21 00:38:34 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -21,9 +21,9 @@ static const int map[] = {
};
int
__flt_rounds()
__flt_rounds(void)
{
int x;
unsigned int x;
__asm("st %%fsr,%0" : "=m" (*&x));
return map[(x >> 30) & 0x03];

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetmask.c,v 1.6 2012/03/21 00:38:34 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetmask.c,v 1.6 2012/03/21 00:38:34 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,9 +19,9 @@ __weak_alias(fpgetmask,_fpgetmask)
#endif
fp_except
fpgetmask()
fpgetmask(void)
{
int x;
unsigned int x;
__asm("st %%fsr,%0" : "=m" (*&x));
return (x >> 23) & 0x1f;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetround.c,v 1.6 2012/03/21 00:38:34 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetround.c,v 1.6 2012/03/21 00:38:34 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,9 +19,9 @@ __weak_alias(fpgetround,_fpgetround)
#endif
fp_rnd
fpgetround()
fpgetround(void)
{
int x;
unsigned int x;
__asm("st %%fsr,%0" : "=m" (*&x));
return (x >> 30) & 0x03;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetsticky.c,v 1.6 2012/03/21 00:38:34 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetsticky.c,v 1.6 2012/03/21 00:38:34 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,9 +19,9 @@ __weak_alias(fpgetsticky,_fpgetsticky)
#endif
fp_except
fpgetsticky()
fpgetsticky(void)
{
int x;
unsigned int x;
__asm("st %%fsr,%0" : "=m" (*&x));
return (x >> 5) & 0x1f;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetmask.c,v 1.6 2012/03/21 00:38:34 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetmask.c,v 1.6 2012/03/21 00:38:34 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,8 +19,7 @@ __weak_alias(fpsetmask,_fpsetmask)
#endif
fp_except
fpsetmask(mask)
fp_except mask;
fpsetmask(fp_except mask)
{
fp_except old;
fp_except new;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetround.c,v 1.6 2012/03/21 00:38:35 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetround.c,v 1.6 2012/03/21 00:38:35 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -19,8 +19,7 @@ __weak_alias(fpsetround,_fpsetround)
#endif
fp_rnd
fpsetround(rnd_dir)
fp_rnd rnd_dir;
fpsetround(fp_rnd rnd_dir)
{
fp_rnd old;
fp_rnd new;
@ -33,5 +32,5 @@ fpsetround(rnd_dir)
__asm("ld %0,%%fsr" : : "m" (*&new));
return (old >> 30) & 0x03;
return ((unsigned int)old >> 30) & 0x03;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: longjmp.c,v 1.2 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: longjmp.c,v 1.3 2011/04/30 23:41:12 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -35,11 +35,27 @@
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#define __LIBC12_SOURCE__
#include <setjmp.h>
#include <compat/include/setjmp.h>
struct __jmp_buf_regs_t {
__greg_t g4;
__greg_t g7;
__greg_t save_mask;
};
/*
* setjmp.S uses hard coded offsets into the jump_buf,
* make sure any changes cause a compile failure here
*/
__CTASSERT(56 == offsetof(struct __jmp_buf_regs_t,save_mask) +
sizeof(struct sigcontext));
__CTASSERT(sizeof(sigjmp_buf) >= sizeof(struct __jmp_buf_regs_t) +
sizeof(struct sigcontext));
/*
* Use setcontext to reload the stack pointer, program counter <pc,npc>, and
* set the return value in %o0. The %i and %l registers will be reloaded
@ -49,14 +65,15 @@ void
__longjmp14(jmp_buf env, int val)
{
struct sigcontext *sc = (void *)env;
struct __jmp_buf_regs_t *r = (void*)&sc[1];
ucontext_t uc;
/* Ensure non-zero SP */
if (sc->sc_sp == 0)
goto err;
/* Initialise the fields we're going to use */
uc.uc_link = 0;
/* Initialise the context */
memset(&uc, 0, sizeof(uc));
/*
* Set _UC_{SET,CLR}STACK according to SS_ONSTACK.
@ -71,8 +88,12 @@ __longjmp14(jmp_buf env, int val)
/* Extract PSR, PC, NPC and SP from jmp_buf */
uc.uc_mcontext.__gregs[_REG_PSR] = sc->sc_psr;
uc.uc_mcontext.__gregs[_REG_PC] = sc->sc_pc;
uc.uc_mcontext.__gregs[_REG_nPC] = sc->sc_npc;
uc.uc_mcontext.__gregs[_REG_nPC] = sc->sc_pc+4;
uc.uc_mcontext.__gregs[_REG_O6] = sc->sc_sp;
uc.uc_mcontext.__gregs[_REG_G2] = sc->sc_g1;
uc.uc_mcontext.__gregs[_REG_G3] = sc->sc_npc;
uc.uc_mcontext.__gregs[_REG_G4] = r->g4;
uc.uc_mcontext.__gregs[_REG_G7] = r->g7;
/* Set the return value; make sure it's non-zero */
uc.uc_mcontext.__gregs[_REG_O0] = (val != 0 ? val : 1);

View file

@ -1,4 +1,4 @@
/* $NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:58 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: resumecontext.c,v 1.5 2011/09/19 21:24:58 joerg Exp $");
#endif
#include "namespace.h"
@ -41,7 +41,7 @@ __RCSID("$NetBSD: resumecontext.c,v 1.4 2008/04/28 20:22:57 martin Exp $");
#include "extern.h"
void
_resumecontext()
_resumecontext(void)
{
ucontext_t uct;

View file

@ -1,4 +1,4 @@
/* $NetBSD: setjmp.S,v 1.11 2007/10/08 13:06:00 uwe Exp $ */
/* $NetBSD: setjmp.S,v 1.12 2011/04/30 23:41:13 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
.asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: setjmp.S,v 1.11 2007/10/08 13:06:00 uwe Exp $")
RCSID("$NetBSD: setjmp.S,v 1.12 2011/04/30 23:41:13 martin Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@ -78,9 +78,11 @@ ENTRY(__setjmp14)
st %fp, [%i0 + 8] /* sc.sc_sp = (caller's) sp */
add %i7, 8, %o0
st %o0, [%i0 + 12] /* sc.sc_pc = return_pc */
add %i7, 12, %o0
st %o0, [%i0 + 16] /* sc.sc_npc = return_pc + 4 */
st %g3, [%i0 + 16] /* sc.sc_npc */
st %g0, [%i0 + 20] /* sc.sc_psr = (clean psr) */
st %g2, [%i0 + 24]
st %g4, [%i0 + 48]
st %g7, [%i0 + 52]
ret /* return 0 */
restore %g0, %g0, %o0

View file

@ -1,4 +1,4 @@
/* $NetBSD: swapcontext.S,v 1.3 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: swapcontext.S,v 1.4 2012/09/12 02:00:53 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: swapcontext.S,v 1.3 2008/04/28 20:22:57 martin Exp $")
RCSID("$NetBSD: swapcontext.S,v 1.4 2012/09/12 02:00:53 manu Exp $")
#endif /* LIBC_SCCS && !lint */
ENTRY(swapcontext)
@ -49,8 +49,13 @@ ENTRY(swapcontext)
add %o7, 8, %o1
st %o1, [%o2 + 40 + 1 * 4] ! gr[_REG_PC] = retaddr
mov %o3, %o0
mov %o1, %g2 ! optimize `return'
mov SYS_setcontext|SYSCALL_G2RFLAG, %g1
t ST_SYSCALL
ERROR()
#ifdef PIC
PIC_PROLOGUE(%g1, %g2) ! %g1 = _GLOBAL_OFFSET_TABLE
set _C_LABEL(setcontext), %g2
ld [%g1 + %g2], %g1
jmp %g1
mov %o3, %o0
#else
jmp _C_LABEL(setcontext)
mov %o3, %o0
#endif

View file

@ -1,42 +1,14 @@
# $NetBSD: Makefile.inc,v 1.13 2009/12/06 07:05:50 uebayasi Exp $
# $NetBSD: Makefile.inc,v 1.19 2012/03/21 14:10:47 christos Exp $
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S
# Some assembler files use v9a extensions.
AFLAGS+= -Wa,-Av9a
# `source' files built from m4 source
# the name `div.o' is taken for the ANSI C `div' function, hence sdiv here
SRCS+= rem.S sdiv.S udiv.S urem.S
CLEANFILES+=rem.S sdiv.S udiv.S urem.S
sdiv.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.div')define(OP,\`div')define(S,\`true')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}
udiv.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.udiv')define(OP,\`div')define(S,\`false')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}
rem.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.rem')define(OP,\`rem')define(S,\`true')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}
urem.S: ${LIBCDIR}/arch/sparc64/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.urem')define(OP,\`rem')define(S,\`false')"; \
cat ${.ALLSRC}) | ${TOOL_M4} > ${.TARGET}
@chmod 444 ${.TARGET}
.PATH: ${ARCHDIR}/softfloat
SRCS+= qp.c
CPPFLAGS+= -DSOFTFLOATSPARC64_FOR_GCC
CPPFLAGS+= -DSOFTFLOATSPARC64_FOR_GCC -DEXCEPTIONS_WITH_SOFTFLOAT
CPPFLAGS+= -DSOFTFLOAT_NEED_FIXUNS
.if ${MKSOFTFLOAT} != "no"
.include <softfloat/Makefile.inc>
.else
@ -47,4 +19,9 @@ SRCS.softfloat= softfloat-wrapper.c
SRCS+= ${SRCS.softfloat}
CPPFLAGS+= -I${ARCHDIR}/softfloat -I${.CURDIR}/softfloat \
-I${.CURDIR}/softfloat/bits64
.if ${HAVE_GCC} == 45
COPTS.softfloat-wrapper.c+= -Wno-enum-compare
.endif
.endif

View file

@ -1,4 +1,4 @@
/* $NetBSD: SYS.h,v 1.13 2003/08/07 16:42:26 agc Exp $ */
/* $NetBSD: SYS.h,v 1.14 2011/03/28 11:19:13 martin Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -82,18 +82,18 @@
/*
* RSYSCALL is used when the system call should just return. Here
* we use the SYSCALL_G7RFLAG to put the `success' return address in %g7
* we use the SYSCALL_G5RFLAG to put the `success' return address in %g5
* and avoid a branch.
*/
#define RSYSCALL(x) \
ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
t ST_SYSCALL; ERROR()
/*
* PSEUDO(x,y) is like RSYSCALL(y) except that the name is x.
*/
#define PSEUDO(x,y) \
ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
t ST_SYSCALL; ERROR()
/*
@ -120,16 +120,14 @@
* XXX - This should be optimized.
*/
#define RSYSCALL_NOERROR(x) \
ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
t ST_SYSCALL
/*
* PSEUDO_NOERROR(x,y) is like RSYSCALL_NOERROR(y) except that the name is x.
*/
#define PSEUDO_NOERROR(x,y) \
ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
t ST_SYSCALL
.register %g7,#scratch
.globl _C_LABEL(__cerror)

View file

@ -1,4 +1,4 @@
/* $NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:57 martin Exp $ */
/* $NetBSD: _lwp.c,v 1.7 2012/03/17 20:48:58 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:57 martin Exp $");
__RCSID("$NetBSD: _lwp.c,v 1.7 2012/03/17 20:48:58 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -53,6 +53,7 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *),
u->uc_stack.ss_sp = stack_base;
u->uc_stack.ss_size = stack_size;
/*LINTED*/
sp = (ulong *)(stack_base + stack_size);
sp = (ulong *)((ulong)sp & ~0x0f);
@ -62,6 +63,7 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *),
sp[14] = (ulong)sp - 2047;
sp[15] = (ulong)_lwp_exit - 8;
/*LINTED*/
sp = (ulong *)((caddr_t)sp - 2047);
gr[_REG_PC] = (ulong) start;
@ -70,4 +72,5 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *),
gr[_REG_O0] = (ulong) arg;
gr[_REG_O6] = (ulong) sp;
gr[_REG_O7] = (ulong)_lwp_exit - 8;
gr[_REG_G7] = (ulong)private;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: _setjmp.S,v 1.6 2004/12/07 08:20:07 martin Exp $ */
/* $NetBSD: _setjmp.S,v 1.7 2011/04/30 19:43:17 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,10 +40,13 @@
#if 0
.asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: _setjmp.S,v 1.6 2004/12/07 08:20:07 martin Exp $")
RCSID("$NetBSD: _setjmp.S,v 1.7 2011/04/30 19:43:17 martin Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
.register %g2,#ignore
.register %g3,#ignore
/*
* C library -- _setjmp, _longjmp
*
@ -57,6 +60,15 @@
ENTRY(_setjmp)
stx %sp, [%o0+0] /* store caller's stack pointer */
stx %o7, [%o0+8] /* and return pc */
stx %g0, [%o0+0x18] /* mark as non-sigmask jmpbuf */
/* store globals, offsets compatible with siglongjmp */
stx %g1, [%o0+0x28]
stx %g2, [%o0+0x30] /* adjust asserts in longjmp.c */
stx %g3, [%o0+0x48] /* if you change any of these */
stx %g6, [%o0+0x50] /* offsets! */
stx %g7, [%o0+0x58]
retl
clr %o0 ! return 0
@ -68,6 +80,11 @@ ENTRY(_longjmp)
* a `restore' instruction which will reload the register
* window from the stack.
*/
ldx [%i0+0x28],%g1
ldx [%i0+0x30],%g2
ldx [%i0+0x48],%g3
ldx [%i0+0x50],%g6
ldx [%i0+0x58],%g7
ldx [%i0+8], %i7
ldx [%i0+0], %fp
mov 1, %i0

View file

@ -1,273 +0,0 @@
/* $NetBSD: divrem.m4,v 1.4 2003/08/07 16:42:27 agc Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: divrem.m4,v 1.4 92/06/25 13:23:57 torek Exp
*/
#include <machine/asm.h>
#include <machine/trap.h>
/*
* Division and remainder, from Appendix E of the Sparc Version 8
* Architecture Manual, with fixes from Gordon Irlam.
*/
#if defined(LIBC_SCCS)
RCSID("$NetBSD: divrem.m4,v 1.4 2003/08/07 16:42:27 agc Exp $")
#endif
/*
* Input: dividend and divisor in %o0 and %o1 respectively.
*
* m4 parameters:
* NAME name of function to generate
* OP OP=div => %o0 / %o1; OP=rem => %o0 % %o1
* S S=true => signed; S=false => unsigned
*
* Algorithm parameters:
* N how many bits per iteration we try to get (4)
* WORDSIZE total number of bits (32)
*
* Derived constants:
* TWOSUPN 2^N, for label generation (m4 exponentiation currently broken)
* TOPBITS number of bits in the top `decade' of a number
*
* Important variables:
* Q the partial quotient under development (initially 0)
* R the remainder so far, initially the dividend
* ITER number of main division loop iterations required;
* equal to ceil(log2(quotient) / N). Note that this
* is the log base (2^N) of the quotient.
* V the current comparand, initially divisor*2^(ITER*N-1)
*
* Cost:
* Current estimate for non-large dividend is
* ceil(log2(quotient) / N) * (10 + 7N/2) + C
* A large dividend is one greater than 2^(31-TOPBITS) and takes a
* different path, as the upper bits of the quotient must be developed
* one bit at a time.
*/
define(N, `4')
define(TWOSUPN, `16')
define(WORDSIZE, `32')
define(TOPBITS, eval(WORDSIZE - N*((WORDSIZE-1)/N)))
define(dividend, `%o0')
define(divisor, `%o1')
define(Q, `%o2')
define(R, `%o3')
define(ITER, `%o4')
define(V, `%o5')
/* m4 reminder: ifelse(a,b,c,d) => if a is b, then c, else d */
define(T, `%g1')
define(SC, `%g5')
ifelse(S, `true', `define(SIGN, `%g6')')
/*
* This is the recursive definition for developing quotient digits.
*
* Parameters:
* $1 the current depth, 1 <= $1 <= N
* $2 the current accumulation of quotient bits
* N max depth
*
* We add a new bit to $2 and either recurse or insert the bits in
* the quotient. R, Q, and V are inputs and outputs as defined above;
* the condition codes are expected to reflect the input R, and are
* modified to reflect the output R.
*/
define(DEVELOP_QUOTIENT_BITS,
` ! depth $1, accumulated bits $2
bl L.$1.eval(TWOSUPN+$2)
srl V,1,V
! remainder is positive
subcc R,V,R
ifelse($1, N,
` b 9f
add Q, ($2*2+1), Q
', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2+1)')')
L.$1.eval(TWOSUPN+$2):
! remainder is negative
addcc R,V,R
ifelse($1, N,
` b 9f
add Q, ($2*2-1), Q
', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2-1)')')
ifelse($1, 1, `9:')')
FUNC(NAME)
ifelse(S, `true',
` ! compute sign of result; if neither is negative, no problem
orcc divisor, dividend, %g0 ! either negative?
bge 2f ! no, go do the divide
ifelse(OP, `div',
`xor divisor, dividend, SIGN',
`mov dividend, SIGN') ! compute sign in any case
tst divisor
bge 1f
tst dividend
! divisor is definitely negative; dividend might also be negative
bge 2f ! if dividend not negative...
neg divisor ! in any case, make divisor nonneg
1: ! dividend is negative, divisor is nonnegative
neg dividend ! make dividend nonnegative
2:
')
! Ready to divide. Compute size of quotient; scale comparand.
orcc divisor, %g0, V
bnz 1f
mov dividend, R
! Divide by zero trap. If it returns, return 0 (about as
! wrong as possible, but that is what SunOS does...).
t ST_DIV0
retl
clr %o0
1:
cmp R, V ! if divisor exceeds dividend, done
blu Lgot_result ! (and algorithm fails otherwise)
clr Q
sethi %hi(1 << (WORDSIZE - TOPBITS - 1)), T
cmp R, T
blu Lnot_really_big
clr ITER
! `Here the dividend is >= 2^(31-N) or so. We must be careful here,
! as our usual N-at-a-shot divide step will cause overflow and havoc.
! The number of bits in the result here is N*ITER+SC, where SC <= N.
! Compute ITER in an unorthodox manner: know we need to shift V into
! the top decade: so do not even bother to compare to R.'
1:
cmp V, T
bgeu 3f
mov 1, SC
sll V, N, V
b 1b
inc ITER
! Now compute SC.
2: addcc V, V, V
bcc Lnot_too_big
inc SC
! We get here if the divisor overflowed while shifting.
! This means that R has the high-order bit set.
! Restore V and subtract from R.
sll T, TOPBITS, T ! high order bit
srl V, 1, V ! rest of V
add V, T, V
b Ldo_single_div
dec SC
Lnot_too_big:
3: cmp V, R
blu 2b
nop
be Ldo_single_div
nop
/* NB: these are commented out in the V8-Sparc manual as well */
/* (I do not understand this) */
! V > R: went too far: back up 1 step
! srl V, 1, V
! dec SC
! do single-bit divide steps
!
! We have to be careful here. We know that R >= V, so we can do the
! first divide step without thinking. BUT, the others are conditional,
! and are only done if R >= 0. Because both R and V may have the high-
! order bit set in the first step, just falling into the regular
! division loop will mess up the first time around.
! So we unroll slightly...
Ldo_single_div:
deccc SC
bl Lend_regular_divide
nop
sub R, V, R
mov 1, Q
b Lend_single_divloop
nop
Lsingle_divloop:
sll Q, 1, Q
bl 1f
srl V, 1, V
! R >= 0
sub R, V, R
b 2f
inc Q
1: ! R < 0
add R, V, R
dec Q
2:
Lend_single_divloop:
deccc SC
bge Lsingle_divloop
tst R
b,a Lend_regular_divide
Lnot_really_big:
1:
sll V, N, V
cmp V, R
bleu 1b
inccc ITER
be Lgot_result
dec ITER
tst R ! set up for initial iteration
Ldivloop:
sll Q, N, Q
DEVELOP_QUOTIENT_BITS(1, 0)
Lend_regular_divide:
deccc ITER
bge Ldivloop
tst R
bl,a Lgot_result
! non-restoring fixup here (one instruction only!)
ifelse(OP, `div',
` dec Q
', ` add R, divisor, R
')
Lgot_result:
ifelse(S, `true',
` ! check to see if answer should be < 0
tst SIGN
bl,a 1f
ifelse(OP, `div', `neg Q', `neg R')
1:')
retl
ifelse(OP, `div', `mov Q, %o0', `mov R, %o0')

View file

@ -1,4 +1,4 @@
/* $NetBSD: flt_rounds.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: flt_rounds.c,v 1.6 2012/06/24 15:26:02 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: flt_rounds.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: flt_rounds.c,v 1.6 2012/06/24 15:26:02 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@ -21,9 +21,9 @@ static const int map[] = {
};
int
__flt_rounds()
__flt_rounds(void)
{
int x;
uint32_t x;
__asm("st %%fsr,%0" : "=m" (*&x));
return map[(x >> 30) & 0x03];

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetmask.c,v 1.6 2012/06/24 15:26:02 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,11 +7,12 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetmask.c,v 1.6 2012/06/24 15:26:02 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ieeefp.h>
#ifdef __weak_alias
@ -19,9 +20,9 @@ __weak_alias(fpgetmask,_fpgetmask)
#endif
fp_except
fpgetmask()
fpgetmask(void)
{
int x;
uint32_t x;
__asm("st %%fsr,%0" : "=m" (*&x));
return (x >> 23) & 0x1f;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetround.c,v 1.6 2012/06/24 15:26:02 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,11 +7,12 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetround.c,v 1.6 2012/06/24 15:26:02 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ieeefp.h>
#ifdef __weak_alias
@ -19,9 +20,9 @@ __weak_alias(fpgetround,_fpgetround)
#endif
fp_rnd
fpgetround()
fpgetround(void)
{
int x;
uint32_t x;
__asm("st %%fsr,%0" : "=m" (*&x));
return (x >> 30) & 0x03;

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpgetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpgetsticky.c,v 1.7 2012/06/24 15:26:02 christos Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,22 +7,34 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpgetsticky.c,v 1.7 2012/06/24 15:26:02 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ieeefp.h>
#ifdef __weak_alias
__weak_alias(fpgetsticky,_fpgetsticky)
#endif
#ifdef EXCEPTIONS_WITH_SOFTFLOAT
extern fp_except _softfloat_float_exception_flags;
#endif
fp_except
fpgetsticky()
fpgetsticky(void)
{
int x;
uint32_t x;
fp_except res;
__asm("st %%fsr,%0" : "=m" (*&x));
return (x >> 5) & 0x1f;
res = (x >> 5) & 0x1f;
#ifdef EXCEPTIONS_WITH_SOFTFLOAT
res |= _softfloat_float_exception_flags;
#endif
return res;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetmask.c,v 1.6 2012/03/17 21:35:06 martin Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,17 +7,22 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetmask.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetmask.c,v 1.6 2012/03/17 21:35:06 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ieeefp.h>
#ifdef __weak_alias
__weak_alias(fpsetmask,_fpsetmask)
#endif
#ifdef EXCEPTIONS_WITH_SOFTFLOAT
extern fp_except _softfloat_float_exception_mask;
#endif
fp_except
fpsetmask(mask)
fp_except mask;
@ -33,5 +38,13 @@ fpsetmask(mask)
__asm("ld %0,%%fsr" : : "m" (*&new));
return (old >> 23) & 0x1f;
old = ((uint32_t)old >> 23) & 0x1f;
#ifdef EXCEPTIONS_WITH_SOFTFLOAT
/* update softfloat mask as well */
old |= _softfloat_float_exception_mask;
_softfloat_float_exception_mask = mask;
#endif
return old;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,11 +7,12 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetround.c,v 1.5 2012/03/17 21:35:06 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ieeefp.h>
#ifdef __weak_alias
@ -33,5 +34,5 @@ fpsetround(rnd_dir)
__asm("ld %0,%%fsr" : : "m" (*&new));
return (old >> 30) & 0x03;
return ((uint32_t)old >> 30) & 0x03;
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: fpsetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
/* $NetBSD: fpsetsticky.c,v 1.6 2012/03/17 21:35:06 martin Exp $ */
/*
* Written by J.T. Conklin, Apr 10, 1995
@ -7,17 +7,22 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetsticky.c,v 1.4 2005/12/24 23:10:08 perry Exp $");
__RCSID("$NetBSD: fpsetsticky.c,v 1.6 2012/03/17 21:35:06 martin Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ieeefp.h>
#ifdef __weak_alias
__weak_alias(fpsetsticky,_fpsetsticky)
#endif
#ifdef EXCEPTIONS_WITH_SOFTFLOAT
extern fp_except _softfloat_float_exception_flags;
#endif
fp_except
fpsetsticky(sticky)
fp_except sticky;
@ -33,5 +38,11 @@ fpsetsticky(sticky)
__asm("ld %0,%%fsr" : : "m" (*&new));
return (old >> 5) & 0x1f;
old = ((uint32_t)old >> 5) & 0x1f;
#ifdef EXCEPTIONS_WITH_SOFTFLOAT
old |= _softfloat_float_exception_flags;
_softfloat_float_exception_flags = sticky;
#endif
return old;
}

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