diff --git a/kernel/inc/utils/symbol.h b/kernel/inc/utils/symbol.h index 0ba0bc4..21b3ac5 100644 --- a/kernel/inc/utils/symbol.h +++ b/kernel/inc/utils/symbol.h @@ -38,6 +38,7 @@ typedef struct { uint64_t address; } symbol_T; -symbol_T* symbol_resolve_function_from_rip(symbol_T* symbols, uint64_t num_symbols, uint64_t rip); +symbol_T* symbol_resolve_from_name (symbol_T* symbols, uint64_t num_symbols, string_t name); +symbol_T* symbol_resolve_function_from_rip (symbol_T* symbols, uint64_t num_symbols, uint64_t rip); #endif //NOX_SYMBOLS_H diff --git a/kernel/src/utils/symbol.c b/kernel/src/utils/symbol.c index 7ac0d55..63fc4cd 100644 --- a/kernel/src/utils/symbol.c +++ b/kernel/src/utils/symbol.c @@ -23,6 +23,16 @@ #include "utils/symbol.h" +symbol_T* symbol_resolve_from_name(symbol_T* symbols, uint64_t num_symbols, string_t name) { + for (uint64_t i = 0; i < num_symbols; i++) { + if (string_compare(name, symbols[i].name)) { + return &symbols[i]; + } + } + + return NULL; +} + symbol_T* symbol_resolve_function_from_rip(symbol_T* symbols, uint64_t num_symbols, uint64_t rip) { symbol_T* symbol = NULL;