1 // Copyright 2020 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_EXECUTION_POINTER_AUTHENTICATION_DUMMY_H_
6 #define V8_EXECUTION_POINTER_AUTHENTICATION_DUMMY_H_
7 
8 #include "include/v8-internal.h"
9 #include "src/base/macros.h"
10 #include "src/execution/pointer-authentication.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 // Dummy implementation of the PointerAuthentication class methods, to be used
16 // when CFI is not enabled.
17 
18 // Load return address from {pc_address} and return it.
AuthenticatePC( Address* pc_address, unsigned offset_from_sp)19 V8_INLINE Address PointerAuthentication::AuthenticatePC(
20     Address* pc_address, unsigned offset_from_sp) {
21   USE(offset_from_sp);
22   return *pc_address;
23 }
24 
25 // Return {pc} unmodified.
StripPAC(Address pc)26 V8_INLINE Address PointerAuthentication::StripPAC(Address pc) { return pc; }
27 
28 // Store {new_pc} to {pc_address} without signing.
ReplacePC(Address* pc_address, Address new_pc, int offset_from_sp)29 V8_INLINE void PointerAuthentication::ReplacePC(Address* pc_address,
30                                                 Address new_pc,
31                                                 int offset_from_sp) {
32   USE(offset_from_sp);
33   *pc_address = new_pc;
34 }
35 
36 // Return {pc} unmodified.
SignAndCheckPC(Address pc, Address sp)37 V8_INLINE Address PointerAuthentication::SignAndCheckPC(Address pc,
38                                                         Address sp) {
39   USE(sp);
40   return pc;
41 }
42 
43 }  // namespace internal
44 }  // namespace v8
45 
46 #endif  // V8_EXECUTION_POINTER_AUTHENTICATION_DUMMY_H_
47