Alexey Frunze | e3fb245 | 2016-05-10 16:08:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_LINKER_MIPS_RELATIVE_PATCHER_MIPS_H_ |
| 18 | #define ART_COMPILER_LINKER_MIPS_RELATIVE_PATCHER_MIPS_H_ |
| 19 | |
Alexey Frunze | e3fb245 | 2016-05-10 16:08:05 -0700 | [diff] [blame] | 20 | #include "arch/mips/instruction_set_features_mips.h" |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 21 | #include "linker/relative_patcher.h" |
Alexey Frunze | e3fb245 | 2016-05-10 16:08:05 -0700 | [diff] [blame] | 22 | |
| 23 | namespace art { |
| 24 | namespace linker { |
| 25 | |
| 26 | class MipsRelativePatcher FINAL : public RelativePatcher { |
| 27 | public: |
| 28 | explicit MipsRelativePatcher(const MipsInstructionSetFeatures* features) |
| 29 | : is_r6(features->IsR6()) {} |
| 30 | |
| 31 | uint32_t ReserveSpace(uint32_t offset, |
| 32 | const CompiledMethod* compiled_method, |
| 33 | MethodReference method_ref) OVERRIDE; |
| 34 | uint32_t ReserveSpaceEnd(uint32_t offset) OVERRIDE; |
| 35 | uint32_t WriteThunks(OutputStream* out, uint32_t offset) OVERRIDE; |
| 36 | void PatchCall(std::vector<uint8_t>* code, |
| 37 | uint32_t literal_offset, |
| 38 | uint32_t patch_offset, |
| 39 | uint32_t target_offset) OVERRIDE; |
| 40 | void PatchPcRelativeReference(std::vector<uint8_t>* code, |
| 41 | const LinkerPatch& patch, |
| 42 | uint32_t patch_offset, |
| 43 | uint32_t target_offset) OVERRIDE; |
Vladimir Marko | f4f2daa | 2017-03-20 18:26:59 +0000 | [diff] [blame] | 44 | void PatchBakerReadBarrierBranch(std::vector<uint8_t>* code, |
| 45 | const LinkerPatch& patch, |
| 46 | uint32_t patch_offset) OVERRIDE; |
Alexey Frunze | e3fb245 | 2016-05-10 16:08:05 -0700 | [diff] [blame] | 47 | |
| 48 | private: |
Alexey Frunze | e3fb245 | 2016-05-10 16:08:05 -0700 | [diff] [blame] | 49 | bool is_r6; |
| 50 | |
| 51 | DISALLOW_COPY_AND_ASSIGN(MipsRelativePatcher); |
| 52 | }; |
| 53 | |
| 54 | } // namespace linker |
| 55 | } // namespace art |
| 56 | |
| 57 | #endif // ART_COMPILER_LINKER_MIPS_RELATIVE_PATCHER_MIPS_H_ |