> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.6.19 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar 1 12:35:11 UTC 2024 x86_64 GNU/Linux 15:44:31 up 2:50, 2 users, load average: 0.69, 0.45, 0.34
This commit is contained in:
parent
b350c43d42
commit
d4439a279b
1 changed files with 10 additions and 5 deletions
|
@ -68,11 +68,6 @@ void init_elf(const char *path) {
|
|||
}
|
||||
}
|
||||
qsort(func_table, func_table_len, sizeof(func_t), cmp_func_t);
|
||||
for(int i = 0; i < func_table_len; i++) {
|
||||
func_t *f = &func_table[i];
|
||||
// puts(func);
|
||||
printf("%s: 0x%x - 0x%x\n", f->name, f->start, f->start + f->len);
|
||||
}
|
||||
success = true;
|
||||
failed:
|
||||
for(int i = 0; i < func_table_len; i++) {
|
||||
|
@ -87,3 +82,13 @@ failed_nosym:
|
|||
if(success) return;
|
||||
else Error("Failed reading elf file");
|
||||
}
|
||||
|
||||
func_t *get_func(vaddr_t addr) {
|
||||
int l = 0, r = func_table_len - 1;
|
||||
while(l < r) {
|
||||
int mid = l + (r - l) / 2;
|
||||
if(func_table[mid].start < addr) l = mid + 1;
|
||||
else r = mid;
|
||||
}
|
||||
return &func_table[l];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue