提交 013a2bac 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

A better panic.

上级 4c1ef7b0
...@@ -44,6 +44,7 @@ OBJS = \ ...@@ -44,6 +44,7 @@ OBJS = \
string.o \ string.o \
syscall.o \ syscall.o \
sysfile.o \ sysfile.o \
sysproc.o \
uart.o \ uart.o \
vm.o \ vm.o \
trap.o \ trap.o \
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "cpu.h" #include "cpu.h"
#include "kernel.h" #include "kernel.h"
#include "spinlock.h" #include "spinlock.h"
#include "x86.h"
#include <stdarg.h> #include <stdarg.h>
...@@ -173,11 +174,17 @@ puts(const char *s) ...@@ -173,11 +174,17 @@ puts(const char *s)
void __attribute__((noreturn)) void __attribute__((noreturn))
panic(const char *s) panic(const char *s)
{ {
puts("panic: "); cli();
puts(s); cons.locking = 0;
puts("\n"); cprintf("cpu%d: panic: ", mycpu()->id);
cprintf(s);
cprintf("\n");
extern void sys_halt();
sys_halt();
for (;;); for(;;)
;
} }
void void
......
#include "types.h" #include "types.h"
#include "x86.h" #include "x86.h"
#include "defs.h" #include "kernel.h"
#include "param.h" #include "param.h"
#include "memlayout.h" #include "memlayout.h"
#include "mmu.h" #include "mmu.h"
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.h"
#if 0
int int
sys_fork(void) sys_fork(void)
{ {
...@@ -143,6 +144,7 @@ sys_unmap(void) ...@@ -143,6 +144,7 @@ sys_unmap(void)
sti(); sti();
return 0; return 0;
} }
#endif
int int
sys_halt(void) sys_halt(void)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论