void-packages/srcpkgs/qt5-webkit/patches/musl-mcontext.patch
Đoàn Trần Công Danh 635e9da391 srcpkgs/q*: convert patches to -Np1
* par is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

65 lines
2.3 KiB
Diff

--- a/Source/JavaScriptCore/heap/MachineStackMarker.cppg 2019-01-12 19:48:12.801137040 +0100
+++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp 2019-01-12 20:09:03.662201571 +0100
@@ -681,7 +681,19 @@
#endif
#else
-#error Need a way to get the frame pointer for another thread on this platform
+
+// The following sequence depends on musl libc's sys/ucontext.h.
+#if CPU(X86)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[REG_EBP]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[REG_RBP]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.arm_fp);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.regs[29]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[30]);
+#endif
#endif
}
@@ -761,7 +773,19 @@
#endif
#else
-#error Need a way to get the instruction pointer for another thread on this platform
+
+// The following sequence depends on musl libc's sys/ucontext.h.
+#if CPU(X86)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[REG_EIP]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[REG_RIP]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.arm_pc);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.pc);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.pc);
+#endif
#endif
}
void* MachineThreads::Thread::Registers::llintPC() const
@@ -850,7 +874,19 @@
#endif
#else
-#error Need a way to get the LLIntPC for another thread on this platform
+
+// The following sequence depends on musl libc's sys/ucontext.h.
+#if CPU(X86)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[REG_ESI]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[REG_R8]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.arm_r8);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.regs[4]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[12]);
+#endif
#endif
}
#endif // ENABLE(SAMPLING_PROFILER)