summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/panic.h
blob: 73819c973abe3d22b43d94f912e15b9f0268924f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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");                                    \
	}

// This shouldn't return, therefore this declaration belongs here (kinda)
void jmp_kernel(void *kernel, int args, ...);

#endif