Move panic into its own translation unit

This commit is contained in:
Imbus 2025-06-26 06:19:43 +02:00
parent 5948d6c8e8
commit f1f480251c
3 changed files with 15 additions and 3 deletions

8
lib/panic.c Normal file
View 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
View file

@ -0,0 +1,6 @@
#ifndef KERNEL_PANIC_H
#define KERNEL_PANIC_H
void panic(char *s);
#endif

View file

@ -4,13 +4,11 @@
*/
// #include <lib/stdio.h>
#include <panic.h>
#include <proc.h>
#include <riscv.h>
#include <spinlock.h>
// void panic(char *s) { for (;;); }
void panic(char *s) {}
/**
* The aquire() and release() functions control ownership of the lock.
* To perform these operations, modern CPU's provide atomic instructions