The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
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
*/
18
typedef
struct
19
{
20
uintptr_t
addr
;
21
uint32_t
name_offset
;
22
}
ksym_t
;
23
24
// generated tables (sorted by address).
25
extern
const
uint32_t
ksym_count
;
26
extern
const
ksym_t
ksym_table
[];
27
extern
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
*/
35
const
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
*/
42
bool
ksym_is_kernel_text
(
uintptr_t
addr);
stdint.h
ksym_lookup
const char * ksym_lookup(uintptr_t addr, uintptr_t *offset)
find the function containing an address.
Definition
ksyms.c:14
ksym_is_kernel_text
bool ksym_is_kernel_text(uintptr_t addr)
check whether an address lies inside the kernel's .text section.
Definition
ksyms.c:9
ksym_count
const uint32_t ksym_count
ksym_table
const ksym_t ksym_table[]
ksym_names
const char ksym_names[]
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uintptr_t
__UINTPTR_TYPE__ uintptr_t
Definition
stdint.h:19
ksym_t
kernel symbol table: maps code addresses to function names so panics and exceptions can print a reada...
Definition
ksyms.h:19
ksym_t::name_offset
uint32_t name_offset
Definition
ksyms.h:21
ksym_t::addr
uintptr_t addr
Definition
ksyms.h:20
src
kernel
debug
ksyms.h
Generated by
1.18.0