diff --git a/xzre_code/CMakeLists.txt b/xzre_code/CMakeLists.txt index 561efad..09cbb24 100644 --- a/xzre_code/CMakeLists.txt +++ b/xzre_code/CMakeLists.txt @@ -7,6 +7,7 @@ add_library(xzre_code elf_symbol_get_addr.c get_lzma_allocator.c is_endbr64_instruction.c + init_elf_entry_ctx.c fake_lzma_alloc.c fake_lzma_free.c find_function.c diff --git a/xzre_code/init_elf_entry_ctx.c b/xzre_code/init_elf_entry_ctx.c new file mode 100644 index 0000000..98cdb7f --- /dev/null +++ b/xzre_code/init_elf_entry_ctx.c @@ -0,0 +1,12 @@ +/** + * Copyright (C) 2024 Stefano Moioli + **/ +#include "xzre.h" + +void init_elf_entry_ctx(elf_entry_ctx_t *ctx){ + ctx->symbol_ptr = (void *)&cpuid_random_symbol; + ctx->got_ctx.return_address = (void *)ctx->frame_address[3]; + get_got_offset(ctx); + get_cpuid_got_index(ctx); + ctx->got_ctx.got_ptr = NULL; +}