From 284dbccf65504fb723dcb1e9383167f65e5cb175 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 21 Feb 2006 15:26:12 +0000 Subject: [PATCH] Initial endpoint macros. --- include/minix/endpoint.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/minix/endpoint.h diff --git a/include/minix/endpoint.h b/include/minix/endpoint.h new file mode 100644 index 000000000..1de50e95e --- /dev/null +++ b/include/minix/endpoint.h @@ -0,0 +1,23 @@ + +#ifndef _MINIX_ENDPOINT_H +#define _MINIX_ENDPOINT_H 1 + +#include +#include +#include + +/* The point of the padding in 'generation size' is to + * allow for certain bogus endpoint numbers such as NONE, ANY, etc. + * The 207 doesn't mean anything, it's just to make the actual endpoint + * numbers irregular. + */ +#define _ENDPOINT_MAX_PROC (_NR_PROCS + 207) +#define _ENDPOINT_GENERATION_SIZE (NR_TASKS+_ENDPOINT_MAX_PROC+1) +#define _ENDPOINT_MAX_GENERATION (INT_MAX/_ENDPOINT_GENERATION_SIZE-1) + +/* Generation + Process slot number <-> endpoint. */ +#define _ENDPOINT(g, p) ((g) * _ENDPOINT_GENERATION_SIZE + (p)) +#define _ENDPOINT_G(e) (((e)+NR_TASKS) / _ENDPOINT_GENERATION_SIZE) +#define _ENDPOINT_P(e) ((((e)+NR_TASKS) % _ENDPOINT_GENERATION_SIZE) - NR_TASKS) + +#endif