AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
system.h
Go to the documentation of this file.
1#ifndef _CORE_SYSTEM_H
2#define _CORE_SYSTEM_H
3
4/* What nearly every kernel file needs: small macros, the compiler's
5 * attributes, the basic types, printk() and kmalloc(). */
6
7/* A bit's value, the larger or smaller of two values, a value without
8 * its sign. */
9#define _BV(b) (1 << (b))
10#define MAX(a, b) ((a) > (b) ? (a) : (b))
11#define MIN(a, b) ((a) < (b) ? (a) : (b))
12#define ABS(a) ((a) < 0? -(a) : (a))
13
14/* The size of a structure's member. */
15#define MEMBER_SIZE(type, member) (sizeof(((type *)0)->member))
16
17/* Marks what may be unused, without a warning (not with every
18 * compiler). */
19#if defined(__TINYC__) || defined(__clang__) || defined(__PCC__)
20 #undef __unused
21 #define __unused
22#else
23 #ifndef __unused
24 #define __unused __attribute__((unused))
25 #endif
26#endif
27
28
29/* A structure with no padding, aligned data, data in a given section. */
30#define __packed __attribute__((packed))
31#define __aligned(n) __attribute__((aligned(n)))
32#define __section(s) __attribute__((section(s)))
33
34#if defined(__TINYC__) || defined(__PCC__)
35#include <stddef.h>
36#else
37#include_next <stddef.h>
38#include_next <stdint.h>
39#endif
40
41#include <core/printk.h>
42#include <mm/kvmem.h>
43
44#include <config.h>
45#include <core/types.h>
46
47#endif /* ! _CORE_SYSTEM_H */