225ef2
# HG changeset patch
225ef2
# User msirringhaus@suse.de
225ef2
# Date 1558452408 -7200
225ef2
#      Tue May 21 17:26:48 2019 +0200
225ef2
# Node ID 602e92722e765a3c238d3b96b26c0c8063b5eeb4
f838c9
# Parent  136e1f2c44a3099b3e49a576fa62c8ad77aa431e
225ef2
[mq]: mozilla-s390-context.patch
225ef2
f838c9
diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp
f838c9
--- a/js/src/wasm/WasmSignalHandlers.cpp
f838c9
+++ b/js/src/wasm/WasmSignalHandlers.cpp
f838c9
@@ -157,16 +157,20 @@ using mozilla::DebugOnly;
f838c9
 #      define R32_sig(p) ((p)->uc_mcontext.gp_regs[32])
f838c9
 #    endif
f838c9
 #    if defined(__linux__) && defined(__loongarch__)
f838c9
 #      define EPC_sig(p) ((p)->uc_mcontext.pc)
f838c9
 #      define RRA_sig(p) ((p)->uc_mcontext.gregs[1])
f838c9
 #      define RSP_sig(p) ((p)->uc_mcontext.gregs[3])
f838c9
 #      define RFP_sig(p) ((p)->uc_mcontext.gregs[22])
f838c9
 #    endif
225ef2
+#  if defined(__linux__) && defined(__s390x__)
225ef2
+#    define GR_sig(p,x) ((p)->uc_mcontext.gregs[x])
225ef2
+#    define PSWa_sig(p) ((p)->uc_mcontext.psw.addr)
225ef2
+#  endif
f838c9
 #  elif defined(__NetBSD__)
f838c9
 #    define EIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EIP])
f838c9
 #    define EBP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EBP])
f838c9
 #    define ESP_sig(p) ((p)->uc_mcontext.__gregs[_REG_ESP])
f838c9
 #    define RIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_RIP])
f838c9
 #    define RSP_sig(p) ((p)->uc_mcontext.__gregs[_REG_RSP])
f838c9
 #    define RBP_sig(p) ((p)->uc_mcontext.__gregs[_REG_RBP])
f838c9
 #    define R11_sig(p) ((p)->uc_mcontext.__gregs[_REG_R11])
f838c9
@@ -399,16 +403,20 @@ struct macos_aarch64_context {
f838c9
 #    define PC_sig(p) R32_sig(p)
f838c9
 #    define SP_sig(p) R01_sig(p)
f838c9
 #    define FP_sig(p) R01_sig(p)
f838c9
 #  elif defined(__loongarch__)
f838c9
 #    define PC_sig(p) EPC_sig(p)
f838c9
 #    define FP_sig(p) RFP_sig(p)
f838c9
 #    define SP_sig(p) RSP_sig(p)
f838c9
 #    define LR_sig(p) RRA_sig(p)
f838c9
+#  elif defined(__s390x__)
f838c9
+#    define PC_sig(p) PSWa_sig(p)
f838c9
+#    define SP_sig(p) GR_sig(p, 15)
f838c9
+#    define FP_sig(p) GR_sig(p, 11)
f838c9
 #  endif
225ef2
 
225ef2
 static void SetContextPC(CONTEXT* context, uint8_t* pc) {
f838c9
 #  ifdef PC_sig
225ef2
   *reinterpret_cast<uint8_t**>(&PC_sig(context)) = pc;
f838c9
 #  else
f838c9
   MOZ_CRASH();
f838c9
 #  endif