11cb0ef41Sopenharmony_ci// Copyright 2020 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_EXECUTION_POINTER_AUTHENTICATION_DUMMY_H_
61cb0ef41Sopenharmony_ci#define V8_EXECUTION_POINTER_AUTHENTICATION_DUMMY_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "include/v8-internal.h"
91cb0ef41Sopenharmony_ci#include "src/base/macros.h"
101cb0ef41Sopenharmony_ci#include "src/execution/pointer-authentication.h"
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cinamespace v8 {
131cb0ef41Sopenharmony_cinamespace internal {
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci// Dummy implementation of the PointerAuthentication class methods, to be used
161cb0ef41Sopenharmony_ci// when CFI is not enabled.
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci// Load return address from {pc_address} and return it.
191cb0ef41Sopenharmony_ciV8_INLINE Address PointerAuthentication::AuthenticatePC(
201cb0ef41Sopenharmony_ci    Address* pc_address, unsigned offset_from_sp) {
211cb0ef41Sopenharmony_ci  USE(offset_from_sp);
221cb0ef41Sopenharmony_ci  return *pc_address;
231cb0ef41Sopenharmony_ci}
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci// Return {pc} unmodified.
261cb0ef41Sopenharmony_ciV8_INLINE Address PointerAuthentication::StripPAC(Address pc) { return pc; }
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci// Store {new_pc} to {pc_address} without signing.
291cb0ef41Sopenharmony_ciV8_INLINE void PointerAuthentication::ReplacePC(Address* pc_address,
301cb0ef41Sopenharmony_ci                                                Address new_pc,
311cb0ef41Sopenharmony_ci                                                int offset_from_sp) {
321cb0ef41Sopenharmony_ci  USE(offset_from_sp);
331cb0ef41Sopenharmony_ci  *pc_address = new_pc;
341cb0ef41Sopenharmony_ci}
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci// Return {pc} unmodified.
371cb0ef41Sopenharmony_ciV8_INLINE Address PointerAuthentication::SignAndCheckPC(Address pc,
381cb0ef41Sopenharmony_ci                                                        Address sp) {
391cb0ef41Sopenharmony_ci  USE(sp);
401cb0ef41Sopenharmony_ci  return pc;
411cb0ef41Sopenharmony_ci}
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci}  // namespace internal
441cb0ef41Sopenharmony_ci}  // namespace v8
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci#endif  // V8_EXECUTION_POINTER_AUTHENTICATION_DUMMY_H_
47