2018-10-16 14:17:43 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-22 13:20:35 +02:00
|
|
|
#include "kprintf.h"
|
2018-10-25 10:15:28 +02:00
|
|
|
#include "i386.h"
|
2018-10-16 14:17:43 +02:00
|
|
|
|
2018-11-04 13:12:58 +01:00
|
|
|
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func) NORETURN;
|
|
|
|
|
|
|
|
#define ASSERT(expr) (static_cast<bool>(expr) ? (void)0 : __assertion_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
2018-10-22 13:07:06 +02:00
|
|
|
#define CRASH() do { asm volatile("ud2"); } while(0)
|
2018-10-16 14:17:43 +02:00
|
|
|
#define RELEASE_ASSERT(x) do { if (!(x)) CRASH(); } while(0)
|
|
|
|
#define ASSERT_NOT_REACHED() ASSERT(false)
|
2018-12-03 00:39:25 +01:00
|
|
|
#define ASSERT_INTERRUPTS_DISABLED() ASSERT(!(cpu_flags() & 0x200))
|
|
|
|
#define ASSERT_INTERRUPTS_ENABLED() ASSERT(cpu_flags() & 0x200)
|