summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/pnc.h
blob: 3de3364b13550d5b1b3bad702af9c8b192917ac1 (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\n", __FILE__, __LINE__, __func__, (reason));             \
		while (1)                                                                          \
			__asm__ volatile("cli\nhlt");                                              \
	}

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

#endif