Panic: Only dump stack trace if InitRD is initialized
This commit is contained in:
parent
a078a11dde
commit
3fd1b6773d
@ -46,5 +46,7 @@ namespace InitRD
|
|||||||
File open(const char* filename);
|
File open(const char* filename);
|
||||||
void for_each(void (*callback)(File& file));
|
void for_each(void (*callback)(File& file));
|
||||||
|
|
||||||
|
bool is_initialized();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
}
|
}
|
@ -11,6 +11,12 @@
|
|||||||
extern BOOTBOOT bootboot;
|
extern BOOTBOOT bootboot;
|
||||||
|
|
||||||
static void* initrd_base;
|
static void* initrd_base;
|
||||||
|
static bool initrd_initialized = false;
|
||||||
|
|
||||||
|
bool InitRD::is_initialized()
|
||||||
|
{
|
||||||
|
return initrd_initialized;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int get_file_size_in_blocks(InitRD::File f)
|
static inline int get_file_size_in_blocks(InitRD::File f)
|
||||||
{
|
{
|
||||||
@ -110,4 +116,5 @@ void InitRD::init()
|
|||||||
initrd_base = MemoryManager::get_unaligned_mappings((void*)bootboot.initrd_ptr, bootboot.initrd_size / 4096 + 1);
|
initrd_base = MemoryManager::get_unaligned_mappings((void*)bootboot.initrd_ptr, bootboot.initrd_size / 4096 + 1);
|
||||||
kdbgln("physical base at %lx, size %lx, mapped to %lx", bootboot.initrd_ptr, bootboot.initrd_size,
|
kdbgln("physical base at %lx, size %lx, mapped to %lx", bootboot.initrd_ptr, bootboot.initrd_size,
|
||||||
(uint64_t)initrd_base);
|
(uint64_t)initrd_base);
|
||||||
|
initrd_initialized = true;
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
#define MODULE "panic"
|
#define MODULE "panic"
|
||||||
|
|
||||||
#include "panic/Panic.h"
|
#include "panic/Panic.h"
|
||||||
|
#include "init/InitRD.h"
|
||||||
#include "interrupts/IDT.h"
|
#include "interrupts/IDT.h"
|
||||||
#include "io/PIC.h"
|
#include "io/PIC.h"
|
||||||
#include "log/Log.h"
|
#include "log/Log.h"
|
||||||
@ -25,10 +26,13 @@ static void dump_registers(Context* context)
|
|||||||
{
|
{
|
||||||
dump_registers(context);
|
dump_registers(context);
|
||||||
|
|
||||||
|
if (InitRD::is_initialized())
|
||||||
|
{
|
||||||
printf("-- Stack trace:\n");
|
printf("-- Stack trace:\n");
|
||||||
|
|
||||||
StackTracer tracer(context->rbp);
|
StackTracer tracer(context->rbp);
|
||||||
tracer.trace_with_ip(context->rip);
|
tracer.trace_with_ip(context->rip);
|
||||||
|
}
|
||||||
|
else { printf("-- No stack trace available\n"); }
|
||||||
|
|
||||||
PIC::enable_master(0b11111101); // enable keyboard only
|
PIC::enable_master(0b11111101); // enable keyboard only
|
||||||
PIC::enable_slave(0b11111111);
|
PIC::enable_slave(0b11111111);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user