The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
ksyms.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * kernel symbol table: maps code addresses to function names so panics and
5 * exceptions can print a readable backtrace.
6 *
7 * the table is generated at build time from `nm -n build/kernel.elf` by
8 * tools/gen_ksyms.py and linked into the .ksyms section (see the two-pass
9 * kernel link in the Makefile).
10 */
11
12#include "common/stdint.h"
13
14/**
15 * one symbol: the address it starts at and where its name begins inside
16 * ksym_names.
17 */
23
24// generated tables (sorted by address).
25extern const uint32_t ksym_count;
26extern const ksym_t ksym_table[];
27extern const char ksym_names[];
28
29/**
30 * find the function containing an address.
31 * @param addr a code address.
32 * @param offset receives addr minus the function start; may be NULL.
33 * @return the function name, or NULL if addr is not inside kernel code.
34 */
35const char *ksym_lookup(uintptr_t addr, uintptr_t *offset);
36
37/**
38 * check whether an address lies inside the kernel's .text section.
39 * @param addr the address to check.
40 * @return true if addr is kernel code.
41 */
const char * ksym_lookup(uintptr_t addr, uintptr_t *offset)
find the function containing an address.
Definition ksyms.c:14
bool ksym_is_kernel_text(uintptr_t addr)
check whether an address lies inside the kernel's .text section.
Definition ksyms.c:9
const uint32_t ksym_count
const ksym_t ksym_table[]
const char ksym_names[]
unsigned int uint32_t
Definition fb.h:17
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:19
kernel symbol table: maps code addresses to function names so panics and exceptions can print a reada...
Definition ksyms.h:19
uint32_t name_offset
Definition ksyms.h:21
uintptr_t addr
Definition ksyms.h:20