forked from xamidev/pepperOS
Function comments (v1)
This commit is contained in:
@@ -10,7 +10,14 @@
|
||||
|
||||
extern struct boot_context boot_ctx;
|
||||
|
||||
// Display the memmap so we see how the memory is laid out at handoff
|
||||
/*
|
||||
* memmap_display - displays a memory map
|
||||
* @response: Limine memory map response
|
||||
*
|
||||
* Displays the memory map we get from Limine
|
||||
* to see different regions, their sizes, and
|
||||
* how the memory is laid out at handoff.
|
||||
*/
|
||||
void memmap_display(struct limine_memmap_response* response)
|
||||
{
|
||||
DEBUG("Got memory map from Limine: revision %u, %u entries", response->revision, response->entry_count);
|
||||
@@ -51,12 +58,18 @@ void memmap_display(struct limine_memmap_response* response)
|
||||
}
|
||||
}
|
||||
|
||||
// Display the HHDM
|
||||
/*
|
||||
* hhdm_display - displays the HHDM offset
|
||||
* @hhdm: Limine HHDM offset response
|
||||
*/
|
||||
void hhdm_display(struct limine_hhdm_response* hhdm)
|
||||
{
|
||||
DEBUG("Got HHDM revision=%u offset=0x%p", hhdm->revision, hhdm->offset);
|
||||
}
|
||||
|
||||
/*
|
||||
* boot_mem_display - displays all memory info
|
||||
*/
|
||||
void boot_mem_display()
|
||||
{
|
||||
memmap_display(boot_ctx.mmap);
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
|
||||
extern struct init_status init;
|
||||
|
||||
/*
|
||||
* panic - Kernel panic
|
||||
* @ctx: CPU context (optional)
|
||||
* @str: Error message
|
||||
*
|
||||
* Ends execution of the kernel in case of an unrecoverable error.
|
||||
* Will display to terminal if it is initialized, otherwise serial only.
|
||||
* Can be called with or without a CPU context.
|
||||
*/
|
||||
void panic(struct cpu_status_t* ctx, const char* str)
|
||||
{
|
||||
CLEAR_INTERRUPTS;
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
extern struct init_status init;
|
||||
|
||||
/*
|
||||
* debug_stack_trace - Prints the stack trace
|
||||
* @max_frames: Maximum amount of stack frames to walk
|
||||
*
|
||||
* Walks back the stack and gets all return values (RIP)
|
||||
* and prints them to the DEBUG interface.
|
||||
*/
|
||||
void debug_stack_trace(unsigned int max_frames)
|
||||
{
|
||||
DEBUG("*** begin stack trace ***");
|
||||
@@ -52,7 +59,16 @@ typedef struct {
|
||||
__attribute__((weak)) extern kernel_symbol_t symbol_table[];
|
||||
__attribute__((weak)) extern uint64_t symbol_count;
|
||||
|
||||
// binary search
|
||||
/*
|
||||
* debug_find_symbol - Finds the symbol name associated to an address
|
||||
* @rip: Pointer to executable code
|
||||
* @offset: Out pointer to reference the offset in the found function, if any
|
||||
*
|
||||
* Return:
|
||||
* <symbol name> - symbol name
|
||||
* "???" - no symbol table found
|
||||
* "unknown" - symbol table found, but address isn't in the table
|
||||
*/
|
||||
const char* debug_find_symbol(uintptr_t rip, uintptr_t* offset)
|
||||
{
|
||||
if (!symbol_table || symbol_count == 0) {
|
||||
|
||||
Reference in New Issue
Block a user