PatchworkOS  28a9544
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>

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 uint64_t addrAmount = 0
 
static uint64_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.

References addrAmount, addrArray, and NULL.

Referenced by symbol_resolve_addr_unlocked().

◆ symbol_insert_address()

◆ symbol_resolve_addr_unlocked()

◆ symbol_resolve_name_unlocked()

Variable Documentation

◆ addrAmount

◆ addrArray

◆ addrCapacity

uint64_t addrCapacity = 0
static

Definition at line 16 of file symbol.c.

Referenced by symbol_insert_address(), and symbol_remove_group().

◆ groupMap

map_t groupMap = MAP_CREATE
static

Definition at line 20 of file symbol.c.

Referenced by symbol_add(), and symbol_remove_group().

◆ lock

rwlock_t lock = RWLOCK_CREATE
static

Definition at line 22 of file symbol.c.

Referenced by symbol_add(), symbol_remove_group(), symbol_resolve_addr(), and symbol_resolve_name().

◆ nameMap

map_t nameMap = MAP_CREATE
static

Definition at line 18 of file symbol.c.

Referenced by symbol_add(), symbol_remove_group(), and symbol_resolve_name_unlocked().