A bit of cleaning

This commit is contained in:
2026-02-06 14:39:19 +01:00
parent 38710653be
commit 8aad1235c3
8 changed files with 62 additions and 54 deletions

View File

@@ -26,52 +26,17 @@
// Limine version used
__attribute__((used, section(".limine_requests")))
static volatile LIMINE_BASE_REVISION(3);
volatile LIMINE_BASE_REVISION(3);
// Framebuffer request
__attribute__((used, section(".limine_requests")))
static volatile struct limine_framebuffer_request framebuffer_request = {
.id = LIMINE_FRAMEBUFFER_REQUEST,
.revision = 0
};
// Memory map request
__attribute__((used, section(".limine_requests")))
static volatile struct limine_memmap_request memmap_request = {
.id = LIMINE_MEMMAP_REQUEST,
.revision = 0
};
// Higher Half Direct Map
__attribute__((used, section(".limine_requests")))
static volatile struct limine_hhdm_request hhdm_request = {
.id = LIMINE_HHDM_REQUEST,
.revision = 0
};
// Executable Address/Kernel Address (find base phys/virt address of kernel)
__attribute__((used, section(".limine_requests")))
static volatile struct limine_kernel_address_request kerneladdr_request = {
.id = LIMINE_KERNEL_ADDRESS_REQUEST,
.revision = 0
};
__attribute__((used, section(".limine_requests_start")))
static volatile LIMINE_REQUESTS_START_MARKER;
__attribute__((used, section(".limine_requests_end")))
static volatile LIMINE_REQUESTS_END_MARKER;
// Panic (should dump registers etc. in the future)
// Halt and catch fire (makes machine stall)
void hcf()
{
//CLEAR_INTERRUPTS;
for (;;)
{
asm("hlt");
}
CLEAR_INTERRUPTS; for (;;)asm("hlt");
}
// Doing nothing (can be interrupted)
void idle() {for(;;)asm("hlt");}
void panic(struct cpu_status_t* ctx)
{
DEBUG("\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[0m at rip=%p\nSomething went horribly wrong! vect=0x%.2x errcode=0x%x\n\rrax=%p rbx=%p rcx=%p rdx=%p\n\rrsi=%p rdi=%p r8=%p r9=%p\n\rr10=%p r11=%p r12=%p r13=%p\n\rr14=%p r15=%p\n\n\rflags=%p\n\rstack at rbp=%p\n\rHalting...",
@@ -82,10 +47,13 @@ void panic(struct cpu_status_t* ctx)
hcf();
}
const char* splash = "pepperOS version "PEPPEROS_VERSION_MAJOR"."PEPPEROS_VERSION_MINOR"."PEPPEROS_VERSION_PATCH"\n";
struct boot_context boot_ctx;
extern volatile struct limine_framebuffer_request framebuffer_request;
extern volatile struct limine_memmap_request memmap_request;
extern volatile struct limine_hhdm_request hhdm_request;
extern volatile struct limine_kernel_address_request kerneladdr_request;
extern struct process_t* processes_list;
extern struct process_t* current_process;
@@ -146,7 +114,7 @@ void kmain()
keyboard_init(FR);
term_init();
kputs(splash);
kputs(PEPPEROS_SPLASH);
hcf();
idle();
}