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