Max OS 0.3
Loading...
Searching...
No Matches
symbols.cpp
Go to the documentation of this file.
1
9#include <common/symbols.h>
10
11
12namespace MaxOS::common {
13
24
25 // No symbols
27 return nullptr;
28
29 // Convert load to linked
30 uintptr_t offset = 0;
31 if(load_base >= link_base)
32 offset = load_base - link_base;
33
34 // Get the adjusted address
36 if(rip >= offset)
37 adjusted_address = rip - offset;
38
39 // Binary Search for symbol
40 size_t left = 0;
42 while(left < right) {
43 size_t middle = (left + right) >> 1;
45 left = middle + 1;
46 else
47 right = middle;
48 }
49
50 return left == 0 ? nullptr : kernel_symbols[left - 1].name;
51 }
52}
Stores the left, top, width and height of a rectangle.
Definition rectangle.h:22
const char * resolve_symbol(uintptr_t rip, uintptr_t link_base, uintptr_t load_base)
resolve an instruction pointer (rip) to a symbol name and optional offset.
Definition symbols.cpp:23