Move panic into its own translation unit
This commit is contained in:
parent
5948d6c8e8
commit
f1f480251c
3 changed files with 15 additions and 3 deletions
8
lib/panic.c
Normal file
8
lib/panic.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <uart.h>
|
||||||
|
volatile int panicked;
|
||||||
|
|
||||||
|
void panic(char *s) {
|
||||||
|
panicked = 1;
|
||||||
|
uart_puts(s);
|
||||||
|
while (1);
|
||||||
|
}
|
6
lib/panic.h
Normal file
6
lib/panic.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef KERNEL_PANIC_H
|
||||||
|
#define KERNEL_PANIC_H
|
||||||
|
|
||||||
|
void panic(char *s);
|
||||||
|
|
||||||
|
#endif
|
|
@ -4,13 +4,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #include <lib/stdio.h>
|
// #include <lib/stdio.h>
|
||||||
|
#include <panic.h>
|
||||||
#include <proc.h>
|
#include <proc.h>
|
||||||
#include <riscv.h>
|
#include <riscv.h>
|
||||||
#include <spinlock.h>
|
#include <spinlock.h>
|
||||||
|
|
||||||
// void panic(char *s) { for (;;); }
|
|
||||||
void panic(char *s) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The aquire() and release() functions control ownership of the lock.
|
* The aquire() and release() functions control ownership of the lock.
|
||||||
* To perform these operations, modern CPU's provide atomic instructions
|
* To perform these operations, modern CPU's provide atomic instructions
|
||||||
|
|
Loading…
Add table
Reference in a new issue