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