1/* @title: Kernel symbol table */
2#pragma once
3#include <stdint.h>
4
5#define KERNEL_SYMS_MAGIC 0x534d5953u /* "SYMS" */
6
7#define KERNEL_SYMS_RESERVE 2621440
8
9struct kernel_syms_hdr {
10 uint32_t magic;
11 uint32_t count;
12 uint32_t strtab_off; /* from the start of the header */
13 uint32_t lines_off; /* 0 when the build produced no line table */
14};
15
16/* Sorted by addr, so lookups can bisect */
17struct kernel_sym {
18 uint64_t addr;
19 uint32_t name_off; /* from the start of the string table */
20 uint32_t _pad;
21};
22
23#define KERNEL_LINES_MAGIC 0x454e494cu /* "LINE" */
24
25/* Address -> file:line
26 *
27 * A fixed width entry per row would be really big, so rows are a delta stream
28 * instead. For every row, how far the address moved, then change in file and in
29 * line. Every field is uleb128, and the two that can go backwards are zigzagged
30 * first, so the decoder doesn't need a sign bit, which is about 3 bytes a row
31 */
32
33struct kernel_lines_hdr {
34 uint32_t magic;
35 uint32_t count; /* entries in the stream */
36 uint64_t base_addr; /* the address the first delta is relative to */
37 uint32_t stream_off;
38 uint32_t stream_len;
39 uint32_t files_off; /* NULL separated names, indexed by the file field */
40 uint32_t files_len;
41};
42
43extern const char kernel_syms_blob[KERNEL_SYMS_RESERVE];
44