diff options
author | Samuel Huang <huangs@chromium.org> | 2021-07-22 16:26:47 +0000 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2021-07-25 21:38:38 -0700 |
commit | 769128e925d4591347c4f28ccb1e3e552af5f13b (patch) | |
tree | 4fde049cef07dd51f2adf3b8eb27661070967204 /arm_utils.h | |
parent | f48f9be9148176b288655f809d5bb64589d042df (diff) | |
download | zucchini-769128e925d4591347c4f28ccb1e3e552af5f13b.tar.gz |
[Zucchini] Cleanup before adding ARM support for ELF files.
This CL performs some code cleanup to prepare for main CL that adds
ARM support for ELF files (https://crrev.com/c/2922822):
* Rename ARM32 / Arm32 to AArch32.
* Replace DISALLOW_COPY_AND_ASSIGN for affected files.
Bug: 918867
Change-Id: I0e96b66fb29e9d1a35f9d7fac65755fbeda4831f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3044420
Commit-Queue: Samuel Huang <huangs@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#904357}
NOKEYCHECK=True
GitOrigin-RevId: 33679d241940ef6221b68d3e5daef606d7dd767d
Diffstat (limited to 'arm_utils.h')
-rw-r--r-- | arm_utils.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/arm_utils.h b/arm_utils.h index 6d8e784..63c7538 100644 --- a/arm_utils.h +++ b/arm_utils.h @@ -9,14 +9,13 @@ #include <stdint.h> #include "base/check_op.h" -#include "base/macros.h" #include "components/zucchini/address_translator.h" #include "components/zucchini/buffer_view.h" namespace zucchini { // References: -// * ARM32 (32-bit ARM, AKA AArch32): +// * AArch32 (32-bit ARM, AKA ARM32): // https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf // * AArch64 (64-bit ARM): // https://static.docs.arm.com/ddi0487/da/DDI0487D_a_armv8_arm.pdf @@ -130,7 +129,7 @@ inline int GetThumb2InstructionSize(uint16_t code16) { // A translator for ARM mode and THUMB2 mode with static functions that // translate among |code|, |disp|, and |target_rva|. -class Arm32Rel32Translator { +class AArch32Rel32Translator { public: // Rel32 address types enumeration. enum AddrType : uint8_t { @@ -150,7 +149,10 @@ class Arm32Rel32Translator { NUM_ADDR_TYPE }; - Arm32Rel32Translator(); + AArch32Rel32Translator(); + AArch32Rel32Translator(const AArch32Rel32Translator&) = delete; + const AArch32Rel32Translator& operator=(const AArch32Rel32Translator&) = + delete; // Fetches the 32-bit ARM instruction |code| at |view[idx]|. static inline uint32_t FetchArmCode32(ConstBufferView view, offset_t idx) { @@ -324,9 +326,6 @@ class Arm32Rel32Translator { EncodeT24, ReadT24, WriteT24>; - - private: - DISALLOW_COPY_AND_ASSIGN(Arm32Rel32Translator); }; // Translator for AArch64, which is simpler than 32-bit ARM. Although pointers @@ -345,6 +344,9 @@ class AArch64Rel32Translator { // Although RVA for 64-bit architecture can be 64-bit in length, we make the // bold assumption that for ELF images that RVA will stay nicely in 32-bit! AArch64Rel32Translator(); + AArch64Rel32Translator(const AArch64Rel32Translator&) = delete; + const AArch64Rel32Translator& operator=(const AArch64Rel32Translator&) = + delete; static inline uint32_t FetchCode32(ConstBufferView view, offset_t idx) { return view.read<uint32_t>(idx); @@ -357,7 +359,7 @@ class AArch64Rel32Translator { } // Conversion functions for |code32| from/to |disp| or |target_rva|, similar - // to the counterparts in Arm32Rel32Translator. + // to the counterparts in AArch32Rel32Translator. static ArmAlign DecodeImmd14(uint32_t code32, arm_disp_t* disp); static bool EncodeImmd14(arm_disp_t disp, uint32_t* code32); static bool ReadImmd14(rva_t instr_rva, uint32_t code32, rva_t* target_rva); @@ -410,9 +412,6 @@ class AArch64Rel32Translator { EncodeImmd26, ReadImmd26, WriteImmd26>; - - private: - DISALLOW_COPY_AND_ASSIGN(AArch64Rel32Translator); }; } // namespace zucchini |