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