1 #ifndef __LUNAIX_CONSTANTS_H
2 #define __LUNAIX_CONSTANTS_H
4 #define MEM_1MB 0x100000
5 #define MEM_4MB 0x400000
7 #define USER_START 0x400000
9 #define KSTACK_SIZE MEM_1MB
10 #define KSTACK_START (USER_START - KSTACK_SIZE)
11 #define KSTACK_TOP ((USER_START - 1) & ~0xf)
12 #define within_kstack(addr) (KSTACK_START <= (addr) && (addr) <= KSTACK_TOP)
14 #define VGA_FRAMEBUFFER 0xB8000
16 #define KCODE_SEG 0x08
17 #define KDATA_SEG 0x10
19 #define KSIZE (MEM_4MB * 16)
21 #define USTACK_SIZE MEM_4MB
22 #define USTACK_TOP 0x9ffffff0
23 #define USTACK_END (0x9fffffff - USTACK_SIZE + 1)
24 #define UMMAP_START 0x4D000000
25 #define UMMAP_END (USTACK_END - MEM_4MB)
28 #include <lunaix/types.h>
29 // From Linux kernel v2.6.0 <kernel.h:194>
31 * container_of - cast a member of a structure out to the containing structure
33 * @ptr: the pointer to the member.
34 * @type: the type of the container struct this is embedded in.
35 * @member: the name of the member within the struct.
38 #define container_of(ptr, type, member) \
40 const typeof(((type*)0)->member)* __mptr = (ptr); \
41 (ptr) ? (type*)((char*)__mptr - offsetof(type, member)) : 0; \
45 #endif /* __LUNAIX_CONSTANTS_H */