Changeset 228 for soft/giet_vm/sys/common.c
- Timestamp:
- Feb 12, 2013, 6:33:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/common.c
r221 r228 17 17 18 18 /////////////////////////////////////////////////////////////////////////////////// 19 // 19 // Global variables 20 20 /////////////////////////////////////////////////////////////////////////////////// 21 21 … … 23 23 24 24 // SR save (used by _it_mask() / it_restore() 25 unsigned int 26 27 /////////////////////////////////////////////////////////////////////////////////// 28 // 25 unsigned int _status_register_save; 26 27 /////////////////////////////////////////////////////////////////////////////////// 28 // _get_sched() 29 29 // Access CP0 and returns scheduler physical address. 30 30 /////////////////////////////////////////////////////////////////////////////////// 31 inline unsigned int _get_sched() 32 { 33 unsigned int ret; 34 asm volatile ( "mfc0 %0, $22" 35 : "=r"(ret) ); 36 return ret; 37 } 38 /////////////////////////////////////////////////////////////////////////////////// 39 // _get_ptpr() 31 inline unsigned int _get_sched() { 32 unsigned int ret; 33 asm volatile( 34 "mfc0 %0, $22" 35 : "=r"(ret)); 36 return ret; 37 } 38 39 40 /////////////////////////////////////////////////////////////////////////////////// 41 // _get_ptpr() 40 42 // Access CP2 and returns PTPR register. 41 43 /////////////////////////////////////////////////////////////////////////////////// 42 inline unsigned int _get_ptpr() 43 { 44 unsigned int ret; 45 asm volatile ( "mfc2 %0, $0" 46 : "=r"(ret) ); 47 return ret; 48 } 49 /////////////////////////////////////////////////////////////////////////////////// 50 // _get_epc() 44 inline unsigned int _get_ptpr() { 45 unsigned int ret; 46 asm volatile( 47 "mfc2 %0, $0" 48 : "=r"(ret)); 49 return ret; 50 } 51 52 53 /////////////////////////////////////////////////////////////////////////////////// 54 // _get_epc() 51 55 // Access CP0 and returns EPC register. 52 56 /////////////////////////////////////////////////////////////////////////////////// 53 inline unsigned int _get_epc() 54 { 55 unsigned int ret; 56 asm volatile ( "mfc0 %0, $14" 57 : "=r"(ret) ); 58 return ret; 59 } 60 /////////////////////////////////////////////////////////////////////////////////// 61 // _get_bar() 57 inline unsigned int _get_epc() { 58 unsigned int ret; 59 asm volatile("mfc0 %0, $14" 60 : "=r"(ret)); 61 return ret; 62 } 63 64 65 /////////////////////////////////////////////////////////////////////////////////// 66 // _get_bar() 62 67 // Access CP0 and returns BAR register. 63 68 /////////////////////////////////////////////////////////////////////////////////// 64 inline unsigned int _get_bvar() 65 { 66 unsigned int ret; 67 asm volatile ( "mfc0 %0, $8" 68 : "=r"(ret) ); 69 return ret; 70 } 71 /////////////////////////////////////////////////////////////////////////////////// 72 // _get_cr() 69 inline unsigned int _get_bvar() { 70 unsigned int ret; 71 asm volatile( 72 "mfc0 %0, $8" 73 : "=r"(ret)); 74 return ret; 75 } 76 77 78 /////////////////////////////////////////////////////////////////////////////////// 79 // _get_cr() 73 80 // Access CP0 and returns CR register. 74 81 /////////////////////////////////////////////////////////////////////////////////// 75 inline unsigned int _get_cause() 76 { 77 unsigned int ret; 78 asm volatile ( "mfc0 %0, $13" 79 : "=r"(ret) ); 80 return ret; 81 } 82 /////////////////////////////////////////////////////////////////////////////////// 83 // _get_sr() 82 inline unsigned int _get_cause() { 83 unsigned int ret; 84 asm volatile("mfc0 %0, $13" 85 : "=r"(ret)); 86 return ret; 87 } 88 89 90 /////////////////////////////////////////////////////////////////////////////////// 91 // _get_sr() 84 92 // Access CP0 and returns SR register. 85 93 /////////////////////////////////////////////////////////////////////////////////// 86 inline unsigned int _get_sr() 87 { 88 unsigned int ret; 89 asm volatile ( "mfc0 %0, $12" 90 : "=r"(ret) ); 91 return ret; 92 } 94 inline unsigned int _get_sr() { 95 unsigned int ret; 96 asm volatile( 97 "mfc0 %0, $12" 98 : "=r"(ret)); 99 return ret; 100 } 101 93 102 /////////////////////////////////////////////////////////////////////////////////// 94 103 // _it_mask() 95 104 // Access CP0 and mask IRQs 96 105 /////////////////////////////////////////////////////////////////////////////////// 97 inline void _it_mask() 98 { 99 unsigned int sr_value; 100 asm volatile( "li $3, 0xFFFFFFFE \n" 101 "mfc0 %0, $12 \n" 102 "and $3, $3, %0 \n" 103 "mtc0 $3, $12 \n" 104 : "=r"(sr_value) : : "$3" ); 106 inline void _it_mask() { 107 unsigned int sr_value; 108 asm volatile( 109 "li $3, 0xFFFFFFFE \n" 110 "mfc0 %0, $12 \n" 111 "and $3, $3, %0 \n" 112 "mtc0 $3, $12 \n" 113 : "=r"(sr_value) 114 : 115 : "$3"); 105 116 _status_register_save = sr_value; 106 117 } 107 /////////////////////////////////////////////////////////////////////////////////// 108 // _it_enable() 118 119 120 /////////////////////////////////////////////////////////////////////////////////// 121 // _it_restore() 109 122 // Access CP0 and enable IRQs 110 123 /////////////////////////////////////////////////////////////////////////////////// 111 inline void _it_restore() 112 { 113 unsigned int sr_value = _status_register_save; 114 asm volatile( "mtc0 %0, $12 \n" 115 : : "r"(sr_value) ); 116 } 124 inline void _it_restore() { 125 unsigned int sr_value = _status_register_save; 126 asm volatile( 127 "mtc0 %0, $12 \n" 128 : 129 : "r"(sr_value)); 130 } 131 132 117 133 //////////////////////////////////////////////////////////////////////////// 118 134 // _get_lock() … … 121 137 // (delay average value = 100 cycles) 122 138 //////////////////////////////////////////////////////////////////////////// 123 inline void _get_lock( unsigned int* plock ) 124 { 125 register unsigned int delay = ( _proctime() ^ _procid()<<4 ) & 0xFF; 139 inline void _get_lock(unsigned int * plock) { 140 register unsigned int delay = ( _proctime() ^ _procid() << 4) & 0xFF; 126 141 127 142 asm volatile ( … … 144 159 } 145 160 161 146 162 //////////////////////////////////////////////////////////////////////////// 147 163 // _release_lock() 148 164 //////////////////////////////////////////////////////////////////////////// 149 inline void _release_lock( unsigned int* plock ) 150 { 165 inline void _release_lock(unsigned int * plock) { 151 166 asm volatile ( 152 "sync\n" /* necessary because of the consistency model in tsar */153 );167 "sync\n" /* necessary because of the consistency model in tsar */ 168 ); 154 169 *plock = 0; 155 170 } 171 156 172 157 173 //////////////////////////////////////////////////////////////////////////// … … 159 175 // display a string on TTY0 / used for system code debug and log 160 176 //////////////////////////////////////////////////////////////////////////// 161 void _puts(char* buffer) 162 { 163 unsigned int* tty_address = (unsigned int*) &seg_tty_base; 177 void _puts(char * buffer) { 178 unsigned int * tty_address = (unsigned int *) &seg_tty_base; 164 179 unsigned int n; 165 180 166 for ( n=0; n<100; n++) 167 { 168 if (buffer[n] == 0) break; 169 tty_address[TTY_WRITE] = (unsigned int)buffer[n]; 181 for (n = 0; n < 100; n++) { 182 if (buffer[n] == 0) { 183 break; 184 } 185 tty_address[TTY_WRITE] = (unsigned int) buffer[n]; 170 186 } 171 187 } 188 189 172 190 //////////////////////////////////////////////////////////////////////////// 173 191 // _putx() 174 192 // display an int (hexa) on TTY0 / used for system code debug and log 175 193 //////////////////////////////////////////////////////////////////////////// 176 void _putx(unsigned int val) 177 { 178 static const char HexaTab[] = "0123456789ABCDEF"; 179 char buf[11]; 180 unsigned int c; 181 182 buf[0] = '0'; 183 buf[1] = 'x'; 194 void _putx(unsigned int val) { 195 static const char HexaTab[] = "0123456789ABCDEF"; 196 char buf[11]; 197 unsigned int c; 198 199 buf[0] = '0'; 200 buf[1] = 'x'; 184 201 buf[10] = 0; 185 202 186 for ( c = 0 ; c < 8 ; c++ ) 187 { 188 buf[9-c] = HexaTab[val&0xF]; 203 for (c = 0; c < 8; c++) { 204 buf[9 - c] = HexaTab[val & 0xF]; 189 205 val = val >> 4; 190 206 } 191 207 _puts(buf); 192 208 } 209 210 193 211 //////////////////////////////////////////////////////////////////////////// 194 212 // _putd() 195 213 // display an int (decimal) on TTY0 / used for system code debug and log 196 214 //////////////////////////////////////////////////////////////////////////// 197 void _putd(unsigned int val) 198 { 199 static const char DecTab[] = "0123456789"; 200 char buf[11]; 201 unsigned int i; 202 unsigned int first; 215 void _putd(unsigned int val) { 216 static const char DecTab[] = "0123456789"; 217 char buf[11]; 218 unsigned int i; 219 unsigned int first; 203 220 204 221 buf[10] = 0; 205 222 206 for (i = 0; i < 10; i++) 207 { 208 if ((val != 0) || (i == 0)) 209 { 210 buf[9-i] = DecTab[val % 10]; 211 first = 9-i; 223 for (i = 0; i < 10; i++) { 224 if ((val != 0) || (i == 0)) { 225 buf[9 - i] = DecTab[val % 10]; 226 first = 9 - i; 212 227 } 213 else 214 { 228 else { 215 229 break; 216 230 } 217 231 val /= 10; 218 232 } 219 _puts( &buf[first] ); 220 } 233 _puts(&buf[first]); 234 } 235 236 221 237 //////////////////////////////////////////////////////////////////////////// 222 238 // _strncmp() 223 239 // compare two strings s1 & s2 (no more than n characters) 224 240 //////////////////////////////////////////////////////////////////////////// 225 unsigned int _strncmp(const char* s1, 226 const char* s2, 227 unsigned int n) 228 { 241 unsigned int _strncmp(const char * s1, const char * s2, unsigned int n) { 229 242 unsigned int i; 230 for ( i=0 ; i<n ; i++) 231 { 232 if ( s1[i] != s2[i] ) return 1; 233 if ( s1[i] == 0 ) break; 243 for (i = 0; i < n; i++) { 244 if (s1[i] != s2[i]) { 245 return 1; 246 } 247 if (s1[i] == 0) { 248 break; 249 } 234 250 } 235 251 return 0; 236 252 } 237 //////////////////////////////////////////////////////////////////////////// 238 // _dcache_buf_invalidate() 253 254 255 //////////////////////////////////////////////////////////////////////////// 256 // _dcache_buf_invalidate() 239 257 // Invalidate all data cache lines corresponding to a memory 240 258 // buffer (identified by an address and a size). 241 259 //////////////////////////////////////////////////////////////////////////// 242 void _dcache_buf_invalidate(const void *buffer, 243 unsigned int size) 244 { 260 void _dcache_buf_invalidate(const void * buffer, unsigned int size) { 245 261 unsigned int i; 246 262 unsigned int tmp; … … 248 264 249 265 // compute data cache line size based on config register (bits 12:10) 250 asm volatile("mfc0 %0, $16, 1" : "=r" (tmp));251 tmp = ((tmp >>10) & 0x7);266 asm volatile("mfc0 %0, $16, 1" : "=r" (tmp)); 267 tmp = ((tmp >> 10) & 0x7); 252 268 line_size = 2 << tmp; 253 269 254 270 // iterate on cache lines 255 for (i = 0; i < size; i += line_size) 256 { 271 for (i = 0; i < size; i += line_size) { 257 272 asm volatile( 258 273 " cache %0, %1" 259 ::"i" (0x11), "R" (*((unsigned char*)buffer+i)) 274 : 275 :"i" (0x11), "R" (*((unsigned char *) buffer + i)) 260 276 ); 261 277 } 262 278 } 279 280 263 281 //////////////////////////////////////////////////////////////////////////// 264 282 // _physical_read_access() … … 266 284 // after a temporary DTLB desactivation. 267 285 //////////////////////////////////////////////////////////////////////////// 268 unsigned int _physical_read_access(unsigned int* paddr) 269 { 286 unsigned int _physical_read_access(unsigned int * paddr) { 270 287 unsigned int value; 271 288 272 asm volatile( "li $3, 0xFFFFFFFE \n" 273 "mfc0 $2, $12 \n" /* $2 <= SR */ 274 "and $3, $3, $2 \n" 275 "mtc0 $3, $12 \n" /* interrupt masked */ 276 "li $3, 0xB \n" 277 "mtc2 $3, $1 \n" /* DTLB off */ 278 279 "lw %0, 0(%1) \n" /* entry <= *pslot */ 280 281 "li $3, 0xF \n" 282 "mtc2 $3, $1 \n" /* DTLB on */ 283 "mtc0 $2, $12 \n" /* restore SR */ 284 : "=r"(value) 285 : "r"(paddr) 286 : "$2", "$3" ); 289 asm volatile( 290 "li $3, 0xFFFFFFFE \n" 291 "mfc0 $2, $12 \n" /* $2 <= SR */ 292 "and $3, $3, $2 \n" 293 "mtc0 $3, $12 \n" /* interrupt masked */ 294 "li $3, 0xB \n" 295 "mtc2 $3, $1 \n" /* DTLB off */ 296 297 "lw %0, 0(%1) \n" /* entry <= *pslot */ 298 299 "li $3, 0xF \n" 300 "mtc2 $3, $1 \n" /* DTLB on */ 301 "mtc0 $2, $12 \n" /* restore SR */ 302 : "=r" (value) 303 : "r" (paddr) 304 : "$2", "$3"); 287 305 return value; 288 306 } 307 308 289 309 //////////////////////////////////////////////////////////////////////////// 290 310 // _physical_write_access() … … 292 312 // after a temporary DTLB desactivation. 293 313 //////////////////////////////////////////////////////////////////////////// 294 void _physical_write_access(unsigned int* paddr, unsigned int value) 295 { 296 asm volatile( "li $3, 0xFFFFFFFE \n" 297 "mfc0 $2, $12 \n" /* $26 <= SR */ 298 "and $3, $3, $2 \n" 299 "mtc0 $3, $12 \n" /* interrupt masked */ 300 "li $3, 0xB \n" 301 "mtc2 $3, $1 \n" /* DTLB off */ 302 303 "sw %0, 0(%1) \n" /* entry <= *pslot */ 304 305 "li $3, 0xF \n" 306 "mtc2 $3, $1 \n" /* DTLB on */ 307 "mtc0 $2, $12 \n" /* restore SR */ 308 : 309 : "r"(value), "r"(paddr) 310 : "$2", "$3" ); 311 } 314 void _physical_write_access(unsigned int * paddr, unsigned int value) { 315 asm volatile( 316 "li $3, 0xFFFFFFFE \n" 317 "mfc0 $2, $12 \n" /* $26 <= SR */ 318 "and $3, $3, $2 \n" 319 "mtc0 $3, $12 \n" /* interrupt masked */ 320 "li $3, 0xB \n" 321 "mtc2 $3, $1 \n" /* DTLB off */ 322 323 "sw %0, 0(%1) \n" /* entry <= *pslot */ 324 325 "li $3, 0xF \n" 326 "mtc2 $3, $1 \n" /* DTLB on */ 327 "mtc0 $2, $12 \n" /* restore SR */ 328 : 329 : "r" (value), "r" (paddr) 330 : "$2", "$3"); 331 } 332 333 312 334 //////////////////////////////////////////////////////////////////////////// 313 335 // _get_tasks_number() 314 336 // This function returns the number of tasks allocated to processor. 315 337 //////////////////////////////////////////////////////////////////////////// 316 unsigned int _get_tasks_number() 317 { 318 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 319 return _physical_read_access( &(psched->tasks) ); 320 } 338 unsigned int _get_tasks_number() { 339 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 340 return _physical_read_access(&(psched->tasks)); 341 } 342 343 321 344 //////////////////////////////////////////////////////////////////////////// 322 345 // _get_current_task_id() 323 346 // This function returns the index of the currently running task. 324 347 //////////////////////////////////////////////////////////////////////////// 325 unsigned int _get_current_task_id() 326 { 327 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 328 return _physical_read_access( &(psched->current) ); 329 } 348 unsigned int _get_current_task_id() { 349 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 350 return _physical_read_access(&(psched->current)); 351 } 352 353 330 354 //////////////////////////////////////////////////////////////////////////// 331 355 // _set_current_task_id() 332 356 // This function returns the index of the currently running task. 333 357 //////////////////////////////////////////////////////////////////////////// 334 void _set_current_task_id( unsigned int value ) 335 { 336 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 337 _physical_write_access( &(psched->current), value ); 338 } 358 void _set_current_task_id(unsigned int value) { 359 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 360 _physical_write_access(&(psched->current), value); 361 } 362 363 339 364 /////////////////////////////////////////////////////////////////////////////// 340 365 // _get_context_slot() 341 366 // This function returns a slot content for the task defined by task_id. 342 367 /////////////////////////////////////////////////////////////////////////////// 343 unsigned int _get_context_slot( unsigned int task_id,344 unsigned int slot_id )345 { 346 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 347 return _physical_read_access( &(psched->context[task_id][slot_id]) ); 348 } 368 unsigned int _get_context_slot(unsigned int task_id, unsigned int slot_id) { 369 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 370 return _physical_read_access(&(psched->context[task_id][slot_id])); 371 } 372 373 349 374 /////////////////////////////////////////////////////////////////////////////// 350 375 // _set_context_slot() … … 352 377 /////////////////////////////////////////////////////////////////////////////// 353 378 void _set_context_slot( unsigned int task_id, 354 unsigned int slot_id, 355 unsigned int value ) 356 { 357 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 358 _physical_write_access( &(psched->context[task_id][slot_id]), value ); 359 } 379 unsigned int slot_id, 380 unsigned int value) { 381 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 382 _physical_write_access(&(psched->context[task_id][slot_id]), value); 383 } 384 385 360 386 //////////////////////////////////////////////////////////////////////////////// 361 387 // _get_interrupt_vector_entry() 362 388 // This function returns the interrupt_vector entry defined by argument index. 363 389 //////////////////////////////////////////////////////////////////////////////// 364 unsigned int _get_interrupt_vector_entry( unsigned int index ) 390 unsigned int _get_interrupt_vector_entry(unsigned int index) { 391 static_scheduler_t * psched = (static_scheduler_t *) _get_sched(); 392 return _physical_read_access( &(psched->interrupt_vector[index])); 393 } 394 395 396 ///////////////////////////////////////////////////////////////////////////// 397 // access functions to mapping_info data structure 398 ///////////////////////////////////////////////////////////////////////////// 399 mapping_cluster_t * _get_cluster_base(mapping_header_t * header) { 400 return (mapping_cluster_t *) ((char *) header + 401 MAPPING_HEADER_SIZE); 402 } 403 404 405 ///////////////////////////////////////////////////////////////////////////// 406 mapping_pseg_t * _get_pseg_base(mapping_header_t * header) { 407 return (mapping_pseg_t *) ((char *) header + 408 MAPPING_HEADER_SIZE + 409 MAPPING_CLUSTER_SIZE * header->clusters); 410 } 411 ///////////////////////////////////////////////////////////////////////////// 412 mapping_vspace_t * _get_vspace_base(mapping_header_t * header) { 413 return (mapping_vspace_t *) ((char *) header + 414 MAPPING_HEADER_SIZE + 415 MAPPING_CLUSTER_SIZE * header->clusters + 416 MAPPING_PSEG_SIZE * header->psegs); 417 } 418 419 420 ///////////////////////////////////////////////////////////////////////////// 421 mapping_vseg_t * _get_vseg_base(mapping_header_t * header) 365 422 { 366 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 367 return _physical_read_access( &(psched->interrupt_vector[index]) ); 368 } 369 370 ///////////////////////////////////////////////////////////////////////////// 371 // access functions to mapping_info data structure 372 ///////////////////////////////////////////////////////////////////////////// 373 mapping_cluster_t* _get_cluster_base( mapping_header_t* header ) 374 { 375 return (mapping_cluster_t*) ((char*)header + 376 MAPPING_HEADER_SIZE); 377 } 378 ///////////////////////////////////////////////////////////////////////////// 379 mapping_pseg_t* _get_pseg_base( mapping_header_t* header ) 380 { 381 return (mapping_pseg_t*) ((char*)header + 382 MAPPING_HEADER_SIZE + 383 MAPPING_CLUSTER_SIZE*header->clusters); 384 } 385 ///////////////////////////////////////////////////////////////////////////// 386 mapping_vspace_t* _get_vspace_base( mapping_header_t* header ) 387 { 388 return (mapping_vspace_t*) ((char*)header + 389 MAPPING_HEADER_SIZE + 390 MAPPING_CLUSTER_SIZE*header->clusters + 391 MAPPING_PSEG_SIZE*header->psegs); 392 } 393 ///////////////////////////////////////////////////////////////////////////// 394 mapping_vseg_t* _get_vseg_base( mapping_header_t* header ) 395 { 396 return (mapping_vseg_t*) ((char*)header + 397 MAPPING_HEADER_SIZE + 398 MAPPING_CLUSTER_SIZE*header->clusters + 399 MAPPING_PSEG_SIZE*header->psegs + 400 MAPPING_VSPACE_SIZE*header->vspaces); 401 } 402 ///////////////////////////////////////////////////////////////////////////// 403 mapping_vobj_t* _get_vobj_base( mapping_header_t* header ) 404 { 405 return (mapping_vobj_t*) ((char*)header + 406 MAPPING_HEADER_SIZE + 407 MAPPING_CLUSTER_SIZE*header->clusters + 408 MAPPING_PSEG_SIZE*header->psegs + 409 MAPPING_VSPACE_SIZE*header->vspaces + 410 MAPPING_VSEG_SIZE*header->vsegs ); 411 } 412 ///////////////////////////////////////////////////////////////////////////// 413 mapping_task_t* _get_task_base( mapping_header_t* header ) 414 { 415 return (mapping_task_t*) ((char*)header + 416 MAPPING_HEADER_SIZE + 417 MAPPING_CLUSTER_SIZE*header->clusters + 418 MAPPING_PSEG_SIZE*header->psegs + 419 MAPPING_VSPACE_SIZE*header->vspaces + 420 MAPPING_VOBJ_SIZE*header->vobjs + 421 MAPPING_VSEG_SIZE*header->vsegs); 422 } 423 423 return (mapping_vseg_t *) ((char *) header + 424 MAPPING_HEADER_SIZE + 425 MAPPING_CLUSTER_SIZE * header->clusters + 426 MAPPING_PSEG_SIZE * header->psegs + 427 MAPPING_VSPACE_SIZE * header->vspaces); 428 } 429 430 431 ///////////////////////////////////////////////////////////////////////////// 432 mapping_vobj_t * _get_vobj_base(mapping_header_t * header) { 433 return (mapping_vobj_t *) ((char *) header + 434 MAPPING_HEADER_SIZE + 435 MAPPING_CLUSTER_SIZE * header->clusters + 436 MAPPING_PSEG_SIZE * header->psegs + 437 MAPPING_VSPACE_SIZE * header->vspaces + 438 MAPPING_VSEG_SIZE * header->vsegs ); 439 } 440 441 442 ///////////////////////////////////////////////////////////////////////////// 443 mapping_task_t * _get_task_base(mapping_header_t * header) { 444 return (mapping_task_t *) ((char *) header + 445 MAPPING_HEADER_SIZE + 446 MAPPING_CLUSTER_SIZE * header->clusters + 447 MAPPING_PSEG_SIZE * header->psegs + 448 MAPPING_VSPACE_SIZE * header->vspaces + 449 MAPPING_VOBJ_SIZE * header->vobjs + 450 MAPPING_VSEG_SIZE * header->vsegs); 451 } 452 453 454 // Local Variables: 455 // tab-width: 4 456 // c-basic-offset: 4 457 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 458 // indent-tabs-mode: nil 459 // End: 460 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 461
Note: See TracChangeset
for help on using the changeset viewer.