/* Calcite, src/kernel/debug.h * Copyright 2025-2026 Benji Dial * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #pragma once void log_core(const char *file, const char *function, const char *format, ...); #define log(...) { \ log_core(__FILE__, __func__, __VA_ARGS__); \ } #ifdef CALCITE_DEBUG #define debug_log(...) log(__VA_ARGS__) #elif CALCITE_RELEASE #define debug_log(...) {} #else #error neither CALCITE_DEBUG nor CALCITE_RELEASE defined #endif #define panic(message) { \ log_core(__FILE__, __func__, "kernel panic: %s", message); \ while (1) \ __asm__ ("hlt"); \ } #define assert(condition) \ { \ if (!(condition)) \ panic("assertion failed: " #condition) \ }