From e5624832d0c6535be32fb0452c4ce8e8637b0ad4 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 8 Jun 2013 17:37:33 +0800 Subject: [PATCH] Usermode/libm - Stubbed up a quick libm (using gcc builtins) --- Usermode/Libraries/libm.so_src/Makefile | 17 +++++++++++++++++ .../Libraries/libm.so_src/include_exp/math.h | 13 +++++++++++++ Usermode/Libraries/libm.so_src/pow.c | 18 ++++++++++++++++++ Usermode/Libraries/libm.so_src/stub.c | 14 ++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 Usermode/Libraries/libm.so_src/Makefile create mode 100644 Usermode/Libraries/libm.so_src/include_exp/math.h create mode 100644 Usermode/Libraries/libm.so_src/pow.c create mode 100644 Usermode/Libraries/libm.so_src/stub.c diff --git a/Usermode/Libraries/libm.so_src/Makefile b/Usermode/Libraries/libm.so_src/Makefile new file mode 100644 index 00000000..1c6df334 --- /dev/null +++ b/Usermode/Libraries/libm.so_src/Makefile @@ -0,0 +1,17 @@ +# +# Acess2 C Library (Math) +# - By John Hodge (thePowersGang) +# + +-include ../Makefile.cfg + +CPPFLAGS += +CFLAGS += -Werror -Wextra +ASFLAGS += +LDFLAGS += + +OBJ = stub.o pow.o +BIN := libm.so + +include ../Makefile.tpl + diff --git a/Usermode/Libraries/libm.so_src/include_exp/math.h b/Usermode/Libraries/libm.so_src/include_exp/math.h new file mode 100644 index 00000000..349547ed --- /dev/null +++ b/Usermode/Libraries/libm.so_src/include_exp/math.h @@ -0,0 +1,13 @@ +/* + * Acess2 C Library (Maths) + * - By John Hodge (thePowersGang) + * + * math.h + * - C99 Header + */ +#ifndef _LIBM__MATH_H_ +#define _LIBM__MATH_H_ + +extern double pow(double x, double y); + +#endif diff --git a/Usermode/Libraries/libm.so_src/pow.c b/Usermode/Libraries/libm.so_src/pow.c new file mode 100644 index 00000000..f35d7c25 --- /dev/null +++ b/Usermode/Libraries/libm.so_src/pow.c @@ -0,0 +1,18 @@ +/* + * Acess2 C Library (Maths) + * - By John Hodge (thePowersGang) + * + * pow.c + * - pow(), powf() and powl() + */ +#include + +// === CODE === +double pow(double x, double y) +{ + if( x == 1.0f ) + return 1.0f; + if( y == 0.0f ) + return 1.0f; + return __builtin_pow(x,y); +} diff --git a/Usermode/Libraries/libm.so_src/stub.c b/Usermode/Libraries/libm.so_src/stub.c new file mode 100644 index 00000000..1c6c52a8 --- /dev/null +++ b/Usermode/Libraries/libm.so_src/stub.c @@ -0,0 +1,14 @@ +/* + * Acess2 C Library (Maths) + * - By John Hodge (thePowersGang) + * + * stub.c + * - Provides SoMain (unused) + */ + +// === CODE === +int SoMain(void) +{ + return 0; +} + -- 2.20.1