summaryrefslogtreecommitdiff
path: root/newlib/libc/include/machine
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/include/machine')
-rw-r--r--newlib/libc/include/machine/fastmath.h100
-rw-r--r--newlib/libc/include/machine/ieeefp.h157
-rw-r--r--newlib/libc/include/machine/setjmp-dj.h44
-rw-r--r--newlib/libc/include/machine/setjmp.h168
-rw-r--r--newlib/libc/include/machine/time.h10
-rw-r--r--newlib/libc/include/machine/types.h9
6 files changed, 488 insertions, 0 deletions
diff --git a/newlib/libc/include/machine/fastmath.h b/newlib/libc/include/machine/fastmath.h
new file mode 100644
index 00000000000..b13befa228b
--- /dev/null
+++ b/newlib/libc/include/machine/fastmath.h
@@ -0,0 +1,100 @@
+#ifdef __sysvnecv70_target
+double EXFUN(fast_sin,(double));
+double EXFUN(fast_cos,(double));
+double EXFUN(fast_tan,(double));
+
+double EXFUN(fast_asin,(double));
+double EXFUN(fast_acos,(double));
+double EXFUN(fast_atan,(double));
+
+double EXFUN(fast_sinh,(double));
+double EXFUN(fast_cosh,(double));
+double EXFUN(fast_tanh,(double));
+
+double EXFUN(fast_asinh,(double));
+double EXFUN(fast_acosh,(double));
+double EXFUN(fast_atanh,(double));
+
+double EXFUN(fast_abs,(double));
+double EXFUN(fast_sqrt,(double));
+double EXFUN(fast_exp2,(double));
+double EXFUN(fast_exp10,(double));
+double EXFUN(fast_expe,(double));
+double EXFUN(fast_log10,(double));
+double EXFUN(fast_log2,(double));
+double EXFUN(fast_loge,(double));
+
+
+#define sin(x) fast_sin(x)
+#define cos(x) fast_cos(x)
+#define tan(x) fast_tan(x)
+#define asin(x) fast_asin(x)
+#define acos(x) fast_acos(x)
+#define atan(x) fast_atan(x)
+#define sinh(x) fast_sinh(x)
+#define cosh(x) fast_cosh(x)
+#define tanh(x) fast_tanh(x)
+#define asinh(x) fast_asinh(x)
+#define acosh(x) fast_acosh(x)
+#define atanh(x) fast_atanh(x)
+#define abs(x) fast_abs(x)
+#define sqrt(x) fast_sqrt(x)
+#define exp2(x) fast_exp2(x)
+#define exp10(x) fast_exp10(x)
+#define expe(x) fast_expe(x)
+#define log10(x) fast_log10(x)
+#define log2(x) fast_log2(x)
+#define loge(x) fast_loge(x)
+
+#ifdef _HAVE_STDC
+/* These functions are in assembler, they really do take floats. This
+ can only be used with a real ANSI compiler */
+
+float EXFUN(fast_sinf,(float));
+float EXFUN(fast_cosf,(float));
+float EXFUN(fast_tanf,(float));
+
+float EXFUN(fast_asinf,(float));
+float EXFUN(fast_acosf,(float));
+float EXFUN(fast_atanf,(float));
+
+float EXFUN(fast_sinhf,(float));
+float EXFUN(fast_coshf,(float));
+float EXFUN(fast_tanhf,(float));
+
+float EXFUN(fast_asinhf,(float));
+float EXFUN(fast_acoshf,(float));
+float EXFUN(fast_atanhf,(float));
+
+float EXFUN(fast_absf,(float));
+float EXFUN(fast_sqrtf,(float));
+float EXFUN(fast_exp2f,(float));
+float EXFUN(fast_exp10f,(float));
+float EXFUN(fast_expef,(float));
+float EXFUN(fast_log10f,(float));
+float EXFUN(fast_log2f,(float));
+float EXFUN(fast_logef,(float));
+#define sinf(x) fast_sinf(x)
+#define cosf(x) fast_cosf(x)
+#define tanf(x) fast_tanf(x)
+#define asinf(x) fast_asinf(x)
+#define acosf(x) fast_acosf(x)
+#define atanf(x) fast_atanf(x)
+#define sinhf(x) fast_sinhf(x)
+#define coshf(x) fast_coshf(x)
+#define tanhf(x) fast_tanhf(x)
+#define asinhf(x) fast_asinhf(x)
+#define acoshf(x) fast_acoshf(x)
+#define atanhf(x) fast_atanhf(x)
+#define absf(x) fast_absf(x)
+#define sqrtf(x) fast_sqrtf(x)
+#define exp2f(x) fast_exp2f(x)
+#define exp10f(x) fast_exp10f(x)
+#define expef(x) fast_expef(x)
+#define log10f(x) fast_log10f(x)
+#define log2f(x) fast_log2f(x)
+#define logef(x) fast_logef(x)
+#endif
+/* Override the functions defined in math.h */
+#endif /* __sysvnecv70_target */
+
diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h
new file mode 100644
index 00000000000..ce8f0ffc58f
--- /dev/null
+++ b/newlib/libc/include/machine/ieeefp.h
@@ -0,0 +1,157 @@
+#ifndef __IEEE_BIG_ENDIAN
+#ifndef __IEEE_LITTLE_ENDIAN
+
+#if defined(__arm__) || defined(__thumb__)
+/* ARM always has big-endian words. Within those words the byte ordering
+ appears to be big or little endian. Newlib doesn't seem to care about
+ the byte ordering within words. */
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#ifdef __hppa__
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#ifdef __sparc__
+#ifdef __LITTLE_ENDIAN_DATA__
+#define __IEEE_LITTLE_ENDIAN
+#else
+#define __IEEE_BIG_ENDIAN
+#endif
+#endif
+
+#if defined(__m68k__) || defined(__mc68000__)
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
+#define __IEEE_BIG_ENDIAN
+#define __SMALL_BITFIELDS
+#define _DOUBLE_IS_32BITS
+#endif
+
+#ifdef __H8500__
+#define __IEEE_BIG_ENDIAN
+#define __SMALL_BITFIELDS
+#define _DOUBLE_IS_32BITS
+#endif
+
+#ifdef __sh__
+#ifdef __LITTLE_ENDIAN__
+#define __IEEE_LITTLE_ENDIAN
+#else
+#define __IEEE_BIG_ENDIAN
+#endif
+#if defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__)
+#define _DOUBLE_IS_32BITS
+#endif
+#endif
+
+#ifdef _AM29K
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#ifdef _WIN32
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
+#ifdef __i386__
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
+#ifdef __i960__
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
+#ifdef __M32R__
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#ifdef __TIC80__
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
+#ifdef __MIPSEL__
+#define __IEEE_LITTLE_ENDIAN
+#endif
+#ifdef __MIPSEB__
+#define __IEEE_BIG_ENDIAN
+#endif
+
+/* necv70 was __IEEE_LITTLE_ENDIAN. */
+
+#ifdef __W65__
+#define __IEEE_LITTLE_ENDIAN
+#define __SMALL_BITFIELDS
+#define _DOUBLE_IS_32BITS
+#endif
+
+#if defined(__Z8001__) || defined(__Z8002__)
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#ifdef __m88k__
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#ifdef __mn10300__
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
+#ifdef __mn10200__
+#define __IEEE_LITTLE_ENDIAN
+#define __SMALL_BITFIELDS
+#define _DOUBLE_IS_32BITS
+#endif
+
+#ifdef __v800
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
+#ifdef __v850
+#define __IEEE_LITTLE_ENDIAN
+#endif
+
+#ifdef __D10V__
+#define __IEEE_BIG_ENDIAN
+#define _DOUBLE_IS_32BITS
+#define __SMALL_BITFIELDS
+#endif
+
+#ifdef __PPC__
+#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
+#define __IEEE_BIG_ENDIAN
+#else
+#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
+#define __IEEE_LITTLE_ENDIAN
+#endif
+#endif
+#endif
+
+#ifdef __arc__
+#ifdef __big_endian__
+#define __IEEE_BIG_ENDIAN
+#else
+#define __IEEE_LITTLE_ENDIAN
+#endif
+#endif
+
+#ifdef __fr30__
+#define __IEEE_BIG_ENDIAN
+#endif
+
+#ifdef __mcore__
+#define __IEEE_BIG_ENDIAN
+#endif
+
+
+
+#ifndef __IEEE_BIG_ENDIAN
+#ifndef __IEEE_LITTLE_ENDIAN
+#error Endianess not declared!!
+#endif /* not __IEEE_LITTLE_ENDIAN */
+#endif /* not __IEEE_BIG_ENDIAN */
+
+#endif /* not __IEEE_LITTLE_ENDIAN */
+#endif /* not __IEEE_BIG_ENDIAN */
+
diff --git a/newlib/libc/include/machine/setjmp-dj.h b/newlib/libc/include/machine/setjmp-dj.h
new file mode 100644
index 00000000000..0243f7e7608
--- /dev/null
+++ b/newlib/libc/include/machine/setjmp-dj.h
@@ -0,0 +1,44 @@
+/*
+** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
+**
+** This file is distributed under the terms listed in the document
+** "copying.dj", available from DJ Delorie at the address above.
+** A copy of "copying.dj" should accompany this file; if not, a copy
+** should be available from where this file was obtained. This file
+** may not be distributed without a verbatim copy of "copying.dj".
+**
+** This file is distributed WITHOUT ANY WARRANTY; without even the implied
+** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/* Modified to use SETJMP_DJ_H rather than SETJMP_H to avoid
+ conflicting with setjmp.h. Ian Taylor, Cygnus support, April,
+ 1993. */
+
+#ifndef _SETJMP_DJ_H_
+#define _SETJMP_DJ_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ unsigned long eax;
+ unsigned long ebx;
+ unsigned long ecx;
+ unsigned long edx;
+ unsigned long esi;
+ unsigned long edi;
+ unsigned long ebp;
+ unsigned long esp;
+ unsigned long eip;
+} jmp_buf[1];
+
+extern int setjmp(jmp_buf);
+extern void longjmp(jmp_buf, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h
new file mode 100644
index 00000000000..4656c0ff1d5
--- /dev/null
+++ b/newlib/libc/include/machine/setjmp.h
@@ -0,0 +1,168 @@
+#if defined(__arm__) || defined(__thumb__)
+/*
+ * All callee preserved registers:
+ * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7
+ */
+#define _JBLEN 23
+#endif
+
+#ifdef __sparc__
+/*
+ * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
+ * All else recovered by under/over(flow) handling.
+ */
+#define _JBLEN 13
+#endif
+
+/* necv70 was 9 as well. */
+
+#ifdef __mc68000__
+/*
+ * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
+ * fp2-fp7 for 68881.
+ * All else recovered by under/over(flow) handling.
+ */
+#define _JBLEN 34
+#endif
+
+#if defined(__Z8001__) || defined(__Z8002__)
+/* 16 regs + pc */
+#define _JBLEN 20
+#endif
+
+#ifdef _AM29K
+/*
+ * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
+ * All else recovered by under/over(flow) handling.
+ */
+#define _JBLEN 9
+#endif
+
+#if defined(__CYGWIN__) && !defined (_JBLEN)
+#define _JBLEN (13 * 4)
+#elif defined (__i386__)
+#ifdef __unix__
+# define _JBLEN 36
+#else
+#include "setjmp-dj.h"
+#endif
+#endif
+
+#ifdef __i960__
+#define _JBLEN 35
+#endif
+
+#ifdef __M32R__
+/* Only 8 words are currently needed. 10 gives us some slop if we need
+ to expand. */
+#define _JBLEN 10
+#endif
+
+#ifdef __mips__
+#define _JBLEN 11
+#endif
+
+#ifdef __m88000__
+#define _JBLEN 21
+#endif
+
+#ifdef __H8300__
+#define _JBLEN 5
+typedef int jmp_buf[_JBLEN];
+#endif
+
+#ifdef __H8300H__
+/* same as H8/300 but registers are twice as big */
+#define _JBLEN 5
+#define _JBTYPE long
+#endif
+
+#ifdef __H8300S__
+/* same as H8/300 but registers are twice as big */
+#define _JBLEN 5
+#define _JBTYPE long
+#endif
+
+#ifdef __H8500__
+#define _JBLEN 4
+#endif
+
+#ifdef __sh__
+#define _JBLEN 20
+#endif
+
+#ifdef __v800
+#define _JBLEN 28
+#endif
+
+#ifdef __PPC__
+#define _JBLEN 32
+#define _JBTYPE double
+#endif
+
+#ifdef __hppa__
+/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15.
+ Note space exists for the FP registers, but they are not
+ saved. */
+#define _JBLEN 28
+#endif
+
+#if defined(__mn10300__) || defined(__mn10200__)
+/* A guess */
+#define _JBLEN 10
+#endif
+
+#ifdef __v850
+/* I think our setjmp is saving 15 regs at the moment. Gives us one word
+ slop if we need to expand. */
+#define _JBLEN 16
+#endif
+
+#ifdef __TIC80__
+#define _JBLEN 13
+#endif
+
+#ifdef __D10V__
+#define _JBLEN 8
+#endif
+
+#ifdef __D30V__
+#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2)
+#define _JBTYPE double
+#endif
+
+
+#ifdef __fr30__
+#define _JBLEN 10
+#endif
+
+#ifdef __mcore__
+#define _JBLEN 16
+#endif
+
+#ifdef _JBLEN
+#ifdef _JBTYPE
+typedef _JBTYPE jmp_buf[_JBLEN];
+#else
+typedef int jmp_buf[_JBLEN];
+#endif
+
+#if defined(__CYGWIN32__) || defined(__rtems__)
+#include <signal.h>
+
+/* POSIX sigsetjmp/siglongjmp macros */
+typedef int sigjmp_buf[_JBLEN+2];
+
+#define _SAVEMASK _JBLEN
+#define _SIGMASK (_JBLEN+1)
+
+#define sigsetjmp(env, savemask) (env[_SAVEMASK] = savemask,\
+ sigprocmask (SIG_SETMASK, 0, (sigset_t *) &env[_SIGMASK]),\
+ setjmp (env))
+
+#define siglongjmp(env, val) (((env[_SAVEMASK])?\
+ sigprocmask (SIG_SETMASK, (sigset_t *) &env[_SIGMASK], 0):0),\
+ longjmp (env, val))
+
+#endif /* __CYGWIN32__ or __rtems__ */
+#endif
diff --git a/newlib/libc/include/machine/time.h b/newlib/libc/include/machine/time.h
new file mode 100644
index 00000000000..13857bfdebf
--- /dev/null
+++ b/newlib/libc/include/machine/time.h
@@ -0,0 +1,10 @@
+#ifndef _MACHTIME_H_
+#define _MACHTIME_H_
+
+#if defined(__arm__) || defined(__thumb__)
+#define _CLOCKS_PER_SEC_ 100
+#endif
+
+#endif /* _MACHTIME_H_ */
+
+
diff --git a/newlib/libc/include/machine/types.h b/newlib/libc/include/machine/types.h
new file mode 100644
index 00000000000..b71a67f564f
--- /dev/null
+++ b/newlib/libc/include/machine/types.h
@@ -0,0 +1,9 @@
+#ifndef _MACHTYPES_H_
+#define _MACHTYPES_H_
+
+#define _CLOCK_T_ unsigned long /* clock() */
+#define _TIME_T_ long /* time() */
+
+#endif /* _MACHTYPES_H_ */
+
+