Changeset 407 for trunk/kernel/mm/vseg.c
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vseg.c
r406 r407 52 52 if ( vseg_type == VSEG_TYPE_CODE ) return "CODE"; 53 53 else if( vseg_type == VSEG_TYPE_DATA ) return "DATA"; 54 else if( vseg_type == VSEG_TYPE_HEAP ) return "HEAP"; 55 else if( vseg_type == VSEG_TYPE_STACK ) return "STACK"; 54 else if( vseg_type == VSEG_TYPE_STACK ) return "STAK"; 56 55 else if( vseg_type == VSEG_TYPE_ANON ) return "ANON"; 57 56 else if( vseg_type == VSEG_TYPE_FILE ) return "FILE"; 58 else if( vseg_type == VSEG_TYPE_REMOTE ) return "REMOTE"; 59 else if( vseg_type == VSEG_TYPE_KCODE ) return "KCODE"; 60 else if( vseg_type == VSEG_TYPE_KDATA ) return "KDATA"; 61 else if( vseg_type == VSEG_TYPE_KDEV ) return "KDEV"; 57 else if( vseg_type == VSEG_TYPE_REMOTE ) return "REMO"; 62 58 else return "undefined"; 63 59 } … … 87 83 /////////////////////////////////// 88 84 void vseg_init( vseg_t * vseg, 85 vseg_type_t type, 89 86 intptr_t base, 90 intptr_t size,87 uint32_t size, 91 88 vpn_t vpn_base, 92 89 vpn_t vpn_size, 93 uint32_t type, 90 uint32_t file_offset, 91 uint32_t file_size, 92 xptr_t mapper_xp, 94 93 cxy_t cxy ) 95 94 { 96 vseg->type = type; 97 vseg->min = base; 98 vseg->max = base + size; 99 vseg->vpn_base = vpn_base; 100 vseg->vpn_size = vpn_size; 101 vseg->mapper_xp = XPTR_NULL; 102 vseg->cxy = cxy; 95 vseg->type = type; 96 vseg->min = base; 97 vseg->max = base + size; 98 vseg->vpn_base = vpn_base; 99 vseg->vpn_size = vpn_size; 100 vseg->file_offset = file_offset; 101 vseg->file_size = file_size; 102 vseg->mapper_xp = mapper_xp; 103 vseg->cxy = cxy; 103 104 104 105 // set vseg flags depending on type … … 124 125 VSEG_DISTRIB ; 125 126 } 126 else if( type == VSEG_TYPE_HEAP )127 {128 vseg->flags = VSEG_USER |129 VSEG_WRITE |130 VSEG_CACHE |131 VSEG_DISTRIB ;132 }133 127 else if( type == VSEG_TYPE_REMOTE ) 134 128 { … … 141 135 vseg->flags = VSEG_USER | 142 136 VSEG_WRITE | 143 VSEG_CACHE | 144 VSEG_DISTRIB ; 137 VSEG_CACHE; 145 138 } 146 139 else if( type == VSEG_TYPE_FILE ) … … 161 154 VSEG_CACHE | 162 155 VSEG_PRIVATE ; 156 } 157 else if( type == VSEG_TYPE_KDEV ) 158 { 159 vseg->flags = VSEG_WRITE ; 163 160 } 164 161 else … … 171 168 ////////////////////////////////////////// 172 169 void vseg_init_from_ref( vseg_t * vseg, 173 xptr_t ref )170 xptr_t ref_xp ) 174 171 { 175 172 // get remote vseg cluster and pointer 176 cxy_t cxy = (cxy_t )GET_CXY( ref );177 vseg_t * ptr = (vseg_t *)GET_PTR( ref );173 cxy_t cxy = (cxy_t )GET_CXY( ref_xp ); 174 vseg_t * ptr = (vseg_t *)GET_PTR( ref_xp ); 178 175 179 176 // initialize vseg with remote_read access 180 vseg->type = hal_remote_lw ( XPTR( cxy , &ptr->type ) ); 181 vseg->min = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->min ) ); 182 vseg->max = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->max ) ); 183 vseg->vpn_base = hal_remote_lw ( XPTR( cxy , &ptr->vpn_base ) ); 184 vseg->vpn_size = hal_remote_lw ( XPTR( cxy , &ptr->vpn_size ) ); 185 vseg->flags = hal_remote_lw ( XPTR( cxy , &ptr->flags ) ); 186 vseg->mapper_xp = (xptr_t) hal_remote_lwd( XPTR( cxy , &ptr->mapper_xp ) ); 177 vseg->type = hal_remote_lw ( XPTR( cxy , &ptr->type ) ); 178 vseg->min = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->min ) ); 179 vseg->max = (intptr_t)hal_remote_lpt( XPTR( cxy , &ptr->max ) ); 180 vseg->vpn_base = hal_remote_lw ( XPTR( cxy , &ptr->vpn_base ) ); 181 vseg->vpn_size = hal_remote_lw ( XPTR( cxy , &ptr->vpn_size ) ); 182 vseg->flags = hal_remote_lw ( XPTR( cxy , &ptr->flags ) ); 183 vseg->file_offset = hal_remote_lw ( XPTR( cxy , &ptr->file_offset ) ); 184 vseg->file_size = hal_remote_lw ( XPTR( cxy , &ptr->file_size ) ); 185 vseg->mapper_xp = (xptr_t) hal_remote_lwd( XPTR( cxy , &ptr->mapper_xp ) ); 187 186 } 188 187
Note: See TracChangeset
for help on using the changeset viewer.