opuntiaOS - an operating system targeting x86 and ARMv7
at master 1.3 kB view raw
1/* 2 * Copyright (C) 2020-2022 The opuntiaOS Project Authors. 3 * + Contributed by Nikita Melekhin <nimelehin@gmail.com> 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9#ifndef _KERNEL_LIBKERN_KASSERT_H 10#define _KERNEL_LIBKERN_KASSERT_H 11 12#include <libkern/c_attrs.h> 13#include <libkern/log.h> 14#include <libkern/types.h> 15#include <platform/generic/system.h> 16#include <platform/generic/tasking/trapframe.h> 17 18#define ASSERT(x) \ 19 if (unlikely(!(x))) { \ 20 log("Kernel assertion failed: %s, function %s, file %s:%d\n", #x, __func__, __FILE__, __LINE__); \ 21 extern int dump_kernel(const char* err); \ 22 dump_kernel(NULL); \ 23 system_stop(); \ 24 } 25 26void kpanic(const char* msg) NORETURN; 27void kpanic_tf(const char* err_msg, trapframe_t* tf) NORETURN; 28 29#endif // _KERNEL_LIBKERN_KASSERT_H