ladybird/Kernel/kassert.h
Andreas Kling 1c49b34b93 Selectively disable interrupts in MM.
Also added an ASSERT_INTERRUPTS_DISABLED() macro.
2018-10-25 10:15:28 +02:00

11 lines
449 B
C

#pragma once
#include "kprintf.h"
#include "i386.h"
#define CRASH() do { asm volatile("ud2"); } while(0)
#define ASSERT(x) do { if (!(x)) { asm volatile("cli"); kprintf("ASSERTION FAILED: " #x "\n%s:%u in %s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); CRASH(); } } while(0)
#define RELEASE_ASSERT(x) do { if (!(x)) CRASH(); } while(0)
#define ASSERT_NOT_REACHED() ASSERT(false)
#define ASSERT_INTERRUPTS_DISABLED() ASSERT(!(cpuFlags() & 0x200))