Sitelet https://github.com/bfcz1/SKRoot-linuxKernelRoot/commit/f3aa4b77864363caafc473a34a9c04292c6a16b9
Skip to content

Commit f3aa4b7

Browse files
unkn0wNameunkn0wName
authored andcommitted
feat: function entry strong
1 parent 90f0bc8 commit f3aa4b7

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎find_kernel_func/3rdparty/find_xrefs.h‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ bool check_code_block_is_func_head(const std::vector<code_line>& v_code_block) {
3131
return stp_cnt >= 3 ? true : false;
3232
}
3333

34+
uint64_t get_code_block_func_entry_addr(const std::vector<code_line>& v_code_block) {
35+
if (v_code_block.size() == 0) {
36+
return 0;
37+
}
38+
for (size_t x = 0; x < v_code_block.size(); x++) {
39+
if (v_code_block[x].mnemonic == "hint" && v_code_block[x].op_str == "#0x19") {
40+
return v_code_block[x].addr;
41+
} else if (v_code_block[x].mnemonic == "sub" && v_code_block[x].op_str.find("sp, sp, #") != -1) {
42+
return v_code_block[x].addr;
43+
}
44+
}
45+
return v_code_block[0].addr;
46+
}
47+
3448
void parse_code_block_adrp(uint64_t last_function_start_addr,
3549
const std::vector<code_line>& v_code_block,
3650
std::map<std::tuple<std::string, size_t>, std::shared_ptr<std::vector<xrefs_info>>>& result_map) {
@@ -80,7 +94,7 @@ void parse_code_block_with_xrefs(const std::string& group_name,
8094
return;
8195
}
8296
if (check_code_block_is_func_head(v_code_block)) {
83-
last_function_start_addr = v_code_block[0].addr;
97+
last_function_start_addr = get_code_block_func_entry_addr(v_code_block);
8498
}
8599
parse_code_block_adrp(last_function_start_addr, v_code_block, result_map);
86100
}
@@ -93,7 +107,7 @@ void parse_code_block_with_func_haed(const std::string& group_name,
93107
return;
94108
}
95109
if (check_code_block_is_func_head(v_code_block)) {
96-
last_function_start_addr = v_code_block[0].addr;
110+
last_function_start_addr = get_code_block_func_entry_addr(v_code_block);
97111
}
98112

99113
for (auto iter = result_map.begin(); iter != result_map.end(); iter++) {
Binary file not shown.
512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)