about summary refs log tree commit diff
path: root/patches/e9patch-devendor.patch
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-11-19 11:02:16 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-11-19 11:02:16 +0900
commit1725ce5a7daf99a75508f15650a01321dd5a8ecc (patch)
tree77373eb85fd08c0236edf9d9a6b648eb28cbec00 /patches/e9patch-devendor.patch
downloadloftix-1725ce5a7daf99a75508f15650a01321dd5a8ecc.tar.gz
Define some packages
Diffstat (limited to 'patches/e9patch-devendor.patch')
-rw-r--r--patches/e9patch-devendor.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/patches/e9patch-devendor.patch b/patches/e9patch-devendor.patch
new file mode 100644
index 0000000..e9ee292
--- /dev/null
+++ b/patches/e9patch-devendor.patch
@@ -0,0 +1,52 @@
+diff --git a/Makefile b/Makefile
+index 1218c65d1818..0ebdf24ea259 100644
+--- a/Makefile
++++ b/Makefile
+@@ -37,10 +37,7 @@ E9TOOL_OBJS=\
+ E9TOOL_LIBS=\
+     contrib/zydis/libZydis.a \
+     contrib/libdw/libdw.a
+-E9TOOL_CXXFLAGS=\
+-    -I src/e9tool/ -Wno-unused-function \
+-    -I contrib/zydis/include/ \
+-    -I contrib/zydis/dependencies/zycore/include/
++E9TOOL_CXXFLAGS= -I src/e9tool/ -Wno-unused-function
+ E9TOOL_LDFLAGS=\
+     -Wl,--dynamic-list=src/e9tool/e9tool.syms \
+     -ldl -lz
+@@ -52,9 +49,9 @@ E9TOOL_LDFLAGS=\
+ all: e9tool e9patch
+ 
+ e9tool: CXXFLAGS += -O2 -DSYSTEM_LIBDW $(E9TOOL_CXXFLAGS)
+-e9tool: contrib/zydis/libZydis.a $(E9TOOL_OBJS)
+-	$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) contrib/zydis/libZydis.a -o e9tool \
+-	    $(E9TOOL_LDFLAGS) -ldw
++e9tool: $(E9TOOL_OBJS)
++	$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) -o e9tool \
++	    $(E9TOOL_LDFLAGS) -ldw -lZydis
+ 	strip e9tool
+ 
+ e9patch: CXXFLAGS += -O2 
+diff --git a/src/e9tool/e9x86_64.cpp b/src/e9tool/e9x86_64.cpp
+index 6a7f5cff3692..03eb3a41dd66 100644
+--- a/src/e9tool/e9x86_64.cpp
++++ b/src/e9tool/e9x86_64.cpp
+@@ -152,8 +152,7 @@ void e9tool::getInstrInfo(const ELF *elf, const Instr *I, InstrInfo *info,
+     ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
+ 
+     ZyanStatus result = ZydisDecoderDecodeFull(&decoder,
+-        elf->data + I->offset, I->size, D, operands, ZYDIS_MAX_OPERAND_COUNT,
+-        0);
++        elf->data + I->offset, I->size, D, operands);
+     if (!ZYAN_SUCCESS(result) || I->size != D->length ||
+             D->operand_count > sizeof(info->op) / sizeof(info->op[0]))
+         error("failed to decompress instruction at address 0x%lx; decode "
+@@ -336,7 +335,7 @@ void e9tool::getInstrInfo(const ELF *elf, const Instr *I, InstrInfo *info,
+         info->string.section    = elf->strs + shdr->sh_name;
+         result = ZydisFormatterFormatInstruction(&formatter, D, operands,
+             D->operand_count_visible, info->string.instr,
+-            sizeof(info->string.instr)-1, I->address);
++            sizeof(info->string.instr)-1, I->address, ZYAN_NULL);
+         if (!ZYAN_SUCCESS(result))
+             error("failed to decompress instruction at address 0x%lx; "
+                 "formatting failed", I->address);