port this to arm64, and maybe fix the other ports in the

MachineStackMarker.cpp.  i didn't compile i386, arm or
mips with this, but it has a chance of working vs the
existing freebsd-derived patch.

XXX: someone extend this to all our CPUs, please.  i
     only fixed the existing maybe claimed support.
This commit is contained in:
mrg 2019-12-13 09:48:02 +00:00
parent 4868a2e119
commit c7ae59f536
3 changed files with 34 additions and 21 deletions

View file

@ -1,14 +1,15 @@
$NetBSD: distinfo,v 1.14 2019/07/20 18:29:33 nia Exp $
$NetBSD: distinfo,v 1.15 2019/12/13 09:48:02 mrg Exp $
SHA1 (qtwebkit-5.212.0-alpha3.tar.xz) = dd17b3884ccc20c9fce0f151738f923ec8cd147b
RMD160 (qtwebkit-5.212.0-alpha3.tar.xz) = 5a28f56735b7d3e98dd82f0a2566d9e31e0c37a3
SHA512 (qtwebkit-5.212.0-alpha3.tar.xz) = 38794514b886de3fa63a41277c2bcbb970e87a12070962b527e3898466cf7ad3b65ce4588669498415d365310b37729e81aabb457808fe11120558ef8e35445f
Size (qtwebkit-5.212.0-alpha3.tar.xz) = 12457896 bytes
SHA1 (patch-Source_JavaScriptCore_API_ObjCCallbackFunction.h) = be77c4b19f5f97c12180c1b7d3b72968364f3229
SHA1 (patch-Source_JavaScriptCore_assembler_ARM64Assembler.h) = 8b502d6960e5b52000dd6e67f65c2fbaf6e9d1f2
SHA1 (patch-Source_JavaScriptCore_assembler_ARMAssembler.h) = 7bbb0a59a0c087abaaddda08fc31aa24809acb70
SHA1 (patch-Source_JavaScriptCore_assembler_MacroAssemblerARM.cpp) = 79b54cb1d03d976a0629fbd8ee9ac1881951ba10
SHA1 (patch-Source_JavaScriptCore_dfg_DFGNode.h) = a3eba122c7226a80dacf1b762747fe0a7408b849
SHA1 (patch-Source_JavaScriptCore_heap_MachineStackMarker.cpp) = a5815dd5794d9ffbd49e5793198a06535ad89d3c
SHA1 (patch-Source_JavaScriptCore_heap_MachineStackMarker.cpp) = 35f2ba0cc3fe0d76c28a3a244621291a17a5334a
SHA1 (patch-Source_JavaScriptCore_jit_ThunkGenerators.cpp) = f0ca56e4b4060c0a8d756289d7c25d1ead6b07be
SHA1 (patch-Source_JavaScriptCore_tools_CodeProfiling.cpp) = 94c139413eecb875bba98c7749bba24cfcc16632
SHA1 (patch-Source_ThirdParty_gtest_include_gtest_internal_gtest-port.h) = 1e4b8cffbd7ec0a6130a0ec2112023bed5c0b78e

View file

@ -0,0 +1,15 @@
$NetBSD: patch-Source_JavaScriptCore_assembler_ARM64Assembler.h,v 1.1 2019/12/13 09:48:02 mrg Exp $
find a valid clear cache for netbsd/arm64.
--- Source/JavaScriptCore/assembler/ARM64Assembler.h.orig 2019-12-07 02:31:00.900806242 -0800
+++ Source/JavaScriptCore/assembler/ARM64Assembler.h 2019-12-07 02:30:09.650436008 -0800
@@ -2666,6 +2666,8 @@
{
#if OS(IOS)
sys_cache_control(kCacheFunctionPrepareForExecution, code, size);
+#elif OS(NETBSD)
+ __builtin___clear_cache(code, reinterpret_cast<char*>(code) + size);
#elif OS(LINUX)
size_t page = pageSize();
uintptr_t current = reinterpret_cast<uintptr_t>(code);

View file

@ -1,28 +1,25 @@
$NetBSD: patch-Source_JavaScriptCore_heap_MachineStackMarker.cpp,v 1.2 2018/01/17 19:37:33 markd Exp $
$NetBSD: patch-Source_JavaScriptCore_heap_MachineStackMarker.cpp,v 1.3 2019/12/13 09:48:02 mrg Exp $
Support NetBSD
Support NetBSD on x86, arm, arm64 and mips.
XXXX - currently only did CPU(X86_64) and guessed those values.
rest are currently jsut copied from FreeBSD
--- Source/JavaScriptCore/heap/MachineStackMarker.cpp.orig 2017-06-04 20:16:05.000000000 +0000
+++ Source/JavaScriptCore/heap/MachineStackMarker.cpp
@@ -665,6 +665,22 @@ void* MachineThreads::Thread::Registers:
--- Source/JavaScriptCore/heap/MachineStackMarker.cpp.orig 2019-06-26 09:25:02.000000000 -0700
+++ Source/JavaScriptCore/heap/MachineStackMarker.cpp 2019-12-12 19:40:05.519044971 -0800
@@ -665,6 +665,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_ebp);
+ 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.__gregs[_REG_FP]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_gpregs.gp_x[29]);
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_X29]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_regs[30]);
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_S8]);
+#else
+#error Unknown Architecture
+#endif
@ -30,22 +27,22 @@ XXXX - currently only did CPU(X86_64) and guessed those values.
#elif defined(__GLIBC__)
// The following sequence depends on glibc's sys/ucontext.h.
@@ -747,6 +763,22 @@ void* MachineThreads::Thread::Registers:
@@ -747,6 +763,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_eip);
+ 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.__gregs[_REG_PC]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_gpregs.gp_elr);
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_ELR]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_pc);
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_EPC]);
+#else
+#error Unknown Architecture
+#endif
@ -53,22 +50,22 @@ XXXX - currently only did CPU(X86_64) and guessed those values.
#elif defined(__GLIBC__)
// The following sequence depends on glibc's sys/ucontext.h.
@@ -838,6 +870,22 @@ void* MachineThreads::Thread::Registers:
@@ -838,6 +870,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_esi);
+ 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.__gregs[_REG_R8]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_gpregs.gp_x[4]);
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_R4]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_regs[12]);
+ return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_T4]);
+#else
+#error Unknown Architecture
+#endif