- the magic numbers ANY, NONE and SELF are kept for the compatibility with the current userspace. It is OK as long as NR_PROCS is greater so they don't colide with other endpoints - the 32 bit endpoint_t value is split in half, lower 16 bits for process slot number and upper half for generation number - transition to a structured endpoint_t in the future possible
		
			
				
	
	
		
			29 lines
		
	
	
		
			1020 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			1020 B
		
	
	
	
		
			C
		
	
	
	
	
	
 | 
						|
#ifndef _MINIX_ENDPOINT_H
 | 
						|
#define _MINIX_ENDPOINT_H 1
 | 
						|
 | 
						|
#include <minix/sys_config.h>
 | 
						|
#include <minix/com.h>
 | 
						|
#include <limits.h>
 | 
						|
 | 
						|
/* The point of the padding in 'generation size' is to 
 | 
						|
 * allow for certain bogus endpoint numbers such as NONE, ANY, etc.
 | 
						|
 *
 | 
						|
 * The _MAX_MAGIC_PROC is defined by <minix/com.h>. That include
 | 
						|
 * file defines some magic process numbers such as ANY and NONE,
 | 
						|
 * and must never be a valid endpoint number. Therefore we make sure
 | 
						|
 * the generation size is big enough to start the next generation
 | 
						|
 * above the highest magic number.
 | 
						|
 */
 | 
						|
#define _ENDPOINT_GENERATION_BITS	16
 | 
						|
#define _ENDPOINT_PNUM_BITS		16
 | 
						|
#define _ENDPOINT_MAX_GENERATION	((1 << _ENDPOINT_GENERATION_BITS)-1)
 | 
						|
#define _ENDPOINT_MAX_PNUM		((1 << _ENDPOINT_PNUM_BITS) - 1)
 | 
						|
 | 
						|
/* Generation + Process slot number <-> endpoint. */
 | 
						|
#define _ENDPOINT(g, p)	((endpoint_t)(((g) << _ENDPOINT_PNUM_BITS) | (p)))
 | 
						|
#define _ENDPOINT_G(e) 	((u16_t)((e) >> _ENDPOINT_PNUM_BITS))
 | 
						|
#define _ENDPOINT_P(e) 	((i16_t)((e) & _ENDPOINT_MAX_PNUM))
 | 
						|
 | 
						|
#endif
 |