• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/jamvm/0001-Use-fenv.h-instead-of-fpu_control.h.patch
Thomas PetazzoniThomas Petazzoni committed 0b6b67f34d626 May 2016
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
From 7152ded5219453c9ff1cd062cecbeaf4d77e4cab Mon Sep 17 00:00:00 2001
2
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3
Date: Thu, 26 May 2016 15:05:48 +0200
4
Subject: [PATCH] Use <fenv.h> instead of <fpu_control.h>
5
​
6
musl libc (http://musl-libc.org lack the non-standard <fpu_control.h>
7
header, which is used in src/os/linux/{i386,x86_64}/init.c files to
8
setup the floating point precision. This patch makes it use the
9
standard C <fenv.h> header instead.
10
​
11
Original patch at Felix Janda at
12
https://sourceforge.net/p/jamvm/patches/6/.
13
​
14
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
15
---
16
 src/os/linux/i386/init.c   | 12 ++++++------
17
 src/os/linux/x86_64/init.c | 16 ++++++----------
18
 2 files changed, 12 insertions(+), 16 deletions(-)
19
​
20
diff --git a/src/os/linux/i386/init.c b/src/os/linux/i386/init.c
21
index d9c6648..94a733e 100644
22
--- a/src/os/linux/i386/init.c
23
+++ b/src/os/linux/i386/init.c
24
@@ -19,18 +19,18 @@
25
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
  */
27
 
28
-#include <fpu_control.h>
29
+#include <fenv.h>
30
 
31
 /* Change floating point precision to double (64-bit) from
32
  * the extended (80-bit) Linux default. */
33
 
34
 void setDoublePrecision() {
35
-    fpu_control_t cw;
36
+    fenv_t fenv;
37
 
38
-    _FPU_GETCW(cw);
39
-    cw &= ~_FPU_EXTENDED;
40
-    cw |= _FPU_DOUBLE;
41
-    _FPU_SETCW(cw);
42
+    fegetenv(&fenv);
43
+    fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
44
+    fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
45
+    fesetenv(&fenv);
46
 }
47
 
48
 void initialisePlatform() {
49
diff --git a/src/os/linux/x86_64/init.c b/src/os/linux/x86_64/init.c
50
index 9d55229..a76a923 100644
51
--- a/src/os/linux/x86_64/init.c
52
+++ b/src/os/linux/x86_64/init.c
53
@@ -19,9 +19,7 @@
54
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
55
  */
56
 
57
-#ifdef __linux__
58
-#include <fpu_control.h>
59
-#endif
60
+#include <fenv.h>
61
 
62
 /* Change the x87 FPU precision to double (64-bit) from the extended
63
    (80-bit) Linux default.  Note, unlike on i386, my testcases pass
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.