1 /* $Id: segmem.h,v 1.3 1993/07/04 04:04:21 root Exp root $
4 * Copyright Robert J. Amstadt, 1993
16 * Array to track selector allocation.
18 #define MAX_SELECTORS 512
19 #define SELECTOR_ISFREE 0x8000
20 #define SELECTOR_INDEXMASK 0x0fff
22 extern unsigned short SelectorMap[MAX_SELECTORS];
25 #define SAFEMAKEPTR(s, o) (((int) (s) << 16) | ((o) & 0xffff))
28 #define SAFEMAKEPTR(s, o) \
29 (((int) SelectorMap[SelectorMap[(s) >> 3] & SELECTOR_INDEXMASK] << 19) \
30 | 0x70000 | ((o) & 0xffff))
31 #define FIXPTR(p) SAFEMAKEPTR((unsigned long) (p) >> 16, (p))
35 * Structure to hold info about each selector we create.
38 typedef struct segment_descriptor_s
40 void *base_addr; /* Pointer to segment in flat memory */
41 unsigned int length; /* Length of segment */
42 unsigned int flags; /* Segment flags (see neexe.h and below)*/
43 unsigned short selector; /* Selector used to access this segment */
44 unsigned short owner; /* Handle of owner program */
45 unsigned char type; /* DATA or CODE */
47 key_t shm_key; /* Shared memory key or IPC_PRIVATE */
54 #define NE_SEGFLAGS_MALLOCED 0x00010000 /* Memory allocated with malloc() */
59 #define GLOBAL_FLAGS_MOVEABLE 0x0002
60 #define GLOBAL_FLAGS_ZEROINIT 0x0040
61 #define GLOBAL_FLAGS_CODE 0x00010000
62 #define GLOBAL_FLAGS_EXECUTEONLY 0x00020000
63 #define GLOBAL_FLAGS_READONLY 0x00020000
65 #define FIRST_SELECTOR 8
67 static __inline__ int Is16bitAddress(void *address)
69 return ((int) address >= (((FIRST_SELECTOR << 3) | 0x0007) << 16));