From 5a61e87775548150c3b1e20340822e754f9f0bde Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Wed, 24 Sep 2014 10:20:09 +0000 Subject: [PATCH] newlib: update git-svn-id: svn://kolibrios.org@5141 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/sdk/sources/newlib/libc/Makefile | 12 ++- contrib/sdk/sources/newlib/libc/Tupfile.lua | 8 +- .../sources/newlib/libc/include/kos32sys.h | 11 ++- .../sources/newlib/libc/include/sys/dirent.h | 2 +- .../sources/newlib/libc/math/feclearexcept.c | 15 ++++ .../sources/newlib/libc/math/fetestexcept.c | 17 +++++ .../sdk/sources/newlib/libc/stdio/ferror.c | 74 +++++++++++++++++++ contrib/sdk/sources/newlib/libc/sys/stat.c | 30 ++++++++ 8 files changed, 159 insertions(+), 10 deletions(-) create mode 100644 contrib/sdk/sources/newlib/libc/math/feclearexcept.c create mode 100644 contrib/sdk/sources/newlib/libc/math/fetestexcept.c create mode 100644 contrib/sdk/sources/newlib/libc/stdio/ferror.c create mode 100644 contrib/sdk/sources/newlib/libc/sys/stat.c diff --git a/contrib/sdk/sources/newlib/libc/Makefile b/contrib/sdk/sources/newlib/libc/Makefile index 12385ea576..2e7572e8a8 100644 --- a/contrib/sdk/sources/newlib/libc/Makefile +++ b/contrib/sdk/sources/newlib/libc/Makefile @@ -130,6 +130,7 @@ CORE_SRCS:= \ sys/lseek.c \ sys/open.c \ sys/read.c \ + sys/stat.c \ sys/unlink.c \ sys/write.c \ sys/io_alloc.S \ @@ -244,6 +245,8 @@ STDIO_SRCS= \ fopen.c \ fclose.c \ fdopen.c \ + feof.c \ + ferror.c \ fflush.c \ flags.c \ fileno.c \ @@ -300,10 +303,11 @@ MATH_SRCS = e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c e_exp.c e_ ef_jn.c ef_log.c ef_log10.c ef_pow.c ef_rem_pio2.c ef_remainder.c ef_scalb.c \ ef_sinh.c ef_sqrt.c er_gamma.c er_lgamma.c erf_gamma.c erf_lgamma.c f_exp.c \ f_expf.c f_llrint.c f_llrintf.c f_llrintl.c f_lrint.c f_lrintf.c f_lrintl.c \ - f_pow.c f_powf.c f_rint.c f_rintf.c f_rintl.c k_cos.c k_rem_pio2.c k_sin.c \ - k_standard.c k_tan.c kf_cos.c kf_rem_pio2.c kf_sin.c kf_tan.c s_asinh.c \ - s_atan.c s_cbrt.c s_ceil.c s_copysign.c s_cos.c s_erf.c s_exp10.c s_expm1.c \ - s_fabs.c s_fdim.c s_finite.c s_floor.c s_fma.c s_fmax.c s_fmin.c s_fpclassify.c \ + f_pow.c f_powf.c f_rint.c f_rintf.c f_rintl.c feclearexcept.c fetestexcept.c \ + k_cos.c k_rem_pio2.c k_sin.c k_standard.c k_tan.c kf_cos.c kf_rem_pio2.c \ + kf_sin.c kf_tan.c s_asinh.c s_atan.c s_cbrt.c s_ceil.c s_copysign.c s_cos.c \ + s_erf.c s_exp10.c s_expm1.c s_fabs.c s_fdim.c s_finite.c s_floor.c s_fma.c \ + s_fmax.c s_fmin.c s_fpclassify.c \ s_frexp.c s_ilogb.c s_infconst.c s_infinity.c s_isinf.c s_isinfd.c s_isnan.c \ s_isnand.c s_ldexp.c s_lib_ver.c s_llrint.c s_llround.c s_log1p.c s_log2.c \ s_logb.c s_lrint.c s_lround.c s_matherr.c s_modf.c s_nan.c s_nearbyint.c \ diff --git a/contrib/sdk/sources/newlib/libc/Tupfile.lua b/contrib/sdk/sources/newlib/libc/Tupfile.lua index 47f98440e0..2a7d01a023 100644 --- a/contrib/sdk/sources/newlib/libc/Tupfile.lua +++ b/contrib/sdk/sources/newlib/libc/Tupfile.lua @@ -48,7 +48,7 @@ CORE_SRCS = { "sys/close.c", "sys/create.c", "sys/delete.c", "sys/errno.c", "sys/finfo.c", "sys/fsize.c", "sys/fstat.c", "sys/gettod.c", "sys/io.c", "sys/ioread.c", "sys/iowrite.c", "sys/isatty.c", "sys/lseek.c", "sys/open.c", "sys/read.c", - "sys/unlink.c", "sys/write.c", "sys/io_alloc.S", + "sys/stat.c", "sys/unlink.c", "sys/write.c", "sys/io_alloc.S", "time/asctime.c", "time/asctime_r.c", "time/clock.c", "time/ctime.c", "time/ctime_r.c", "time/difftime.c", "time/gettzinfo.c", "time/gmtime.c", "time/gmtime_r.c", "time/mktime.c", "time/mktm_r.c", "time/lcltime.c", @@ -95,9 +95,9 @@ MATH_SRCS = { "ef_jn.c", "ef_log.c", "ef_log10.c", "ef_pow.c", "ef_rem_pio2.c", "ef_remainder.c", "ef_scalb.c", "ef_sinh.c", "ef_sqrt.c", "er_gamma.c", "er_lgamma.c", "erf_gamma.c", "erf_lgamma.c", "f_exp.c", "f_expf.c", "f_llrint.c", "f_llrintf.c", "f_llrintl.c", "f_lrint.c", "f_lrintf.c", "f_lrintl.c", - "f_pow.c", "f_powf.c", "f_rint.c", "f_rintf.c", "f_rintl.c", "k_cos.c", "k_rem_pio2.c", "k_sin.c", - "k_standard.c", "k_tan.c", "kf_cos.c", "kf_rem_pio2.c", "kf_sin.c", "kf_tan.c", "s_asinh.c", - "s_atan.c", "s_cbrt.c", "s_ceil.c", "s_copysign.c", "s_cos.c", "s_erf.c", "s_exp10.c", "s_expm1.c", + "f_pow.c", "f_powf.c", "f_rint.c", "f_rintf.c", "f_rintl.c", "feclearexcept.c", "fetestexcept.c", + "k_cos.c", "k_rem_pio2.c", "k_sin.c", "k_standard.c", "k_tan.c", "kf_cos.c", "kf_rem_pio2.c", "kf_sin.c", + "kf_tan.c", "s_asinh.c", "s_atan.c", "s_cbrt.c", "s_ceil.c", "s_copysign.c", "s_cos.c", "s_erf.c", "s_exp10.c", "s_expm1.c", "s_fabs.c", "s_fdim.c", "s_finite.c", "s_floor.c", "s_fma.c", "s_fmax.c", "s_fmin.c", "s_fpclassify.c", "s_frexp.c", "s_ilogb.c", "s_infconst.c", "s_infinity.c", "s_isinf.c", "s_isinfd.c", "s_isnan.c", "s_isnand.c", "s_ldexp.c", "s_lib_ver.c", "s_llrint.c", "s_llround.c", "s_log1p.c", "s_log2.c", diff --git a/contrib/sdk/sources/newlib/libc/include/kos32sys.h b/contrib/sdk/sources/newlib/libc/include/kos32sys.h index a7baa0bc44..0794e2c739 100644 --- a/contrib/sdk/sources/newlib/libc/include/kos32sys.h +++ b/contrib/sdk/sources/newlib/libc/include/kos32sys.h @@ -5,6 +5,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + //#ifdef CONFIG_DEBUF // #define DBG(format,...) printf(format,##__VA_ARGS__) //#else @@ -440,7 +444,7 @@ struct blit_call int srcw; int srch; - unsigned char *bitmap; + void *bitmap; int stride; }; @@ -466,6 +470,11 @@ static inline void Blit(void *bitmap, int dst_x, int dst_y, ::"a"(73),"b"(0),"c"(&bc.dstx)); }; +#ifdef __cplusplus +} +#endif + + #endif diff --git a/contrib/sdk/sources/newlib/libc/include/sys/dirent.h b/contrib/sdk/sources/newlib/libc/include/sys/dirent.h index 13be76d73f..90e37fcdbd 100644 --- a/contrib/sdk/sources/newlib/libc/include/sys/dirent.h +++ b/contrib/sdk/sources/newlib/libc/include/sys/dirent.h @@ -7,7 +7,7 @@ #ifdef __cplusplus extern "C" { #endif -#error " not supported" +//#error " not supported" #ifdef __cplusplus } #endif diff --git a/contrib/sdk/sources/newlib/libc/math/feclearexcept.c b/contrib/sdk/sources/newlib/libc/math/feclearexcept.c new file mode 100644 index 0000000000..4680f06b4a --- /dev/null +++ b/contrib/sdk/sources/newlib/libc/math/feclearexcept.c @@ -0,0 +1,15 @@ +#include + +/* 7.6.2.1 + The feclearexcept function clears the supported exceptions + represented by its argument. +*/ + +int feclearexcept (int excepts) +{ + fenv_t _env; + __asm__ volatile ("fnstenv %0;" : "=m" (_env)); /* get the env */ + _env.__status_word &= ~(excepts & FE_ALL_EXCEPT); /* clear the except */ + __asm__ volatile ("fldenv %0;" :: "m" (_env)); /*set the env */ + return 0; +} diff --git a/contrib/sdk/sources/newlib/libc/math/fetestexcept.c b/contrib/sdk/sources/newlib/libc/math/fetestexcept.c new file mode 100644 index 0000000000..4eab720ee8 --- /dev/null +++ b/contrib/sdk/sources/newlib/libc/math/fetestexcept.c @@ -0,0 +1,17 @@ +#include + +/* 7.6.2.5 + The fetestexcept function determines which of a specified subset of + the exception flags are currently set. The excepts argument + specifies the exception flags to be queried. + The fetestexcept function returns the value of the bitwise OR of the + exception macros corresponding to the currently set exceptions + included in excepts. +*/ + +int fetestexcept (int excepts) +{ + unsigned short _sw; + __asm__ ("fnstsw %%ax" : "=a" (_sw)); + return _sw & excepts & FE_ALL_EXCEPT; +} diff --git a/contrib/sdk/sources/newlib/libc/stdio/ferror.c b/contrib/sdk/sources/newlib/libc/stdio/ferror.c new file mode 100644 index 0000000000..0cd3c30893 --- /dev/null +++ b/contrib/sdk/sources/newlib/libc/stdio/ferror.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +FUNCTION +<>---test whether read/write error has occurred + +INDEX + ferror + +ANSI_SYNOPSIS + #include + int ferror(FILE *<[fp]>); + +TRAD_SYNOPSIS + #include + int ferror(<[fp]>) + FILE *<[fp]>; + +DESCRIPTION +The <> functions maintain an error indicator with each file +pointer <[fp]>, to record whether any read or write errors have +occurred on the associated file or stream. +Use <> to query this indicator. + +See <> to reset the error indicator. + +RETURNS +<> returns <<0>> if no errors have occurred; it returns a +nonzero value otherwise. + +PORTABILITY +ANSI C requires <>. + +No supporting OS subroutines are required. +*/ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "%W% (Berkeley) %G%"; +#endif /* LIBC_SCCS and not lint */ + +#include <_ansi.h> +#include +#include "local.h" + +/* A subroutine version of the macro ferror. */ + +#undef ferror + +int +_DEFUN(ferror, (fp), + FILE * fp) +{ + int result; + CHECK_INIT(_REENT, fp); + _newlib_flockfile_start (fp); + result = __sferror (fp); + _newlib_flockfile_end (fp); + return result; +} diff --git a/contrib/sdk/sources/newlib/libc/sys/stat.c b/contrib/sdk/sources/newlib/libc/sys/stat.c new file mode 100644 index 0000000000..ebb7de3f5f --- /dev/null +++ b/contrib/sdk/sources/newlib/libc/sys/stat.c @@ -0,0 +1,30 @@ +/* stat.c -- Get the status of a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include +#include +#include "glue.h" + +/* + * stat -- Since we have no file system, we just return an error. + */ +int +_DEFUN (stat, (path, buf), + const char *path _AND + struct stat *buf) +{ + errno = EIO; + return (-1); +} +