mozilla-s390-context.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 12 Dec 2022 22:35:13 +0100
branchfirefox107
changeset 1181 ba646dddffef
parent 1180 d76083122710
child 1190 2a24a948b5cf
permissions -rw-r--r--
107.0.1

# HG changeset patch
# User msirringhaus@suse.de
# Date 1558452408 -7200
#      Tue May 21 17:26:48 2019 +0200
# Node ID 602e92722e765a3c238d3b96b26c0c8063b5eeb4
# Parent  6d6ebdace8a9877fe17c1bd14b80307c258c864f
[mq]: mozilla-s390-context.patch

diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp
--- a/js/src/wasm/WasmSignalHandlers.cpp
+++ b/js/src/wasm/WasmSignalHandlers.cpp
@@ -163,16 +163,20 @@ using mozilla::DebugOnly;
 #      define R03_sig(p) ((p)->uc_mcontext.__gregs[3])
 #      define RFP_sig(p) ((p)->uc_mcontext.__gregs[22])
 #    endif
 #    if defined(__sun__) && defined(__sparc__)
 #      define PC_sig(p) ((p)->uc_mcontext.gregs[REG_PC])
 #      define FP_sig(p) ((p)->uc_mcontext.gregs[REG_FPRS])
 #      define SP_sig(p) ((p)->uc_mcontext.gregs[REG_SP])
 #    endif
+#  if defined(__linux__) && defined(__s390x__)
+#    define GR_sig(p,x) ((p)->uc_mcontext.gregs[x])
+#    define PSWa_sig(p) ((p)->uc_mcontext.psw.addr)
+#  endif
 #  elif defined(__NetBSD__)
 #    define EIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EIP])
 #    define EBP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EBP])
 #    define ESP_sig(p) ((p)->uc_mcontext.__gregs[_REG_ESP])
 #    define RIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_RIP])
 #    define RSP_sig(p) ((p)->uc_mcontext.__gregs[_REG_RSP])
 #    define RBP_sig(p) ((p)->uc_mcontext.__gregs[_REG_RBP])
 #    define R11_sig(p) ((p)->uc_mcontext.__gregs[_REG_R11])
@@ -405,16 +409,20 @@ struct macos_aarch64_context {
 #    define PC_sig(p) R32_sig(p)
 #    define SP_sig(p) R01_sig(p)
 #    define FP_sig(p) R01_sig(p)
 #  elif defined(__loongarch__)
 #    define PC_sig(p) EPC_sig(p)
 #    define FP_sig(p) RFP_sig(p)
 #    define SP_sig(p) R03_sig(p)
 #    define LR_sig(p) RRA_sig(p)
+#  elif defined(__s390x__)
+#    define PC_sig(p) PSWa_sig(p)
+#    define SP_sig(p) GR_sig(p, 15)
+#    define FP_sig(p) GR_sig(p, 11)
 #  endif
 
 static void SetContextPC(CONTEXT* context, uint8_t* pc) {
 #  ifdef PC_sig
   *reinterpret_cast<uint8_t**>(&PC_sig(context)) = pc;
 #  else
   MOZ_CRASH();
 #  endif