Adding support for kernel disasm using IGA

Change-Id: Ic75540c9b42913f5d12d66438cc4e6dcc39ceb98
This commit is contained in:
Chodor, Jaroslaw
2019-06-26 21:19:34 +02:00
committed by sys_ocldev
parent 79e78e18c4
commit 2f42f332d8
21 changed files with 741 additions and 56 deletions

View File

@@ -9,6 +9,7 @@
#include "elf/types.h"
#include "helper.h"
#include "iga_wrapper.h"
#include <memory>
#include <string>
@@ -21,7 +22,7 @@ struct PTField {
};
struct BinaryHeader {
std::vector<PTField> fields; // (size, name)
std::vector<PTField> fields;
uint32_t size;
};
struct PatchToken : BinaryHeader {
@@ -32,7 +33,9 @@ using PTMap = std::unordered_map<uint8_t, std::unique_ptr<PatchToken>>;
class BinaryDecoder {
public:
BinaryDecoder() = default;
BinaryDecoder() : iga(new IgaWrapper) {
iga->setMessagePrinter(messagePrinter);
}
BinaryDecoder(const std::string &file, const std::string &patch, const std::string &dump)
: binaryFile(file), pathToPatch(patch), pathToDump(dump){};
int decode();
@@ -43,6 +46,7 @@ class BinaryDecoder {
protected:
BinaryHeader programHeader, kernelHeader;
CLElfLib::ElfBinaryStorage binary;
std::unique_ptr<IgaWrapper> iga;
PTMap patchTokens;
std::string binaryFile, pathToPatch, pathToDump;
MessagePrinter messagePrinter;