Changeset da13982 in mainline for kernel/generic/src/main/kinit.c


Ignore:
Timestamp:
2023-10-26T15:20:07Z (7 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
2fbb42f
Parents:
d28bdbe
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-26 14:42:03)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-26 15:20:07)
Message:

Read symbol table from ELF sections

Instead of the currently broken data generated using genmap.py,
read the ELF symbol table for stack traces and symbol names.
In addition to that, prepare ground for accessing DWARF debug
sections.

Because neither .symtab, nor .debug_* sections are
normally part of the program image, these have to be provided
externally. Instead of the previous way of relinking kernel
to bake in the symbol data, we now only link kernel once
and the extra debug data is loaded as part of the initrd image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/kinit.c

    rd28bdbe rda13982  
    7373#include <align.h>
    7474#include <stdlib.h>
     75#include <debug/register.h>
    7576
    7677#ifdef CONFIG_SMP
     
    182183         */
    183184        size_t i;
    184         program_t programs[CONFIG_INIT_TASKS];
     185        program_t programs[CONFIG_INIT_TASKS] = { };
    185186
    186187        // FIXME: do not propagate arguments through sysinfo
     
    237238                    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
    238239                assert(page);
     240
     241                if (str_cmp(name, "kernel.dbg") == 0) {
     242                        /*
     243                         * Not an actual init task, but rather debug sections extracted
     244                         * from the kernel ELF file and handed to us here so we can use
     245                         * it for debugging.
     246                         */
     247
     248                        register_debug_data((void *) page, init.tasks[i].size);
     249                        programs[i].task = NULL;
     250                        continue;
     251                }
    239252
    240253                if (str_cmp(name, "loader") == 0) {
Note: See TracChangeset for help on using the changeset viewer.