From 981342ef807ebcefba8eeba74511cdcedf9c36bd Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 5 Jul 2021 13:38:33 +0200 Subject: Device manager, panic and IDE read --- src/loader/inc/pnc.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/loader/inc/pnc.h (limited to 'src/loader/inc/pnc.h') diff --git a/src/loader/inc/pnc.h b/src/loader/inc/pnc.h new file mode 100644 index 0000000..3de3364 --- /dev/null +++ b/src/loader/inc/pnc.h @@ -0,0 +1,21 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#ifndef PNC_H +#define PNC_H + +#include + +#define panic(reason) \ + { \ + log("%s:%d: %s: Panic: %s\n", __FILE__, __LINE__, __func__, (reason)); \ + while (1) \ + __asm__ volatile("cli\nhlt"); \ + } + +#define assert(exp) \ + { \ + if (!(exp)) \ + panic("Assertion '" #exp "' failed"); \ + } + +#endif -- cgit v1.2.3