Index: src/trap-handler/trap-handler-internal.h |
diff --git a/src/trap-handler/trap-handler-internal.h b/src/trap-handler/trap-handler-internal.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..702c741eb8ebcbdeaacdcd893a99d180ac2cf052 |
--- /dev/null |
+++ b/src/trap-handler/trap-handler-internal.h |
@@ -0,0 +1,64 @@ |
+// Copyright 2016 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef TRAP_HANDLER_INTERNAL_H_ |
+#define TRAP_HANDLER_INTERNAL_H_ |
+ |
+// This file should not be included (even transitively) by files outside of |
+// src/trap-handler. |
+ |
+#include "src/trap-handler/trap-handler.h" |
+ |
+#include <atomic> |
+ |
+#if V8_OS_WIN |
+#define THREAD_LOCAL __declspec(thread) |
+#elif V8_OS_ANDROID |
+// TODO(eholk): fix this before enabling for trap handlers for Android. |
+#define THREAD_LOCAL |
+#else |
+#define THREAD_LOCAL __thread |
+#endif |
+ |
+namespace v8 { |
+namespace internal { |
+namespace trap_handler { |
+ |
+// This describes a chunk of code that the signal handler will be able to |
+// handler faults in. base points to the beginning of the chunk, and size is the |
ahaas
2017/02/20 09:27:24
handle
{base} points to ...
{size} is the ...
Eric Holk
2017/02/23 02:16:57
Done.
|
+// number of bytes in the code chunk. The remainder of the struct is a list of |
+// protected memory access instructions and an offset to a landing pad to handle |
+// faults on that instruction. |
+struct CodeProtectionInfo { |
+ void* base; |
+ size_t size; |
+ size_t num_protected_instructions; |
+ ProtectedInstructionData instructions[1]; |
+}; |
+ |
+class MetadataLock { |
+ static std::atomic_flag spinlock_; |
+ |
+ public: |
+ MetadataLock(); |
+ ~MetadataLock(); |
+ |
+ MetadataLock(const MetadataLock&) = delete; |
Mark Seaborn
2017/02/17 21:41:12
You could put the same comment about base/macros.h
Eric Holk
2017/02/23 02:16:57
Done.
|
+ void operator=(const MetadataLock&) = delete; |
+}; |
+ |
+#if V8_TRAP_HANDLER_SUPPORTED |
+void HandleSignal(int signum, siginfo_t* info, void* context); |
+#endif |
+ |
+extern THREAD_LOCAL bool g_thread_in_wasm_code; |
+ |
+extern size_t gNumCodeObjects; |
+extern CodeProtectionInfo** gCodeObjects; |
+ |
+} // namespace trap_handler |
+} // namespace internal |
+} // namespace v8 |
+ |
+#endif // TRAP_HANDLER_INTERNAL_H_ |