1 //===- AArch64CA53ErratumStub.h -------------------------------------------===//
2 //
3 //                     The MCLinker Project
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef TARGET_AARCH64_AARCH64CA53ERRATUMSTUB_H_
10 #define TARGET_AARCH64_AARCH64CA53ERRATUMSTUB_H_
11 
12 #include "mcld/Fragment/Stub.h"
13 #include "mcld/Support/Compiler.h"
14 #include <llvm/Support/DataTypes.h>
15 #include <string>
16 #include <vector>
17 
18 namespace mcld {
19 
20 class BranchIsland;
21 class FragmentRef;
22 class IRBuilder;
23 
24 class AArch64CA53ErratumStub : public Stub {
25  public:
26   AArch64CA53ErratumStub();
27 
28   AArch64CA53ErratumStub(const uint32_t* pData,
29                          size_t pSize,
30                          const char* pName,
31                          const_fixup_iterator pBegin,
32                          const_fixup_iterator pEnd);
33 
34   ~AArch64CA53ErratumStub();
35 
36   bool isMyDuty(const FragmentRef& pFragRef) const;
37 
38   void applyFixup(FragmentRef& pSrcFragRef,
39                   IRBuilder& pBuilder,
40                   BranchIsland& pIsland);
41 
42   const std::string& name() const;
43 
44   const uint32_t* getData() const;
45 
46   const uint8_t* getContent() const;
47 
48   size_t size() const;
49 
50   size_t alignment() const;
51 
52  public:
53   virtual unsigned getErratumSequenceSize() const = 0;
54 
55   virtual unsigned getErratumInsnOffset() const = 0;
56 
57  private:
58   static const uint32_t TEMPLATE[];
59 
60  private:
61   const uint32_t* m_pData;
62   std::string m_Name;
63   size_t m_Size;
64 
65  private:
66   DISALLOW_COPY_AND_ASSIGN(AArch64CA53ErratumStub);
67 };
68 
69 }  // namespace mcld
70 
71 #endif  // TARGET_AARCH64_AARCH64CA53ERRATUMSTUB_H_
72