panic improvements
This commit is contained in:
parent
1a3259b811
commit
6aca680609
2 changed files with 5 additions and 7 deletions
|
|
@ -14,9 +14,6 @@ void kmain() {
|
||||||
kprint("Stress testing memory...\n");
|
kprint("Stress testing memory...\n");
|
||||||
while(1) {
|
while(1) {
|
||||||
void *p = page_alloc();
|
void *p = page_alloc();
|
||||||
if (p == NULL) {
|
|
||||||
kpanic("Expected OOM reached!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
poweroff();
|
poweroff();
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@
|
||||||
#include <syscon/syscon.h>
|
#include <syscon/syscon.h>
|
||||||
|
|
||||||
void kpanic(const char *reason){
|
void kpanic(const char *reason){
|
||||||
kprint("\n!!! PANIC!!!\n");
|
kputs("\n!!! PANIC !!!\n");
|
||||||
kprint(reason);
|
kputs(reason);
|
||||||
|
kputs("\n!!! PANIC !!!\n");
|
||||||
poweroff();
|
poweroff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,10 +16,10 @@ void kpanic_force() {
|
||||||
// 'ebreak' is the standard RISC-V way to trigger a debug trap.
|
// 'ebreak' is the standard RISC-V way to trigger a debug trap.
|
||||||
__asm__ volatile("ebreak");
|
__asm__ volatile("ebreak");
|
||||||
|
|
||||||
// 3. If no debugger is attached or we continue, kill the VM
|
kprint("Force panic falled. Power off. \n");
|
||||||
poweroff();
|
poweroff();
|
||||||
|
|
||||||
// 4. Final halt
|
kprint("Force panic falled. Power off failed. sleep until interupt. \n");
|
||||||
while(1) {
|
while(1) {
|
||||||
__asm__ volatile("wfi");
|
__asm__ volatile("wfi");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue