summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/assert.h
blob: 65db119255419738d96dcd3bb18ca264260f2118 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// MIT License, Copyright (c) 2021 Marvin Borner

#ifndef ASSERT_H
#define ASSERT_H

#include <log.h>
#define assert(exp)                                                                                \
	{                                                                                          \
		if (!(exp)) {                                                                      \
			log("%s:%d: %s: Kernel assertion '%s' failed\n", __FILE__, __LINE__,       \
			    __func__, #exp);                                                       \
			while (1)                                                                  \
				__asm__ volatile("cli\nhlt");                                      \
		}                                                                                  \
	}

#endif