From: Mike Hommey Date: Sat, 1 Jun 2019 00:06:01 +0000 (+0900) Subject: Bug 1526653 - Include struct definitions for user_vfp and user_vfp_exc. X-Git-Tag: archive/raspbian/1%102.15.0-1_deb10u1+rpi1^2^2^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=496d8d33696f71a5fb91f007212556fa3333033a;p=thunderbird.git Bug 1526653 - Include struct definitions for user_vfp and user_vfp_exc. Gbp-Pq: Topic porting-armhf Gbp-Pq: Name Bug-1526653-Include-struct-definitions-for-user_vfp-and-u.patch --- diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp index 67d18a9ebb..8420b878a3 100644 --- a/js/src/wasm/WasmSignalHandlers.cpp +++ b/js/src/wasm/WasmSignalHandlers.cpp @@ -243,7 +243,38 @@ using mozilla::DebugOnly; "Don't know how to read/write to the thread state via the mcontext_t." # endif -# if defined(ANDROID) +// On ARM Linux, including Android, unaligned FP accesses that were not flagged +// as unaligned will tend to trap (with SIGBUS) and will need to be emulated. +// +// We can only perform this emulation if the system header files provide access +// to the FP registers. In particular, must have definitions of +// `struct user_vfp` and `struct user_vfp_exc`, as it does on Android. +// +// Those definitions are however not present in the headers of every Linux +// distro - Raspbian is known to be a problem, for example. However those +// distros are tier-3 platforms. +// +// If you run into compile problems on a tier-3 platform, you can disable the +// emulation here. + +#if defined(__linux__) && defined(__arm__) +# define WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS +#endif + +#ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS +struct user_vfp { + unsigned long long fpregs[32]; + unsigned long fpscr; +}; + +struct user_vfp_exc { + unsigned long fpexc; + unsigned long fpinst; + unsigned long fpinst2; +}; +#endif + +#if defined(ANDROID) // Not all versions of the Android NDK define ucontext_t or mcontext_t. // Detect this and provide custom but compatible definitions. Note that these // follow the GLibc naming convention to access register values from