0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-07-29 13:10:25 +00:00
Files
termux-packages/packages/openjdk-17/0016-Don-t-run-fpu_control-related-functions-on-Android.patch

76 lines
2.3 KiB
Diff

From f0a0b72c834c309f71b4b31ade351e14c67c1d59 Mon Sep 17 00:00:00 2001
From: Duy Tran Khanh <40482367+khanhduytran0@users.noreply.github.com>
Date: Sat, 12 Jun 2021 06:58:20 +0700
Subject: [PATCH] Don't run fpu_control related functions on Android
---
src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp | 2 ++
src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp | 10 +++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
index 6fc0c840642f..a9a3087419bd 100644
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
@@ -70,7 +70,9 @@
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
+#ifndef __ANDROID__
# include <fpu_control.h>
+#endif
# include <asm/ptrace.h>
#define SPELL_REG_SP "sp"
diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
index cc71b0d27801..be6ad9c00c37 100644
--- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
@@ -73,7 +73,7 @@
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
-#ifndef AMD64
+#if !defined(AMD64) && !defined(__ANDROID__)
# include <fpu_control.h>
#endif
@@ -418,14 +418,14 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
}
void os::Linux::init_thread_fpu_state(void) {
-#ifndef AMD64
+#if !defined(AMD64) && !defined(__ANDROID__)
// set fpu to 53 bit precision
set_fpu_control_word(0x27f);
#endif // !AMD64
}
int os::Linux::get_fpu_control_word(void) {
-#ifdef AMD64
+#if defined(AMD64) || defined(__ANDROID__)
return 0;
#else
int fpu_control;
@@ -435,7 +435,7 @@ int os::Linux::get_fpu_control_word(void) {
}
void os::Linux::set_fpu_control_word(int fpu_control) {
-#ifndef AMD64
+#if !defined(AMD64) && !defined(__ANDROID__)
_FPU_SETCW(fpu_control);
#endif // !AMD64
}
@@ -614,7 +614,7 @@ void os::print_register_info(outputStream *st, const void *context) {
}
void os::setup_fpu() {
-#ifndef AMD64
+#if !defined(AMD64) && !defined(__ANDROID__)
address fpu_cntrl = StubRoutines::x86::addr_fpu_cntrl_wrd_std();
__asm__ volatile ( "fldcw (%0)" :
: "r" (fpu_cntrl) : "memory");
--
2.44.0