retdec
syscalls.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_BIN2LLVMIR_OPTIMIZATIONS_SYSCALLS_SYSCALLS_H
8 #define RETDEC_BIN2LLVMIR_OPTIMIZATIONS_SYSCALLS_SYSCALLS_H
9 
10 #include <llvm/IR/Module.h>
11 #include <llvm/Pass.h>
12 
18 const bool debug_enabled = false;
19 
20 namespace retdec {
21 namespace bin2llvmir {
22 
23 class AsmInstruction;
24 
25 class SyscallFixer : public llvm::ModulePass
26 {
27  public:
28  static char ID;
29  SyscallFixer();
30  virtual bool runOnModule(llvm::Module& M) override;
31  bool runOnModuleCustom(
32  llvm::Module& M,
33  Config* c,
34  FileImage* img,
35  Lti* lti,
36  Abi* abi);
37 
38  private:
39  bool run();
40  bool transform(
41  AsmInstruction ai,
42  uint64_t code,
43  const std::map<uint64_t, std::string>& codeMap);
44 
45  bool runArm();
46  bool runArm_linux_32();
48 
49  bool runArm64();
50  bool runArm64_linux_64();
52 
53  bool runMips();
54  bool runMips_linux();
56 
57  bool runX86();
58  bool runX86_linux_32();
60 
61  private:
62  llvm::Module* _module = nullptr;
63  Config* _config = nullptr;
64  FileImage* _image = nullptr;
65  Lti* _lti = nullptr;
66  Abi* _abi = nullptr;
67 };
68 
69 } // namespace bin2llvmir
70 } // namespace retdec
71 
72 #endif
ABI information.
Config DB provider for bin2llvmirl.
Debugging utilities.
Definition: abi.h:27
Definition: asm_instruction.h:34
Definition: config.h:24
Definition: fileimage.h:27
Definition: lti.h:21
Definition: syscalls.h:26
bool runArm64()
Definition: arm64.cpp:317
bool transform(AsmInstruction ai, uint64_t code, const std::map< uint64_t, std::string > &codeMap)
Definition: syscalls.cpp:85
Config * _config
Definition: syscalls.h:63
bool run()
Definition: syscalls.cpp:56
bool runArm64_linux_64()
Definition: arm64.cpp:327
SyscallFixer()
Definition: syscalls.cpp:25
llvm::Module * _module
Definition: syscalls.h:62
virtual bool runOnModule(llvm::Module &M) override
Definition: syscalls.cpp:31
FileImage * _image
Definition: syscalls.h:64
bool runArm_linux_32()
Definition: arm.cpp:413
Abi * _abi
Definition: syscalls.h:66
bool runOnModuleCustom(llvm::Module &M, Config *c, FileImage *img, Lti *lti, Abi *abi)
Definition: syscalls.cpp:41
bool runX86()
Definition: x86.cpp:432
bool runMips_linux()
Definition: mips.cpp:252
bool runMips()
Definition: mips.cpp:242
bool runX86_linux_32()
Definition: x86.cpp:442
Lti * _lti
Definition: syscalls.h:65
bool runArm()
Definition: arm.cpp:403
static char ID
Definition: syscalls.h:28
File image provider for bin2llvmirl.
Library type information provider for bin2llvmirl.
The frontend-end part of the decompiler.
Definition: archive_wrapper.h:19
const bool debug_enabled
Definition: syscalls.h:18