diff --git a/xzre.h b/xzre.h index 43a0910..27c5fc8 100644 --- a/xzre.h +++ b/xzre.h @@ -188,7 +188,7 @@ typedef union { struct { /** bit index in the current byte indicated by @ref byte_index */ u32 bit_index : 3; - /** byte index into the secret data array*/ + /** byte index into the secret data array */ u32 byte_index : 29; }; /** the initial value */ @@ -258,6 +258,27 @@ extern BOOL find_reg2reg_instruction(u8 *code_start, u8 *code_end, dasm_ctx_t *d */ extern BOOL find_function_prologue(u8 *code_start, u8 *code_end, u8 **output, FuncFindType find_mode); +/** + * @brief locates the function prologue. + * it will try to backtrack and synchronize the code stream, calling @ref find_function_prologue + * for each iteration + * + * @param code_start address to start searching from + * @param func_start_0 if provided, will be filled with the address of the first candidate match, obtained by starting the search at @p code_start + 0 + * @param func_start_1 if provided, will be filled with the address of the second candidate match, obtained by starting the search at @p code_start + 1 + * @param search_base lowest address, where backtracking is stopped + * @param code_end address to stop searching at + * @param find_mode + * @return BOOL + */ +extern BOOL find_function_prologue_ex( + u8 *code_start, + u8 *func_start_0, + u8 *func_start_1, + u8 *search_base, + u8 *code_end, + FuncFindType find_mode); + /** * @brief checks if given ELF file contains an elf segment with the given parameters * diff --git a/xzre.lds b/xzre.lds index e6333d8..5480b5c 100644 --- a/xzre.lds +++ b/xzre.lds @@ -8,6 +8,8 @@ SECTIONS { *(.text.lzma_raw_encodea); "find_function_prologue" = "."; *(.text.lzma_raw_coder_memusaga); + "find_function_prologue_ex" = "."; + *(.text.lzma2_encoder_inia); "get_lzma_allocator" = "."; *(.text.stream_decoder_memconfia); "check_call_site" = ".";