My Kernel v0.1.0
types.h
1#ifndef KERNEL_TYPES_H
2#define KERNEL_TYPES_H
3
4#include <arch.h>
5#include <stdbool.h>
6#include <stddef.h>
7#include <stdint.h>
8#include <sys/types.h>
9
10#define boolean(_x) (!!(_x))
11
12/*
13 * These macros have no real effect.
14 * They are just here to make it visually clear
15 * when a variable uses a specific endianness.
16 */
17#define __be
18#define __le
20typedef uint8_t u8;
21typedef uint16_t u16;
22typedef uint32_t u32;
23typedef uint64_t u64;
24
25typedef int8_t s8;
26typedef int16_t s16;
27typedef int32_t s32;
28typedef int64_t s64;
29
30typedef float f32; //< 32b floating point value
31typedef double f64; //< 64b floating point value
32
35#ifdef ARCH_IS_32_BITS
36typedef u32 native_t;
37#elif defined(ARCH_IS_64_BITS)
38typedef u64 native_t;
39#else
40#error Unsuported architecture
41#endif
42
44typedef native_t paddr_t;
46typedef native_t vaddr_t;
47
49typedef uint32_t ipv4_t;
50
54typedef int (*compare_t)(const void *left, const void *right);
55#define COMPARE_EQ 0
56#define COMPARE_LESS -1
57#define COMPARE_GREATER 1
58
59#endif /* KERNEL_TYPES_H */