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_idt();
|
||||||
init_memory(mbd, magic);
|
init_memory(mbd, magic);
|
||||||
load_drivers();
|
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();
|
create_kernel_task();
|
||||||
kill(0, 4);
|
PRINT_UINT(vsize(vmalloc(1231231)));
|
||||||
for (size_t i = 0; i < 10000; i++)
|
for (uint8_t i = 0; i < 10; i++)
|
||||||
free_pages(alloc_pages(1, NULL), 1);
|
vmalloc(32);
|
||||||
signal(4, bozo);
|
/*
|
||||||
kill(0, 4);
|
uint32_t count = 0;
|
||||||
|
while (vmalloc(10))
|
||||||
|
count++;
|
||||||
|
kprintf("%d allocations done\n", count);
|
||||||
|
*/
|
||||||
|
// kpanic("uwu");
|
||||||
shell_init();
|
shell_init();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ __attribute__((noreturn)) void kpanic(const char *format, ...)
|
|||||||
|
|
||||||
/* terminal_set_bg_color(VGA_COLOR_BLUE); */
|
/* terminal_set_bg_color(VGA_COLOR_BLUE); */
|
||||||
/* terminal_clear(); */
|
/* terminal_clear(); */
|
||||||
|
kprintf("kpanic: ");
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
kvprintf(format, &va);
|
kvprintf(format, &va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
@ -31,8 +32,5 @@ __attribute__((noreturn)) void kpanic(const char *format, ...)
|
|||||||
/* print_stack(); */
|
/* print_stack(); */
|
||||||
/* kprintf("\n\n"); */
|
/* kprintf("\n\n"); */
|
||||||
/* kprintf("PRESS SPACE TO REBOOT"); */
|
/* kprintf("PRESS SPACE TO REBOOT"); */
|
||||||
clear_registers();
|
__asm__ __volatile__("jmp panic");
|
||||||
while (terminal_getkey().scan_code != KEY_SPACE)
|
|
||||||
;
|
|
||||||
reboot();
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
.global clear_registers
|
.global panic
|
||||||
|
|
||||||
clear_registers:
|
panic:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
@ -12,3 +12,8 @@ clear_registers:
|
|||||||
xor ebp, ebp
|
xor ebp, ebp
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
xor edi, edi
|
xor edi, edi
|
||||||
|
|
||||||
|
cli
|
||||||
|
loop:
|
||||||
|
hlt
|
||||||
|
jmp loop
|
Loading…
Reference in New Issue
Block a user