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