From 7152ded5219453c9ff1cd062cecbeaf4d77e4cab Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Thu, 26 May 2016 15:05:48 +0200
Subject: [PATCH] Use <fenv.h> instead of <fpu_control.h>
musl libc (http://musl-libc.org lack the non-standard <fpu_control.h>
header, which is used in src/os/linux/{i386,x86_64}/init.c files to
setup the floating point precision. This patch makes it use the
standard C <fenv.h> header instead.
Original patch at Felix Janda at
https://sourceforge.net/p/jamvm/patches/6/.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
src/os/linux/i386/init.c | 12 ++++++------
src/os/linux/x86_64/init.c | 16 ++++++----------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/os/linux/i386/init.c b/src/os/linux/i386/init.c
index d9c6648..94a733e 100644
--- a/src/os/linux/i386/init.c
+++ b/src/os/linux/i386/init.c
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#include <fpu_control.h>
/* Change floating point precision to double (64-bit) from
* the extended (80-bit) Linux default. */
void setDoublePrecision() {
+ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
+ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
void initialisePlatform() {
diff --git a/src/os/linux/x86_64/init.c b/src/os/linux/x86_64/init.c
index 9d55229..a76a923 100644
--- a/src/os/linux/x86_64/init.c
+++ b/src/os/linux/x86_64/init.c
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#include <fpu_control.h>
/* Change the x87 FPU precision to double (64-bit) from the extended
(80-bit) Linux default. Note, unlike on i386, my testcases pass