Changeset 409 for trunk/kernel/mm/vseg.h
- Timestamp:
- Dec 20, 2017, 4:51:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vseg.h
r408 r409 35 35 struct vmm_s; 36 36 37 /******************************************************************************************* ***37 /******************************************************************************************* 38 38 * This enum defines the vseg types for an user process. 39 *********************************************************************************** **********/39 ***********************************************************************************VSEG*******/ 40 40 41 41 typedef enum 42 42 { 43 VSEG_TYPE_CODE = 0, /*! executable user code / private / localized 44 VSEG_TYPE_DATA = 1, /*! initialized user data / public / distributed 45 VSEG_TYPE_STACK = 2, /*! execution user stack / private / localized 46 VSEG_TYPE_ANON = 3, /*! anonymous mmap / public / localized 47 VSEG_TYPE_FILE = 4, /*! file mmap / public / localized 48 VSEG_TYPE_REMOTE = 5, /*! remote mmap / public / localized 43 VSEG_TYPE_CODE = 0, /*! executable user code / private / localized */ 44 VSEG_TYPE_DATA = 1, /*! initialized user data / public / distributed */ 45 VSEG_TYPE_STACK = 2, /*! execution user stack / private / localized */ 46 VSEG_TYPE_ANON = 3, /*! anonymous mmap / public / localized */ 47 VSEG_TYPE_FILE = 4, /*! file mmap / public / localized */ 48 VSEG_TYPE_REMOTE = 5, /*! remote mmap / public / localized */ 49 49 50 50 VSEG_TYPE_KDATA = 10, … … 55 55 56 56 57 /******************************************************************************************* ***57 /******************************************************************************************* 58 58 * These masks define the vseg generic (hardware independent) flags. 59 ****************************************************************************************** ***/59 ******************************************************************************************/ 60 60 61 #define VSEG_USER 0x0001 /*! user accessible */ 62 #define VSEG_WRITE 0x0002 /*! writeable */ 63 #define VSEG_EXEC 0x0004 /*! executable */ 64 #define VSEG_CACHE 0x0008 /*! cachable */ 65 #define VSEG_PRIVATE 0x0010 /*! should not be accessed from another cluster */ 66 #define VSEG_DISTRIB 0x0020 /*! physically distributed on all clusters */ 61 #define VSEG_USER 0x0001 /*! user accessible */ 62 #define VSEG_WRITE 0x0002 /*! writeable */ 63 #define VSEG_EXEC 0x0004 /*! executable */ 64 #define VSEG_CACHE 0x0008 /*! cachable */ 65 #define VSEG_PRIVATE 0x0010 /*! should not be accessed from another cluster */ 66 #define VSEG_DISTRIB 0x0020 /*! physically distributed on all clusters */ 67 #define VSEG_IDENT 0x0040 /*! identity mapping */ 67 68 68 /******************************************************************************************* ***69 /******************************************************************************************* 69 70 * This structure defines a virtual segment descriptor. 70 71 * - The VSL contains only local vsegs, but is implemented as an xlist, because it can be 71 72 * accessed by thread running in a remote cluster. 72 73 * - The zombi list is used by the local MMAP allocator. It is implemented as a local list. 73 ****************************************************************************************** ***/74 ******************************************************************************************/ 74 75 75 76 typedef struct vseg_s 76 77 { 77 xlist_entry_t xlist; /*! all vsegs in same VSL (or same zombi list) 78 list_entry_t zlist; /*! all vsegs in same zombi list 79 struct vmm_s * vmm; /*! pointer on associated VM manager 80 uint32_t type; /*! vseg type 81 intptr_t min; /*! segment min virtual address 82 intptr_t max; /*! segment max virtual address (excluded) 83 vpn_t vpn_base; /*! first page of vseg 84 vpn_t vpn_size; /*! number of pages occupied 85 uint32_t flags; /*! vseg attributes 86 xptr_t mapper_xp; /*! xptr on remote mapper (for types CODE/DATA/FILE) 87 intptr_t file_offset; /*! vseg offset in file (for types CODE/DATA/FILE 88 intptr_t file_size; /*! max segment size in mapper (for type CODE/DATA) 89 cxy_t cxy; /*! physical mapping (for non distributed vseg) 78 xlist_entry_t xlist; /*! all vsegs in same VSL (or same zombi list) */ 79 list_entry_t zlist; /*! all vsegs in same zombi list */ 80 struct vmm_s * vmm; /*! pointer on associated VM manager */ 81 uint32_t type; /*! vseg type */ 82 intptr_t min; /*! segment min virtual address */ 83 intptr_t max; /*! segment max virtual address (excluded) */ 84 vpn_t vpn_base; /*! first page of vseg */ 85 vpn_t vpn_size; /*! number of pages occupied */ 86 uint32_t flags; /*! vseg attributes */ 87 xptr_t mapper_xp; /*! xptr on remote mapper (for types CODE/DATA/FILE) */ 88 intptr_t file_offset; /*! vseg offset in file (for types CODE/DATA/FILE */ 89 intptr_t file_size; /*! max segment size in mapper (for type CODE/DATA) */ 90 cxy_t cxy; /*! physical mapping (for non distributed vseg) */ 90 91 } 91 92 vseg_t; 92 93 93 /******************************************************************************************* ***94 /******************************************************************************************* 94 95 * This function returns a printable string for the vseg type. 95 ******************************************************************************************* ***96 ******************************************************************************************* 96 97 * @ vseg_type : type of vseg 97 98 * @ return pointer on string 98 ****************************************************************************************** ***/99 ******************************************************************************************/ 99 100 char * vseg_type_str( uint32_t vseg_type ); 100 101 101 /******************************************************************************************* ***102 /******************************************************************************************* 102 103 * This function allocates physical memory for a new vseg descriptor from the local cluster 103 104 * physical memory allocator. 104 ******************************************************************************************* ***105 ******************************************************************************************* 105 106 * @ return pointer on allocated vseg descriptor if success / return NULL if failure. 106 ****************************************************************************************** ***/107 ******************************************************************************************/ 107 108 vseg_t * vseg_alloc(); 108 109 109 /******************************************************************************************* ***110 * This function releases physical memory allocated for a vseg descriptor to the local cluster111 * physical memory allocator.112 ******************************************************************************************* ***110 /******************************************************************************************* 111 * This function releases the physical memory allocated for a vseg descriptor 112 * to the local cluster physical memory allocator. 113 ******************************************************************************************* 113 114 * @ vseg : local pointer on released vseg descriptor. 114 ****************************************************************************************** ***/115 ******************************************************************************************/ 115 116 void vseg_free( vseg_t * vseg ); 116 117 117 /******************************************************************************************* ***118 /******************************************************************************************* 118 119 * This function initializes a local vseg descriptor, from the arguments values. 119 120 * It does NOT register the vseg in the local VMM. 120 ******************************************************************************************* ***121 ******************************************************************************************* 121 122 * @ vseg : pointer on the vseg descriptor. 122 123 * @ base : vseg base address. … … 126 127 * @ type : vseg type. 127 128 * @ cxy : target cluster for physical mapping. 128 ****************************************************************************************** ***/129 ******************************************************************************************/ 129 130 void vseg_init( vseg_t * vseg, 130 131 vseg_type_t type, … … 138 139 cxy_t cxy ); 139 140 140 /******************************************************************************************* ***141 /******************************************************************************************* 141 142 * This function initializes a local vseg descriptor from values contained in a reference 142 143 * remote vseg descriptor. It does NOT register the vseg in the local VMM. 143 ******************************************************************************************* ***144 ******************************************************************************************* 144 145 * @ vseg : pointer on the vseg descriptor. 145 146 * @ ref_xp : extended pointer on the reference vseg descriptor. 146 ****************************************************************************************** ***/147 ******************************************************************************************/ 147 148 void vseg_init_from_ref( vseg_t * vseg, 148 149 xptr_t ref_xp ); 149 150 150 /******************************************************************************************* ***151 /******************************************************************************************* 151 152 * This function adds a vseg descriptor in the set of vsegs controlled by a given VMM, 152 153 * and updates the vmm field in the vseg descriptor. 153 154 * The lock protecting the vsegs list in VMM must be taken by the caller. 154 ******************************************************************************************* ***155 ******************************************************************************************* 155 156 * @ vmm : pointer on the VMM 156 157 * @ vseg : pointer on the vseg descriptor 157 ****************************************************************************************** ***/158 ******************************************************************************************/ 158 159 void vseg_attach( struct vmm_s * vmm, 159 160 vseg_t * vseg ); 160 161 161 /******************************************************************************************* ***162 /******************************************************************************************* 162 163 * This function removes a vseg descriptor from the set of vsegs controlled by a given VMM, 163 164 * and updates the vmm field in the vseg descriptor. No memory is released. 164 165 * The lock protecting the vsegs list in VMM must be taken by the caller. 165 ******************************************************************************************* ***166 ******************************************************************************************* 166 167 * @ vmm : pointer on the VMM 167 168 * @ vseg : pointer on the vseg descriptor 168 ****************************************************************************************** ***/169 ******************************************************************************************/ 169 170 void vseg_detach( struct vmm_s * vmm, 170 171 vseg_t * vseg );
Note: See TracChangeset
for help on using the changeset viewer.