feature: clear registers when kpanic is called

This commit is contained in:
0x35c 2025-04-18 17:19:56 +02:00
parent 6c8c158a1f
commit 81c54647d2
2 changed files with 16 additions and 0 deletions

14
src/clear_register.s Normal file
View File

@ -0,0 +1,14 @@
.intel_syntax noprefix
.section .text
.global clear_registers
clear_registers:
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
xor esp, esp
xor ebp, ebp
xor esi, esi
xor edi, edi

View File

@ -9,6 +9,7 @@
extern uint32_t page_table1[1024];
extern const char *faults[];
void clear_registers(void);
__attribute__((noreturn)) void kpanic(const char *format, ...)
{
@ -30,6 +31,7 @@ __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();