kernel: various changes.

+ kernel: replace sk-hello test executable with a test initramfs
+ panic: start implementing a proper kernel panic screen
+ lib: added a new string.h library for string manipulation.
+ kernel: replace all the strlen implementations with the strlen() function
This commit is contained in:
RaphProductions 2025-05-11 23:54:14 +02:00
parent 7fb04f134b
commit a838d99a5a
19 changed files with 173 additions and 149 deletions

View file

@ -1,5 +1,3 @@
// #include "mm/pmm.h"
// #include "mm/vmm.h"
#include "mm/pmm.h"
#include "mm/vmm.h"
#include "sched/sched.h"
@ -7,39 +5,20 @@
#include "sys/arch/x86_64/rtc.h"
#include "sys/log.h"
#include "sys/syscall.h"
// #include "sys/sched.h"
#include <stdint.h>
#include <sys/arch/x86_64/idt.h>
#include <sys/arch/x86_64/io.h>
// #include <sys/errhand/panic.h>
int pit_millis = 0;
int pit_secs = 0;
extern int vmm_kernel_pm_exists;
struct Idt_StackFrame {
struct Idt_StackFrame *rbp;
uint64_t rip;
} __attribute__((packed));
void dump_backtrace(registers_t *r) {
log("ints - backtrace : \n");
struct Idt_StackFrame *frame = (struct Idt_StackFrame *)r->rbp;
while (frame) {
log("ints - %s (ip: %p)\n", frame->rip);
frame = frame->rbp;
}
log("ints - <end of backtrace>\n");
}
void pit_handler(registers_t *regs);
void exception_handler(registers_t *regs) {
vmm_load_pagemap(vmm_kernel_pm);
if (regs->int_no < 32) {
// panic(kmode_cpu_exception, regs);
log("ints - %d (RIP: %p, ERR: %d)\n", regs->int_no, regs->rip,
regs->err_code);
@ -53,7 +32,6 @@ void exception_handler(registers_t *regs) {
log("ints - PF: Faulting page map: %p\n", PHYSICAL(vmm_current_pm));
}
// dump_backtrace(regs);
asm("cli");
while (1)
asm("hlt");
@ -73,7 +51,6 @@ void exception_handler(registers_t *regs) {
} else if (regs->int_no == 0x80) {
syscall_handle(regs);
}
// logln(info, "arch/ints", "Received interrupt %d\n", regs->int_no);
//vmm_load_pagemap(curr_proc->pm);
pic_ack(regs->int_no - 32);
}