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:
2012-11-15 16:07:29 +01:00
parent dba3562d78
commit e415d48872
183 changed files with 3292 additions and 2385 deletions
+3 -1
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}
+14 -9
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);
}
+8 -5
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
}
+8 -5
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);
}
+8 -5
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);
}
+8 -5
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);
}
+11 -8
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);
}
+11 -8
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);
}
+16 -13
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);
}
+3 -3
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;
+13 -11
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 );
+13 -13
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
+3 -3
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)