> 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:48:50  up   2:54,  2 users,  load average: 0.49, 0.64, 0.46
This commit is contained in:
tracer-ysyx 2024-03-20 15:48:50 +08:00 committed by xinyangli
parent c6cc74192c
commit d6b293da6f

View file

@ -13,14 +13,14 @@ int func_table_len = 0, func_table_size = 8;
#endif #endif
static int cmp_func_t(const void *a, const void *b) { static int cmp_func_t(const void *a, const void *b) {
return ((func_t *)a)->start >= ((func_t *)b)->start; return ((func_t *)a)->start > ((func_t *)b)->start;
} }
func_t *get_func(vaddr_t addr) { func_t *get_func(vaddr_t addr) {
int l = 0, r = func_table_len - 1; int l = 0, r = func_table_len - 1;
while(l < r) { while(l < r) {
int mid = l + (r - l) / 2; int mid = l + (r - l) / 2;
if(func_table[mid].start < addr) l = mid + 1; if(func_table[mid].start <= addr) l = mid + 1;
else r = mid; else r = mid;
} }
return &func_table[l]; return &func_table[l];