summaryrefslogtreecommitdiff
path: root/Source/Kernel/Core/common.wtf.h
blob: 617a73c25020f3a3b51d8b4f40c5d53317653192 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef DEF_COMMON
#define DEF_COMMON

#include <Config.h>

#define NULL 0

typedef unsigned int	u32int;
typedef unsigned short	u16int;
typedef unsigned char	u8int;
typedef int 	s32int;
typedef short	s16int;
typedef char	s8int;

#include <Core/CMem.ns.h>
#include <Core/Sys.ns.h>

#define PANIC(msg) Sys::panic(msg, __FILE__, __LINE__)
#define ASSERT(b) ((b) ? (void)0 : Sys::panic_assert(__FILE__, __LINE__, #b))

#ifdef OPT_DEBUG
#define DEBUG(m) Sys::bochs_output(m, __FILE__, __LINE__)
#else
#define DEBUG(m)
#endif

#include <MemoryManager/Mem.ns.h>

//Standard implemenations of operator new/delete
inline void* operator new(u32int, void *p) { return p; }
inline void* operator new[](u32int, void *p) { return p; }
inline void operator delete(void*, void*) { }
inline void operator delete[](void*, void*) { }

inline void* operator new(u32int sz) { return Mem::kalloc(sz); }
inline void* operator new[](u32int sz) { return Mem::kalloc(sz); }
inline void operator delete(void *ptr) { Mem::kfree(ptr); }
inline void operator delete[](void *ptr) { Mem::kfree(ptr); }

#endif