11cb0ef41Sopenharmony_ci// Copyright 2018 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_WASM_TRAP_HANDLER_POSIX_H_ 61cb0ef41Sopenharmony_ci#define V8_WASM_TRAP_HANDLER_POSIX_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include <signal.h> 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci#include "v8config.h" // NOLINT(build/include_directory) 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cinamespace v8 { 131cb0ef41Sopenharmony_ci/** 141cb0ef41Sopenharmony_ci * This function determines whether a memory access violation has been an 151cb0ef41Sopenharmony_ci * out-of-bounds memory access in WebAssembly. If so, it will modify the context 161cb0ef41Sopenharmony_ci * parameter and add a return address where the execution can continue after the 171cb0ef41Sopenharmony_ci * signal handling, and return true. Otherwise, false will be returned. 181cb0ef41Sopenharmony_ci * 191cb0ef41Sopenharmony_ci * The parameters to this function correspond to those passed to a Posix signal 201cb0ef41Sopenharmony_ci * handler. Use this function only on Linux and Mac. 211cb0ef41Sopenharmony_ci * 221cb0ef41Sopenharmony_ci * \param sig_code The signal code, e.g. SIGSEGV. 231cb0ef41Sopenharmony_ci * \param info A pointer to the siginfo_t struct provided to the signal handler. 241cb0ef41Sopenharmony_ci * \param context A pointer to a ucontext_t struct provided to the signal 251cb0ef41Sopenharmony_ci * handler. 261cb0ef41Sopenharmony_ci */ 271cb0ef41Sopenharmony_ciV8_EXPORT bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info, 281cb0ef41Sopenharmony_ci void* context); 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci} // namespace v8 311cb0ef41Sopenharmony_ci#endif // V8_WASM_TRAP_HANDLER_POSIX_H_ 32