kernel: maintain stack alignment
[minix3.git] / include / minix / endpoint.h
blob54dc7b9d66566f86e0652c24eb1a8a72dd9dd383
2 #ifndef _MINIX_ENDPOINT_H
3 #define _MINIX_ENDPOINT_H 1
5 #include <minix/sys_config.h>
6 #include <minix/com.h>
7 #include <limits.h>
8 #include <minix/type.h>
10 /* The point of the padding in 'generation size' is to
11 * allow for certain bogus endpoint numbers such as NONE, ANY, etc.
13 * The _MAX_MAGIC_PROC is defined by <minix/com.h>. That include
14 * file defines some magic process numbers such as ANY and NONE,
15 * and must never be a valid endpoint number. Therefore we make sure
16 * the generation size is big enough to start the next generation
17 * above the highest magic number.
19 #define _ENDPOINT_GENERATION_SIZE (MAX_NR_TASKS+_MAX_MAGIC_PROC+1)
20 #define _ENDPOINT_MAX_GENERATION (INT_MAX/_ENDPOINT_GENERATION_SIZE-1)
22 /* Generation + Process slot number <-> endpoint. */
23 #define _ENDPOINT(g, p) ((endpoint_t)((g) * _ENDPOINT_GENERATION_SIZE + (p)))
24 #define _ENDPOINT_G(e) (((e)+MAX_NR_TASKS) / _ENDPOINT_GENERATION_SIZE)
25 #define _ENDPOINT_P(e) \
26 ((((e)+MAX_NR_TASKS) % _ENDPOINT_GENERATION_SIZE) - MAX_NR_TASKS)
28 #endif