Title: [295381] trunk/Source
- Revision
- 295381
- Author
- commit-qu...@webkit.org
- Date
- 2022-06-08 08:50:17 -0700 (Wed, 08 Jun 2022)
Log Message
Add NetBSD support for MachineContext
https://bugs.webkit.org/show_bug.cgi?id=241125
Patch by Leonardo Taccari <l...@netbsd.org> on 2022-06-08
Reviewed by Yusuke Suzuki.
* Source/_javascript_Core/runtime/MachineContext.h:
(JSC::MachineContext::stackPointerImpl):
(JSC::MachineContext::framePointerImpl):
(JSC::MachineContext::instructionPointerImpl):
(JSC::MachineContext::argumentPointer<1>):
(JSC::MachineContext::llintInstructionPointer):
* Source/WTF/wtf/PlatformHave.h:
Canonical link: https://commits.webkit.org/251389@main
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/runtime/MachineContext.h (295380 => 295381)
--- trunk/Source/_javascript_Core/runtime/MachineContext.h 2022-06-08 15:19:43 UTC (rev 295380)
+++ trunk/Source/_javascript_Core/runtime/MachineContext.h 2022-06-08 15:50:17 UTC (rev 295381)
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2017 Yusuke Suzuki <utatane....@gmail.com>.
* Copyright (C) 2018-2022 Apple Inc. All rights reserved.
+ * Copyright (C) 2022 Leonardo Taccari <l...@netbsd.org>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -176,6 +177,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_UESP]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_RSP]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_SP]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_SP]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_SP]);
+#else
+#error Unknown Architecture
+#endif
+
#elif OS(FUCHSIA) || OS(LINUX)
#if CPU(X86)
@@ -305,6 +322,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_EBP]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_RBP]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_FP]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_FP]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_S8]);
+#else
+#error Unknown Architecture
+#endif
+
#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
@@ -447,6 +480,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_EIP]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_RIP]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_PC]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_PC]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_EPC]);
+#else
+#error Unknown Architecture
+#endif
+
#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
@@ -587,6 +636,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_EDX]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_RSI]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_R1]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_X1]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_A1]);
+#else
+#error Unknown Architecture
+#endif
+
#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
@@ -706,6 +771,22 @@
#error Unknown Architecture
#endif
+#elif OS(NETBSD)
+
+#if CPU(X86)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_ESI]);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_R8]);
+#elif CPU(ARM)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_R8]);
+#elif CPU(ARM64)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_X4]);
+#elif CPU(MIPS)
+ return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[_REG_T4]);
+#else
+#error Unknown Architecture
+#endif
+
#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
Modified: trunk/Source/WTF/wtf/PlatformHave.h (295380 => 295381)
--- trunk/Source/WTF/wtf/PlatformHave.h 2022-06-08 15:19:43 UTC (rev 295380)
+++ trunk/Source/WTF/wtf/PlatformHave.h 2022-06-08 15:50:17 UTC (rev 295381)
@@ -229,7 +229,7 @@
#define HAVE_HOSTED_CORE_ANIMATION 1
#endif
-#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)))
+#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(NETBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)))
#define HAVE_MACHINE_CONTEXT 1
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes