1 /* $Id: segmem.h,v 1.3 1993/07/04 04:04:21 root Exp root $
4 * Copyright Robert J. Amstadt, 1993
17 #if defined(__NetBSD__) || defined(__FreeBSD__)
19 #include <sys/types.h>
22 #define SHMSEG 32 /* XXX SEMMNI /usr/src/sys/conf/param.h */
23 #define SHM_RANGE_START 0x40000000
27 * Array to track selector allocation.
29 #define MAX_SELECTORS 512
30 #define SELECTOR_ISFREE 0x8000
31 #define SELECTOR_INDEXMASK 0x0fff
33 extern unsigned short SelectorMap
[MAX_SELECTORS
];
36 #define SAFEMAKEPTR(s, o) (((int) (s) << 16) | ((o) & 0xffff))
39 #define SAFEMAKEPTR(s, o) \
40 (((int) SelectorMap[SelectorMap[(s) >> 3] & SELECTOR_INDEXMASK] << 19) \
41 | 0x70000 | ((o) & 0xffff))
42 #define FIXPTR(p) SAFEMAKEPTR((unsigned long) (p) >> 16, (p))
46 * Structure to hold info about each selector we create.
49 typedef struct segment_descriptor_s
51 void *base_addr
; /* Pointer to segment in flat memory */
52 unsigned int length
; /* Length of segment */
53 unsigned int flags
; /* Segment flags (see neexe.h and below)*/
54 unsigned short selector
; /* Selector used to access this segment */
55 unsigned short owner
; /* Handle of owner program */
56 unsigned char type
; /* DATA or CODE */
58 key_t shm_key
; /* Shared memory key or -1 */
62 extern int IPCCopySelector(int i_old
, unsigned long new, int swap_type
);
67 #define NE_SEGFLAGS_MALLOCED 0x00010000 /* Memory allocated with malloc() */
72 #define GLOBAL_FLAGS_MOVEABLE 0x0002
73 #define GLOBAL_FLAGS_ZEROINIT 0x0040
74 #define GLOBAL_FLAGS_CODE 0x00010000
75 #define GLOBAL_FLAGS_EXECUTEONLY 0x00020000
76 #define GLOBAL_FLAGS_READONLY 0x00020000
78 #define FIRST_SELECTOR 8
80 extern SEGDESC Segments
[];