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