dolphin/Source/Core/Common
JosJuice 86c1f6e1e7 Jit: Don't use a second stack
This second stack leads to JNI problems on Android, because ART fetches
the address and size of the original stack using pthread functions
(see GetThreadStack in art/runtime/thread.cc), and (presumably) treats
stack addresses outside of the original stack as invalid. (What I don't
understand is why some JNI operations on the CPU thread work fine
despite this but others don't.)

Instead of creating a second stack, let's borrow the approach ART uses:
Use pthread functions to find out the stack's address and size, then
install guard pages at an appropriate location. This lets us get rid
of a workaround we had in the MsgAlert function.

Because we're no longer choosing the stack size ourselves, I've made some
tweaks to where the put the guard pages. Previously we had a stack of
2 MiB and a safe zone of 512 KiB. We now accept stacks as small as 512 KiB
(used on macOS) and use a safe zone of 256 KiB. I feel like this should
be fine, but haven't done much testing beyond "it seems to work".

By the way, on Windows it was already the case that we didn't create
a second stack... But there was a bug in the implementation!
The code for protecting the stack has to run on the CPU thread, since
it's the CPU thread's stack we want to protect, but it was actually
running on EmuThread. This commit fixes that, since now this bug
matters on other operating systems too.
2023-02-28 20:29:46 +01:00
..
Config Integrate "Ignore for this session" better with config system 2022-09-24 13:03:45 +02:00
Crypto Replace BitUtils with C++20: RotateLeft/RotateRight 2022-12-11 08:59:18 +01:00
Debug Fix uninitialized variable warnings (C26495) 2023-02-15 19:18:39 -08:00
GL VideoBackend/OGL: Prefer KHR_subgroup over NV_shader_thread. 2023-02-09 13:27:02 +01:00
Logging Use __VA_OPT__(, ) __VA_ARGS__ instead of ##__VA_ARGS__ 2022-08-23 12:09:57 -07:00
Align.h licensing: convert "public domain" to CC0 1.0 2021-07-05 04:43:55 +02:00
Analytics.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
Analytics.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
AndroidAnalytics.cpp Android: Mark s_android_send_report as static 2022-01-06 12:20:09 +01:00
AndroidAnalytics.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Arm64Emitter.cpp Arm64Emitter: Fix SHRN/SHRN2 2022-12-10 11:20:23 +01:00
Arm64Emitter.h Fix uninitialized variable warnings (C26495) 2023-02-15 19:18:39 -08:00
ArmCommon.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
ArmCPUDetect.cpp Common: Replace StringBeginsWith/StringEndsWith with std equivalents 2023-01-24 14:58:20 -05:00
ArmFPURoundMode.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
Assert.h Use __VA_OPT__(, ) __VA_ARGS__ instead of ##__VA_ARGS__ 2022-08-23 12:09:57 -07:00
BitField.h Make all custom fmt::formatter's format functions const 2022-01-13 11:11:08 -08:00
BitField.natvis Improve BitField natvis 2022-01-02 14:39:34 -08:00
BitSet.h Common/BitSet: Zero initialize data member 2023-01-25 04:16:30 -05:00
BitUtils.h Replace BitUtils with C++20: Counting Zeroes 2022-12-21 04:17:00 -06:00
BlockingLoop.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
build_info.txt.in MacUpdater: check os version 2022-10-30 12:04:57 -07:00
ChunkFile.h HostFileSystem: Set all NAND folders to be saved in save states when a movie is active 2022-11-10 14:02:29 -05:00
CMakeLists.txt Merge pull request #11544 from jmallach/spng 2023-02-09 14:47:58 +01:00
CodeBlock.h Common/CodeBlock: Call ResetCodePtr when decreasing region_size 2022-02-12 17:51:32 +01:00
ColorUtil.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
ColorUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Common.h Common/MsgHandler: Remove non-format variants of PanicAlert 2022-01-09 12:44:14 -08:00
CommonFuncs.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
CommonFuncs.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
CommonPaths.h CommonPaths: Add Steam-specific user directory 2023-01-31 17:57:09 -05:00
CommonTypes.h New FrameTime/VBlank Analyzer + Graph 2022-12-23 19:52:53 -05:00
CompatPatches.cpp Add fmt/xchar includes where wstring is used 2022-01-13 11:11:08 -08:00
CPUDetect.h CPUDetect: improve win/arm64 support 2022-07-25 21:21:11 -07:00
DebugInterface.h DolphinQt: Properly lock CPU before accessing emulated memory 2023-02-12 11:27:50 +01:00
DynamicLibrary.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
DynamicLibrary.h Common: Make DynamicLibrary non-copyable 2022-03-05 23:40:41 +01:00
ENetUtil.cpp ENetUtil: Add check for valid socket in SendPacket(). 2023-02-10 19:32:40 +01:00
ENetUtil.h ENetUtil: Check return values of ENet functions in SendPacket(). 2022-10-09 02:39:38 +02:00
EnumFormatter.h Merge pull request #10367 from Pokechu22/fmt-8.1.1 2022-01-20 21:14:41 +01:00
EnumMap.h EnumMap: Fix typo 2022-08-28 22:38:35 -07:00
EnumMap.natvis Create EnumMap natvis 2022-01-02 15:36:47 -08:00
Event.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FatFsUtil.cpp Fix uninitialized variable warnings (C26495) 2023-02-15 19:18:39 -08:00
FatFsUtil.h FatFsUtil: Add ability to provide callbacks for the FatFs code. 2022-09-29 05:16:21 +02:00
FileSearch.cpp get rid of HAS_STD_FILESYSTEM 2023-01-10 05:17:43 -08:00
FileSearch.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FileUtil.cpp Common/FileUtil: Remove obsolete CopyDir() function. 2023-02-26 23:17:10 +01:00
FileUtil.h Common/FileUtil: Remove obsolete CopyDir() function. 2023-02-26 23:17:10 +01:00
FixedSizeQueue.h Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
Flag.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FloatUtils.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FloatUtils.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FormatUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
FPURoundMode.h remove SetRoundMode 2021-07-17 19:29:22 -07:00
GekkoDisassembler.cpp Gekko constistancy changes. Add context item to codeview to show or copy a load/store target memory address from instructions at or near PC when paused. 2022-03-17 12:53:38 -07:00
GekkoDisassembler.h Gekko constistancy changes. Add context item to codeview to show or copy a load/store target memory address from instructions at or near PC when paused. 2022-03-17 12:53:38 -07:00
GenericCPUDetect.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
GenericFPURoundMode.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
Hash.cpp Android: Fix armeabi-v7a build 2023-02-17 16:58:24 +01:00
Hash.h Common/Hash: use zlib-ng for adler32. small cleanups. 2022-08-01 10:07:27 -07:00
HookableEvent.h HookableEvent: Switch to construct on first use 2023-02-13 18:48:43 +13:00
HRWrap.cpp windows: replace comdef dependency with winrt 2023-01-23 06:09:01 -08:00
HRWrap.h windows: buildfix if pch not used 2022-04-12 12:28:57 -07:00
HttpRequest.cpp Replace use of of unsigned char* with fmt 2022-01-13 11:11:08 -08:00
HttpRequest.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Image.cpp Common/Image: Add unit to log message 2022-09-26 15:04:15 -07:00
Image.h replace libpng with libspng 2022-07-25 18:32:16 -07:00
IniFile.cpp StripSpaces: only strip spaces 2022-07-25 18:40:12 -07:00
IniFile.h Use Common::ToLower and Common::ToUpper 2022-01-16 17:00:12 -08:00
Inline.h Change _WIN32 check to a _MSC_VER check in Inline.h 2022-05-02 01:57:36 -05:00
Intrinsics.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
IOFile.cpp NetworkCaptureLogger: Allow PCAP shared read access on Windows 2022-09-29 23:08:25 +04:00
IOFile.h NetworkCaptureLogger: Allow PCAP shared read access on Windows 2022-09-29 23:08:25 +04:00
JitRegister.cpp JitRegister: Use fmt 2022-02-16 20:09:38 +00:00
JitRegister.h JitRegister: Use fmt 2022-02-16 20:09:38 +00:00
Lazy.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
LdrWatcher.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
LdrWatcher.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
LinearDiskCache.h IOFile: Rename Clear() to ClearError() for clarity. 2022-01-29 06:49:22 +01:00
make_scmrev.h.js make_scmrev.h.js: set default auto-update track from environment 2018-03-19 00:11:55 +01:00
MathUtil.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
MathUtil.h Replace BitUtils with C++20: Counting Zeroes 2022-12-21 04:17:00 -06:00
Matrix.cpp Common/Matrix: Fix Quaternion Norm function. 2022-10-10 21:16:35 -05:00
Matrix.h Common/Matrix: Add equality operators to TVec2/3/4. 2022-09-24 01:38:01 +02:00
MemArena.h MemArena: Keep fastmem region mapped on Linux. 2022-02-14 22:14:41 +01:00
MemArenaAndroid.cpp MemArena: Prepare interface for proper memory reservation. 2021-12-25 20:20:36 +01:00
MemArenaUnix.cpp MemArena: Keep fastmem region mapped on Linux. 2022-02-14 22:14:41 +01:00
MemArenaWin.cpp MemArena: Load UnmapViewOfFileEx dynamically to restore Windows 7 support. 2022-02-14 21:57:18 +01:00
MemoryUtil.cpp MemoryUtil: Remove __builtin_available for macOS 10.14 2022-06-01 22:57:56 -04:00
MemoryUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
MinizipUtil.h ResourcePack: dont scan for individual files 2022-08-06 15:38:46 -07:00
MsgHandler.cpp Common/MsgHandler: Use caller's file and line number in log messages 2022-01-09 12:44:14 -08:00
MsgHandler.h Common: Add [[nodiscard]] to GetStringT(). 2022-09-23 14:58:18 +02:00
NandPaths.cpp Common: Replace StringBeginsWith/StringEndsWith with std equivalents 2023-01-24 14:58:20 -05:00
NandPaths.h IOS/ES: Add support for V1Ticket 2022-11-17 17:54:06 -05:00
Network.cpp Common/Network: Resolve -Wexpansion-to-defined warning 2023-01-30 14:20:56 -05:00
Network.h BBA/BuiltIn: Add SSDP multicast support 2022-08-24 21:29:57 +04:00
PcapFile.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
PcapFile.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
PerformanceCounter.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
PerformanceCounter.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Profiler.cpp Common::Timer: use chrono::steady_clock internally 2022-08-02 22:24:06 -07:00
Profiler.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
QoSSession.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
QoSSession.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Random.cpp use std-provided randomness for JitArm64 unittests 2023-02-22 12:55:12 -08:00
Random.h use std-provided randomness for JitArm64 unittests 2023-02-22 12:55:12 -08:00
Result.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
scmrev.h.in Make it possible to enable auto-updates by default with CMake builds 2021-04-17 19:45:43 +02:00
SCMRevGen.vcxproj msbuild: simplify lang/scm projects a bit 2022-04-27 15:06:04 -07:00
ScopeGuard.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SDCardUtil.cpp msvc: remove warning disables which no longer fire 2021-07-17 18:24:36 -07:00
SDCardUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Semaphore.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SettingsHandler.cpp Use fmt::localtime instead of thread-unsafe std::localtime 2021-10-15 22:49:13 +02:00
SettingsHandler.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SFMLHelper.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SFMLHelper.h SFMLHelper: Add stream insertion overload helpers for enum types 2021-09-22 15:42:01 -04:00
SocketContext.cpp treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SocketContext.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SPSCQueue.h Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
StringLiteral.h Apply suggestions from code review 2023-02-09 18:36:20 +13:00
StringUtil.cpp Common: Add utility function for case-insensitive string comparison. 2023-02-28 00:56:33 +01:00
StringUtil.h Common: Add utility function for case-insensitive string comparison. 2023-02-28 00:56:33 +01:00
Swap.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
SymbolDB.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
SymbolDB.h DolphinQt: Properly lock CPU before accessing emulated memory 2023-02-12 11:27:50 +01:00
Thread.cpp Jit: Don't use a second stack 2023-02-28 20:29:46 +01:00
Thread.h Jit: Don't use a second stack 2023-02-28 20:29:46 +01:00
Timer.cpp add TODO for chrono in GetLocalTimeSinceJan1970 2022-08-06 22:25:30 -07:00
Timer.h Timer: protect usages of ms timers from rollover 2022-08-02 22:24:06 -07:00
TraversalClient.cpp NetPlayDialog: Display external IP/Port as seen by the traversal server when it's used. 2022-03-15 01:56:16 -05:00
TraversalClient.h NetPlayDialog: Display external IP/Port as seen by the traversal server when it's used. 2022-03-15 01:56:16 -05:00
TraversalProto.h NetPlayDialog: Display external IP/Port as seen by the traversal server when it's used. 2022-03-15 01:56:16 -05:00
TraversalServer.cpp licensing: convert "public domain" to CC0 1.0 2021-07-05 04:43:55 +02:00
TypeUtils.h Create EnumMap 2021-10-24 11:48:36 -07:00
UPnP.cpp Merge pull request #9709 from AdmiralCurtiss/upnp-error-log 2021-07-06 15:36:38 +02:00
UPnP.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
VariantUtil.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
Version.cpp Fix static initialisation order fiasco issue for Version variables 2022-01-14 00:04:22 +01:00
Version.h Fix static initialisation order fiasco issue for Version variables 2022-01-14 00:04:22 +01:00
WindowsRegistry.cpp windows: prefer os version from registry 2023-01-17 01:38:00 -08:00
WindowsRegistry.h CMake/MSVC: Fix PCH disabled build 2023-01-31 23:21:07 +13:00
WindowSystemInfo.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
WorkQueueThread.h Optimise cond_var predicate order 2023-02-05 17:20:00 +13:00
x64ABI.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
x64ABI.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
x64CPUDetect.cpp CMake/MSVC: Fix PCH disabled build 2023-01-31 23:21:07 +13:00
x64Emitter.cpp Common/Assert: Switch to fmt 2022-01-09 12:43:11 -08:00
x64Emitter.h HW: Pass System to MMIO handlers. 2022-11-23 05:52:21 +01:00
x64FPURoundMode.cpp Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
x64Reg.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00