fix: kpanic clearing registers and hlt correctly
This commit is contained in:
parent
8e2017bd29
commit
e15f0af292
19
src/kernel.c
19
src/kernel.c
@ -42,15 +42,16 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
init_idt();
|
||||
init_memory(mbd, magic);
|
||||
load_drivers();
|
||||
// kprintf(KERN_ALERT
|
||||
// "I see no way to confuse an array of 256 seg:off pairs with a
|
||||
// " "complex 8*unknown quantity -byte descriptor table. -- Troy
|
||||
// " "Martin 03:50, 22 March 2009 (UTC)\n");
|
||||
create_kernel_task();
|
||||
kill(0, 4);
|
||||
for (size_t i = 0; i < 10000; i++)
|
||||
free_pages(alloc_pages(1, NULL), 1);
|
||||
signal(4, bozo);
|
||||
kill(0, 4);
|
||||
PRINT_UINT(vsize(vmalloc(1231231)));
|
||||
for (uint8_t i = 0; i < 10; i++)
|
||||
vmalloc(32);
|
||||
/*
|
||||
uint32_t count = 0;
|
||||
while (vmalloc(10))
|
||||
count++;
|
||||
kprintf("%d allocations done\n", count);
|
||||
*/
|
||||
// kpanic("uwu");
|
||||
shell_init();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ __attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
|
||||
/* terminal_set_bg_color(VGA_COLOR_BLUE); */
|
||||
/* terminal_clear(); */
|
||||
kprintf("kpanic: ");
|
||||
va_start(va, format);
|
||||
kvprintf(format, &va);
|
||||
va_end(va);
|
||||
@ -31,8 +32,5 @@ __attribute__((noreturn)) void kpanic(const char *format, ...)
|
||||
/* print_stack(); */
|
||||
/* kprintf("\n\n"); */
|
||||
/* kprintf("PRESS SPACE TO REBOOT"); */
|
||||
clear_registers();
|
||||
while (terminal_getkey().scan_code != KEY_SPACE)
|
||||
;
|
||||
reboot();
|
||||
__asm__ __volatile__("jmp panic");
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
.intel_syntax noprefix
|
||||
|
||||
.section .text
|
||||
.global clear_registers
|
||||
.global panic
|
||||
|
||||
clear_registers:
|
||||
panic:
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
@ -12,3 +12,8 @@ clear_registers:
|
||||
xor ebp, ebp
|
||||
xor esi, esi
|
||||
xor edi, edi
|
||||
|
||||
cli
|
||||
loop:
|
||||
hlt
|
||||
jmp loop
|
Loading…
Reference in New Issue
Block a user