PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
symbol.c File Reference
#include <kernel/module/symbol.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/sync/rwlock.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/list.h>
#include <sys/proc.h>
Include dependency graph for symbol.c:

Go to the source code of this file.

Functions

symbol_group_id_t symbol_generate_group_id (void)
 Generate a unique symbol group identifier.
 
static uint64_t symbol_get_floor_index_for_addr (void *addr)
 
static symbol_addr_tsymbol_insert_address (void *addr, symbol_group_id_t groupId, Elf64_Symbol_Binding binding, Elf64_Symbol_Type type, symbol_name_t *symbolName)
 
static uint64_t symbol_resolve_addr_unlocked (symbol_info_t *outSymbol, void *addr)
 
static uint64_t symbol_resolve_name_unlocked (symbol_info_t *outSymbol, const char *name)
 
uint64_t symbol_add (const char *name, void *addr, symbol_group_id_t groupId, Elf64_Symbol_Binding binding, Elf64_Symbol_Type type)
 Add a symbol to the kernel symbol table.
 
void symbol_remove_group (symbol_group_id_t groupId)
 Remove all symbols from the kernel symbol table in the given group.
 
uint64_t symbol_resolve_addr (symbol_info_t *outSymbol, void *addr)
 Resolve a symbol by address.
 
uint64_t symbol_resolve_name (symbol_info_t *outSymbol, const char *name)
 Resolve a symbol by name.
 

Variables

static symbol_addr_t ** addrArray = NULL
 
static size_t addrAmount = 0
 
static size_t addrCapacity = 0
 
static map_t nameMap = MAP_CREATE()
 
static map_t groupMap = MAP_CREATE()
 
static rwlock_t lock = RWLOCK_CREATE()
 

Function Documentation

◆ symbol_get_floor_index_for_addr()

static uint64_t symbol_get_floor_index_for_addr ( void *  addr)
static

Definition at line 31 of file symbol.c.

Here is the caller graph for this function:

◆ symbol_insert_address()

static symbol_addr_t * symbol_insert_address ( void *  addr,
symbol_group_id_t  groupId,
Elf64_Symbol_Binding  binding,
Elf64_Symbol_Type  type,
symbol_name_t symbolName 
)
static

Definition at line 59 of file symbol.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ symbol_resolve_addr_unlocked()

static uint64_t symbol_resolve_addr_unlocked ( symbol_info_t outSymbol,
void *  addr 
)
static

Definition at line 111 of file symbol.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ symbol_resolve_name_unlocked()

static uint64_t symbol_resolve_name_unlocked ( symbol_info_t outSymbol,
const char *  name 
)
static

Definition at line 139 of file symbol.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ addrArray

symbol_addr_t** addrArray = NULL
static

Definition at line 14 of file symbol.c.

◆ addrAmount

size_t addrAmount = 0
static

Definition at line 15 of file symbol.c.

◆ addrCapacity

size_t addrCapacity = 0
static

Definition at line 16 of file symbol.c.

◆ nameMap

map_t nameMap = MAP_CREATE()
static

Definition at line 18 of file symbol.c.

◆ groupMap

map_t groupMap = MAP_CREATE()
static

Definition at line 20 of file symbol.c.

◆ lock

rwlock_t lock = RWLOCK_CREATE()
static

Definition at line 22 of file symbol.c.