|
This CL adds new files for ARM support. The code is not yet integrated
into Zucchini, but are only used by the added tests. The high-level
goal is to support rel32 reference read / write via:
(data bytes) <-> |code| <-> |disp| <-> |target_rva|,
where |code| is ARM machine code value (read-write), and |disp| is a
PC-relative displacement. Details:
* Add template class ArmAddrTraits as API to process rel32 references.
It is specialized for each rel32 address type, and aggregates
selected low-level static functions from an ARM *Translator class.
* Add class Arm32Rel32Translator for 32-bit ARM (ARM32)
* ArmAddrTraits is specialized to {A24} encoding for ARM mode, and
{T8, T11, T21, T24} encodings for THUMB2 mode.
* Complication: |code| can affect |disp| <-> |target_rva|, since the
the BLX instruction dictates whether |target_rva| should be 2-byte
or 4-byte aligned!
* The BLX special case makes |disp| <-> |target_rva| unsuitable for
ArmAddrTraits. This led to the API to be defined as:
* Fetch() for (data bytes) -> |code|.
* Store() for |code| -> (data bytes).
* Decode() for |code| -> |disp| & alignment spec (ArmAlign).
* Encode() for |disp| -> |code|: Modifies existing |code|.
* Read() for |code| -> |target_rva|: Needs |instr_rva|.
* Write() for |target_rva| -> |code|.
* Needs |instr_rva|; modifies existing |code|.
* Add class AArch64Rel32Translator for 64-bit ARM (AArch64).
* ArmAddrTraits is specialized to {Immd14, Immd19, Immd26} encodings.
Bug: 918867
Change-Id: Ie20935e391ed0ac85c408aa9c8959305dc8bba42
Reviewed-on: https://chromium-review.googlesource.com/c/1394397
Reviewed-by: Samuel Huang <huangs@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622115}
NOKEYCHECK=True
GitOrigin-RevId: 398b188eab96c3b198b6a4eb8788bba77202aef8
|