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

#ifndef PNC_H
#define PNC_H

#include <log.h>

#define panic(reason)                                                                              \
	{                                                                                          \
		log("%s:%d: %s: Panic: %s", __FILE__, __LINE__, __func__, (reason));               \
		while (1)                                                                          \
			__asm__ volatile("cli\nhlt");                                              \
	}

#define assert(exp)                                                                                \
	{                                                                                          \
		if (!(exp))                                                                        \
			panic("Assertion '" #exp "' failed\n");                                    \
	}

#endif