feat: added shutdown command

This commit is contained in:
2021-03-03 22:12:37 +01:00
parent c9102fbc65
commit 300e80c2e8
6 changed files with 71 additions and 25 deletions

View File

@@ -3,8 +3,9 @@
//
#include <stdbool.h>
#include <libk/kprint.h>
#include <attributes.h>
#include "libk.h"
#include "kprint.h"
bool k_addr_in_kspace(void* addr) {
return addr > kernel_start && addr < kernel_end;
@@ -14,15 +15,16 @@ void k_wait_for_interrupt() {
__asm__ __volatile__("hlt;");
}
void k_panics(const char *msg) {
void noreturn k_panics(const char *msg) {
// todo this is not printed
kprint(msg);
kprint("PANIC!");
__asm__ __volatile__("cli;"
"hlt;");
k_panic();
}
void k_panic() {
void noreturn k_panic() {
kprint("PANIC!");
__asm__ __volatile__("cli;"
"hlt;");
while (true) {
__asm__ __volatile__("cli;"
"hlt;");
}
}

View File

@@ -4,6 +4,7 @@
#ifndef NEW_KERNEL_LIBK_H
#define NEW_KERNEL_LIBK_H
#include <attributes.h>
#include <stdbool.h>
extern void* _kernel_start;
@@ -15,8 +16,8 @@ bool k_addr_in_kspace(void *addr);
void k_wait_for_interrupt();
void k_panics(const char *msg);
void noreturn k_panics(const char *msg);
void k_panic();
void noreturn k_panic();
#endif //NEW_KERNEL_LIBK_H