Changeset 165 for soft/giet_vm/xml
- Timestamp:
- Jul 4, 2012, 2:51:18 PM (13 years ago)
- Location:
- soft/giet_vm/xml
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/xml/mapping_info.h
r160 r165 57 57 enum 58 58 { 59 ELF = 0, //loadable code object60 PTAB, //page table61 PERI, //hardware component62 MWMR, //MWMR channel63 LOCK, //Lock64 BUFFER, //Any "no intialiasation needed" objects (stacks...)65 BARRIER //Barrier59 VOBJ_TYPE_ELF = 0, // loadable code object 60 VOBJ_TYPE_PTAB = 1, // page table 61 VOBJ_TYPE_PERI = 2, // hardware component 62 VOBJ_TYPE_MWMR = 3, // MWMR channel 63 VOBJ_TYPE_LOCK = 4, // Lock 64 VOBJ_TYPE_BUFFER = 5, // Any "no intialiasation needed" objects (stacks...) 65 VOBJ_TYPE_BARRIER = 6, // Barrier 66 66 }; 67 67 … … 74 74 unsigned int psegs; // number of psegs 75 75 unsigned int ttys; // number of TTY terminals 76 unsigned int fbs; // number of Frame Buffer DMA channels 76 77 unsigned int globals; // number of vsegs mapped in all vspaces 77 78 unsigned int vspaces; // number of virtual spaces 78 79 unsigned int vsegs; // total number of virtual segments (for all vspaces) 79 unsigned int vobjs; // total number of virtual memoryobjects (for all vspaces)80 unsigned int vobjs; // total number of virtual objects (for all vspaces) 80 81 unsigned int tasks; // total number of tasks (for all vspaces) 81 82 char name[32]; // mapping name … … 86 87 { 87 88 unsigned int procs; // number of processors in cluster 88 unsigned int timers; // number of timers in cluster89 unsigned int dmas; // number of DMA channels in cluster90 89 } mapping_cluster_t; 91 90 … … 103 102 { 104 103 char name[32]; // virtual space name 105 unsigned int funcs_offset; // offset of the vobj containing the function entry table (relative to vobj_offset) 106 unsigned int vsegs; // number of private virtual segments 107 unsigned int vobjs; // number of vobjs channels 108 unsigned int tasks; // number of tasks 109 unsigned int ttys; // number of required TTY terminals 104 unsigned int start_offset; // offset of the vobj containing the start vector 105 unsigned int vsegs; // number of vsegs in vspace 106 unsigned int vobjs; // number of vobjs in vspace 107 unsigned int tasks; // number of tasks in vspace 110 108 unsigned int vseg_offset; // index of first vseg in vspace 111 109 unsigned int vobj_offset; // index of first vobjs in vspace … … 121 119 unsigned int length; // size (bytes) 122 120 unsigned int psegid; // physical segment index 123 unsigned char mode; // C-X-W-U flags 124 unsigned char ident; // identity mapping if non zero 125 unsigned int vobjs; // number of vobjs channels 126 unsigned int vobj_offset; // index of first vobjs in vspace 127 unsigned char reserved; // unused 121 unsigned int mode; // C-X-W-U flags 122 unsigned int ident; // identity mapping if non zero 123 unsigned int vobjs; // number of vobjs in vseg 124 unsigned int vobj_offset; // index of first vobjs in vseg 128 125 } mapping_vseg_t; 129 126 … … 135 132 unsigned int proclocid; // processor local index (inside cluster) 136 133 unsigned int vobjlocid; // stack vobj index in vspace 137 unsigned int startid; // index in start_vector (in seg_data) 138 unsigned int ttylocid; // tty index (inside the vspace) 134 unsigned int startid; // index in start_vector 135 unsigned int use_tty; // TTY terminal required 136 unsigned int use_fb; // DMA channel to frame buffer required 139 137 } mapping_task_t; 140 138 … … 143 141 { 144 142 char name[32]; // vobj name (unique in a vspace) 145 char binpath[64]; // path for the binary code ("*. bin")143 char binpath[64]; // path for the binary code ("*.elf") 146 144 unsigned int type; // type of vobj 147 145 unsigned int length; // size (bytes) 148 146 unsigned int align; // required alignement (logarithm of 2) 149 unsigned int vaddr; // virtual addresse of the vobj location (bytes) 150 unsigned int paddr; // physical addresse of the vobj location (bytes) 147 unsigned int vaddr; // virtual base addresse of the vobj 148 unsigned int paddr; // physical base addresse of the vobj 149 unsigned int init; // init value (number of participants for a barrier) 151 150 } mapping_vobj_t; 152 151 -
soft/giet_vm/xml/xml_driver.c
r160 r165 111 111 fprintf( fpout, " psegs = \"%d\"\n", header->psegs); 112 112 fprintf( fpout, " ttys = \"%d\"\n", header->ttys); 113 fprintf( fpout, " fbs = \"%d\"\n", header->fbs); 113 114 fprintf( fpout, " vspaces = \"%d\"\n", header->vspaces); 114 fprintf( fpout, " globals = \"%d\" />\n\n", header->globals);115 fprintf( fpout, " globals = \"%d\" >\n\n", header->globals); 115 116 116 117 ///////////////////// clusters /////////////////////////////////////////////// … … 119 120 for ( cluster_id = 0 ; cluster_id < header->clusters ; cluster_id++ ) 120 121 { 121 fprintf( fpout, " <cluster procs = \"%d\"\n", cluster[cluster_id].procs); 122 fprintf( fpout, " timers = \"%d\"\n", cluster[cluster_id].timers); 123 fprintf( fpout, " dmas = \"%d\" />\n\n", cluster[cluster_id].dmas); 122 fprintf( fpout, " <cluster index = \"%d\"\n", cluster_id); 123 fprintf( fpout, " procs = \"%d\" />\n\n", cluster[cluster_id].procs); 124 124 } 125 125 fprintf( fpout, " </clusterset>\n" ); … … 148 148 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]); 149 149 fprintf( fpout, " psegname = \"%s\"\n", pseg[pseg_id].name); 150 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident); 151 for ( vobj_id = vseg[vseg_id].vobj_offset ; 152 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs) ; vobj_id++ ) 153 { 154 fprintf( fpout, " <vobj name = \"%s\"\n", vobj[vobj_id].name); 155 fprintf( fpout, " type = \"%s\" \n", vobj_type[vobj[vobj_id].type]); 156 if(vobj[vobj_id].length) 157 fprintf( fpout, " length = \"0x%x\" \n", vobj[vobj_id].length); 158 if(vobj[vobj_id].align) 159 fprintf( fpout, " align = \"%d\" \n", vobj[vobj_id].align); 160 if(vobj[vobj_id].binpath[0]!='\0') 161 fprintf( fpout, " binpath = \"%s\" \n", vobj[vobj_id].binpath); 162 fprintf( fpout, " />\n"); 163 } 164 fprintf( fpout, " </vseg>\n\n"); 150 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident); 151 for ( vobj_id = vseg[vseg_id].vobj_offset; 152 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs); 153 vobj_id++ ) 154 { 155 fprintf( fpout, " <vobj name = \"%s\"\n", vobj[vobj_id].name); 156 fprintf( fpout, " type = \"%s\"\n", vobj_type[vobj[vobj_id].type]); 157 fprintf( fpout, " length = \"0x%x\"\n", vobj[vobj_id].length); 158 fprintf( fpout, " align = \"%d\"\n", vobj[vobj_id].align); 159 fprintf( fpout, " init = \"%d\" \n", vobj[vobj_id].init); 160 fprintf( fpout, " binpath = \"%s\" />\n", vobj[vobj_id].binpath); 161 } 162 fprintf( fpout, " </vseg>\n\n"); 165 163 } 166 164 fprintf( fpout, " </globalset>\n" ); … … 171 169 for ( vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++ ) 172 170 { 173 unsigned int func_id = vspace[vspace_id].vobj_offset + vspace[vspace_id].funcs_offset; 174 fprintf( fpout, " <vspace name = \"%s\"\n", vspace[vspace_id].name); 175 fprintf( fpout, " funcs = \"%s\"\n", vobj[func_id].name); 176 fprintf( fpout, " ttys = \"%d\" >\n\n", vspace[vspace_id].ttys); 171 unsigned int func_id = vspace[vspace_id].vobj_offset + vspace[vspace_id].start_offset; 172 fprintf( fpout, " <vspace name = \"%s\"\n", vspace[vspace_id].name); 173 fprintf( fpout, " startname = \"%s\" >\n\n", vobj[func_id].name); 177 174 178 175 for ( vseg_id = vspace[vspace_id].vseg_offset ; … … 185 182 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]); 186 183 fprintf( fpout, " psegname = \"%s\"\n", pseg[pseg_id].name); 187 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident);184 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident); 188 185 189 186 for ( vobj_id = vseg[vseg_id].vobj_offset ; 190 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs) ; vobj_id++ ) 187 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs) ; 188 vobj_id++ ) 191 189 { 192 fprintf( fpout, "\t <vobj name = \"%s\"\n", vobj[vobj_id].name); 193 fprintf( fpout, "\t type = \"%s\" \n", vobj_type[vobj[vobj_id].type]); 194 if(vobj[vobj_id].length) 195 fprintf( fpout, "\t length = \"0x%x\" \n", vobj[vobj_id].length); 196 if(vobj[vobj_id].align) 197 fprintf( fpout, "\t align = \"%d\" \n", vobj[vobj_id].align); 198 if(vobj[vobj_id].binpath[0]!='\0') 199 fprintf( fpout, "\t binpath = \"%s\" \n", vobj[vobj_id].binpath); 200 fprintf( fpout, "\t />\n"); 190 fprintf( fpout, " <vobj name = \"%s\"\n", vobj[vobj_id].name); 191 fprintf( fpout, " type = \"%s\" \n", vobj_type[vobj[vobj_id].type]); 192 fprintf( fpout, " length = \"0x%x\" \n", vobj[vobj_id].length); 193 fprintf( fpout, " align = \"%d\" \n", vobj[vobj_id].align); 194 fprintf( fpout, " init = \"%d\" \n", vobj[vobj_id].init); 195 fprintf( fpout, " binpath = \"%s\" />\n", vobj[vobj_id].binpath); 201 196 } 202 fprintf( fpout, " \t\t</vseg>\n\n");197 fprintf( fpout, " </vseg>\n\n"); 203 198 } 204 199 for ( task_id = vspace[vspace_id].task_offset ; 205 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks) ; task_id++ ) 200 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks) ; 201 task_id++ ) 206 202 { 207 203 unsigned int vobj_id = task[task_id].vobjlocid + vspace[vspace_id].vobj_offset; … … 212 208 fprintf( fpout, " stackname = \"%s\"\n", vobj[vobj_id].name); 213 209 fprintf( fpout, " startid = \"%d\"\n", task[task_id].startid); 214 fprintf( fpout, " ttylocid = \"%d\" />\n\n", task[task_id].ttylocid); 210 fprintf( fpout, " usetty = \"%d\"\n", task[task_id].use_tty); 211 fprintf( fpout, " usefb = \"%d\" />\n\n", task[task_id].use_fb); 215 212 } 216 fprintf( fpout, " </vspace>\n ");213 fprintf( fpout, " </vspace>\n\n"); 217 214 } 218 215 fprintf( fpout, " </vspaceset>\n" ); -
soft/giet_vm/xml/xml_parser.c
r162 r165 52 52 unsigned int vobj_index = 0; 53 53 unsigned int vobj_loc_index = 0; 54 unsigned int vobj_loc_vspace_index = 0; 54 unsigned int vobj_count = 0; 55 56 unsigned int tty_index = 1; 57 unsigned int fb_index = 0; 55 58 56 char one_elf_found = 0;//bool: wether a first vobj of type elf was found57 58 59 ////////////////////////////////////////////////// 59 60 unsigned int getIntValue( xmlTextReaderPtr reader, … … 144 145 unsigned int vobj_id; 145 146 unsigned int vobj_min = vspace[vspace_id]->vobj_offset; 146 unsigned int vobj_max = vobj_min + vobj_loc_ vspace_index;147 unsigned int vobj_max = vobj_min + vobj_loc_index; 147 148 148 149 for ( vobj_id = vobj_min ; vobj_id < vobj_max ; vobj_id++ ) … … 199 200 printf(" clusterid = %x\n", value); 200 201 #endif 202 if ( value >= header->clusters ) 203 { 204 printf("[XML ERROR] <clusterid> too large for task (%d,%d)\n", 205 vspace_index, task_loc_index); 206 exit(1); 207 } 201 208 task[task_index]->clusterid = value; 202 209 } … … 215 222 printf(" proclocid = %x\n", value); 216 223 #endif 224 if ( value >= cluster[task[task_index]->clusterid]->procs ) 225 { 226 printf("[XML ERROR] <proclocid> too large for task (%d,%d)\n", 227 vspace_index, task_loc_index); 228 exit(1); 229 } 217 230 task[task_index]->proclocid = value; 218 231 } … … 233 246 #if XML_PARSER_DEBUG 234 247 printf(" stackname = %s\n", str); 235 printf(" vsegid= %d\n", index);248 printf(" stackid = %d\n", index); 236 249 #endif 237 250 task[task_index]->vobjlocid = index; … … 239 252 else 240 253 { 241 printf("[XML ERROR] illegal or missing < psegname> for vseg %d\n",242 vseg_loc_index);254 printf("[XML ERROR] illegal or missing <stackname> for task (%d,%d)\n", 255 vspace_index, task_loc_index); 243 256 exit(1); 244 257 } … … 246 259 else 247 260 { 248 printf("[XML ERROR] illegal or missing < vsegname> for task (%d,%d)\n",261 printf("[XML ERROR] illegal or missing <stackname> for task (%d,%d)\n", 249 262 vspace_index, task_loc_index); 250 263 exit(1); … … 267 280 } 268 281 269 /////////// get ttylocid attribute270 value = getIntValue(reader," ttylocid", &ok);271 if ( ok ) 272 { 273 #if XML_PARSER_DEBUG 274 printf(" ttylocid= %x\n", value);275 #endif 276 if ( value >= vspace[vspace_index]->ttys)277 { 278 printf("[XML ERROR] The tty locid valueis too large for task (%d,%d)\n",282 /////////// get use_tty attribute (optionnal : 0 if missing) 283 value = getIntValue(reader,"usetty", &ok); 284 if ( ok ) 285 { 286 #if XML_PARSER_DEBUG 287 printf(" usetty = %x\n", value); 288 #endif 289 if ( (value != 0) && (tty_index >= header->ttys) ) 290 { 291 printf("[XML ERROR] The tty index is too large for task (%d,%d)\n", 279 292 vspace_index, task_loc_index); 280 293 exit(1); 281 294 } 282 task[task_index]->ttylocid = value; 295 task[task_index]->use_tty = value; 296 if (value != 0) tty_index++; 283 297 } 284 298 else 285 299 { 286 printf("[XML ERROR] illegal or missing <ttylocid> attribute for task (%d,%d)\n", 300 task[task_index]->use_tty = 0; 301 } 302 303 /////////// get use_fb attribute (optionnal : 0 if missing) 304 value = getIntValue(reader,"usefb", &ok); 305 if ( ok ) 306 { 307 #if XML_PARSER_DEBUG 308 printf(" usefb = %x\n", value); 309 #endif 310 if ( (value != 0) && (fb_index >= header->fbs) ) 311 { 312 printf("[XML ERROR] The fb channel index is too large for task (%d,%d)\n", 287 313 vspace_index, task_loc_index); 288 exit(1); 314 exit(1); 315 } 316 task[task_index]->use_fb = value; 317 if (value != 0) fb_index++; 318 } 319 else 320 { 321 task[task_index]->use_fb = 0; 289 322 } 290 323 … … 293 326 } // end taskNode() 294 327 328 ////////////////////////////////////////// 295 329 void vobjNode ( xmlTextReaderPtr reader ) 296 330 { … … 307 341 } 308 342 309 if(one_elf_found != 0) 310 { 311 printf("[XML ERROR] a vobj of the type ELF must be defined alone in a vseg (%d,%d)\n", 312 vspace_index, vobj_loc_vspace_index); 313 exit(1); 314 315 } 316 317 #if XML_PARSER_DEBUG 318 printf(" vobj %d\n", vobj_loc_index); 343 #if XML_PARSER_DEBUG 344 printf(" vobj %d\n", vobj_loc_index); 319 345 #endif 320 346 … … 326 352 { 327 353 #if XML_PARSER_DEBUG 328 printf(" name = %s\n", str);354 printf(" name = %s\n", str); 329 355 #endif 330 356 strncpy( vobj[vobj_index]->name, str, 31); … … 337 363 } 338 364 339 340 // get type attribute 365 //////// get type attribute 341 366 str = getStringValue(reader, "type", &ok); 342 367 #if XML_PARSER_DEBUG 343 printf(" type = %s\n", str); 344 #endif 345 if (ok && (strcmp(str, "ELF") == 0)){ 346 vobj[vobj_index]->type = ELF; 347 one_elf_found = 1; 348 if(vobj_loc_index != 0) //check that this vobj is the first 349 { 350 printf("[XML ERROR] a vobj of the type ELF must be defined alone in a vobj (%d,%d)\n", 351 vspace_index, vobj_loc_vspace_index); 352 exit(1); 353 354 } 355 } 356 else if (ok && (strcmp(str, "PTAB") == 0)) vobj[vobj_index]->type = PTAB; 357 else if (ok && (strcmp(str, "PERI") == 0)) vobj[vobj_index]->type = PERI; 358 else if (ok && (strcmp(str, "MWMR") == 0)) vobj[vobj_index]->type = MWMR; 359 else if (ok && (strcmp(str, "LOCK") == 0)) vobj[vobj_index]->type = LOCK; 360 else if (ok && (strcmp(str, "BUFFER") == 0)) vobj[vobj_index]->type = BUFFER; 361 else if (ok && (strcmp(str, "BARRIER") == 0)) vobj[vobj_index]->type = BARRIER; 368 printf(" type = %s\n", str); 369 #endif 370 if (ok && (strcmp(str, "ELF") == 0)) 371 { 372 vobj[vobj_index]->type = VOBJ_TYPE_ELF; 373 374 //check that this vobj is the first in vseg 375 if(vobj_count != 0) 376 { 377 printf("[XML ERROR] an ELF vobj must be alone in a vseg (%d,%d)\n", 378 vspace_index, vobj_loc_index); 379 exit(1); 380 } 381 } 382 else if (ok && (strcmp(str, "PTAB") == 0)) vobj[vobj_index]->type = VOBJ_TYPE_PTAB; 383 else if (ok && (strcmp(str, "PERI") == 0)) vobj[vobj_index]->type = VOBJ_TYPE_PERI; 384 else if (ok && (strcmp(str, "MWMR") == 0)) vobj[vobj_index]->type = VOBJ_TYPE_MWMR; 385 else if (ok && (strcmp(str, "LOCK") == 0)) vobj[vobj_index]->type = VOBJ_TYPE_LOCK; 386 else if (ok && (strcmp(str, "BUFFER") == 0)) vobj[vobj_index]->type = VOBJ_TYPE_BUFFER; 387 else if (ok && (strcmp(str, "BARRIER") == 0)) vobj[vobj_index]->type = VOBJ_TYPE_BARRIER; 362 388 else 363 389 { 364 390 printf("[XML ERROR] illegal or missing <type> attribute for vobj (%d,%d)\n", 365 vspace_index, vobj_loc_vspace_index); 366 exit(1); 367 } 368 369 370 ////////// get length attribute (0 if missing) 391 vspace_index, vobj_loc_index); 392 exit(1); 393 } 394 395 ////////// get length attribute 371 396 value = getIntValue(reader,"length", &ok); 372 397 if ( ok ) 373 398 { 374 399 #if XML_PARSER_DEBUG 375 printf(" length = %d\n", value);400 printf(" length = %d\n", value); 376 401 #endif 377 402 vobj[vobj_index]->length = value; … … 379 404 else 380 405 { 381 vobj[vobj_index]->length = 0; 382 } 383 384 ////////// get align attribute (0 if missing) 406 printf("[XML ERROR] illegal or missing <length> attribute for vobj (%d,%d)\n", 407 vspace_index, vobj_loc_index); 408 exit(1); 409 } 410 411 ////////// get align attribute (optional : 0 if missing) 385 412 value = getIntValue(reader,"align", &ok); 386 413 if ( ok ) 387 414 { 388 415 #if XML_PARSER_DEBUG 389 printf(" align = %d\n", value);416 printf(" align = %d\n", value); 390 417 #endif 391 418 vobj[vobj_index]->align = value; … … 396 423 } 397 424 398 ////////// get binpath attribute ( '\0' if missing)425 ////////// get binpath attribute (optional : '\0' if missing) 399 426 str = getStringValue(reader, "binpath", &ok); 400 427 if ( ok ) 401 428 { 402 429 #if XML_PARSER_DEBUG 403 printf(" binpath = %s\n", str);430 printf(" binpath = %s\n", str); 404 431 #endif 405 432 strncpy(vobj[vobj_index]->binpath, str, 63); … … 410 437 } 411 438 439 ////////// get init attribute (optional : 0 if missing) 440 value = getIntValue(reader,"init", &ok); 441 if ( ok ) 442 { 443 #if XML_PARSER_DEBUG 444 printf(" init = %d\n", value); 445 #endif 446 vobj[vobj_index]->init = value; 447 } 448 else 449 { 450 vobj[vobj_index]->init = 0; 451 } 452 412 453 vobj_index++; 454 vobj_count++; 413 455 vobj_loc_index++; 414 vobj_loc_vspace_index++; 415 } 416 417 418 /////////////////////////////////////////////////////////////// 456 } // end vobjNode() 457 458 ////////////////////////////////////////// 419 459 void vsegNode ( xmlTextReaderPtr reader ) 420 460 { … … 422 462 unsigned int value; 423 463 char* str; 424 vobj_loc_index = 0; 425 one_elf_found= 0;464 465 vobj_count = 0; 426 466 427 467 if ( xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT ) return; … … 442 482 vseg[vseg_index]->vobj_offset = vobj_index; 443 483 #if XML_PARSER_DEBUG 444 printf(" -vobj_offset = %d\n", vobj_index);484 printf(" vobj_offset = %d\n", vobj_index); 445 485 #endif 446 486 … … 477 517 } 478 518 479 480 ////////// get ident attribute (0 if missing) 519 ////////// get ident attribute (optional : 0 if missing) 481 520 value = getIntValue(reader,"ident", &ok); 482 521 if ( ok ) … … 492 531 } 493 532 494 495 533 ////////// get psegname attribute 496 534 str = getStringValue(reader,"psegname", &ok); … … 520 558 } 521 559 522 // get mode attribute560 //////// get mode attribute 523 561 str = getStringValue(reader,"mode", &ok); 524 562 #if XML_PARSER_DEBUG … … 548 586 } 549 587 550 551 588 ////////// set the length attribute to 0 552 //the final value will be set by the VLoader553 589 vseg[vseg_index]->length = value; 554 590 … … 564 600 { 565 601 // checking source file consistency? 566 vseg[vseg_index]->vobjs = vobj_ loc_index;602 vseg[vseg_index]->vobjs = vobj_count; 567 603 vseg_index++; 568 604 vseg_loc_index++; … … 576 612 status = xmlTextReaderRead ( reader ); 577 613 } 578 579 580 614 } // end vsegNode() 581 615 … … 585 619 char* str; 586 620 unsigned int ok; 587 unsigned int value; 588 vobj_loc_ vspace_index = 0;621 622 vobj_loc_index = 0; 589 623 vseg_loc_index = 0; 590 624 task_loc_index = 0; … … 601 635 602 636 #if XML_PARSER_DEBUG 603 printf(" vspace %d\n", vspace_index);637 printf("\n vspace %d\n", vspace_index); 604 638 #endif 605 639 606 640 vspace[vspace_index] = (mapping_vspace_t*)malloc(sizeof(mapping_vspace_t)); 607 641 608 ////////// set vseg_offsetand task_offset attributes 642 ////////// get name attribute 643 str = getStringValue(reader, "name", &ok); 644 if ( ok ) 645 { 646 #if XML_PARSER_DEBUG 647 printf(" name = %s\n", str); 648 #endif 649 strncpy(vspace[vspace_index]->name, str, 31); 650 } 651 else 652 { 653 printf("[XML ERROR] illegal or missing <name> attribute for vspace %d\n", 654 vspace_index); 655 exit(1); 656 } 657 658 ////////// set vseg_offset and task_offset attributes 609 659 vspace[vspace_index]->vseg_offset = vseg_index; 610 660 vspace[vspace_index]->vobj_offset = vobj_index; … … 612 662 613 663 #if XML_PARSER_DEBUG 614 printf("- vseg_offset = %d\n", vseg_index); 615 printf("- vobj_offset = %d\n", vobj_index); 616 printf("- task_offset = %d\n", task_index); 617 #endif 618 619 ////////// get name attribute 620 str = getStringValue(reader, "name", &ok); 621 if ( ok ) 622 { 623 #if XML_PARSER_DEBUG 624 printf(" name = %s\n", str); 625 #endif 626 strncpy(vspace[vspace_index]->name, str, 31); 627 } 628 else 629 { 630 printf("[XML ERROR] illegal or missing <name> attribute for vspace %d", 664 printf(" vseg_offset = %d\n", vseg_index); 665 printf(" vobj_offset = %d\n", vobj_index); 666 printf(" task_offset = %d\n", task_index); 667 #endif 668 669 ////////// get startname attribute 670 str = getStringValue(reader, "startname", &ok); 671 if ( ok ) 672 { 673 //used after parsing the vobjs 674 } 675 else 676 { 677 printf("[XML ERROR] illegal or missing <startname> attribute for vspace %d\n", 631 678 vspace_index); 632 exit(1);633 }634 635 ////////// get funcs_entry attribute636 str = getStringValue(reader, "funcs", &ok);637 if ( ok )638 {639 #if XML_PARSER_DEBUG640 printf(" name = %s\n", str);641 #endif642 //used after parsing all the vobjs643 }644 else645 {646 printf("[XML ERROR] illegal or missing <name> attribute for vspace %d",647 vspace_index);648 exit(1);649 }650 651 // get ttys attribute652 value = getIntValue(reader,"ttys", &ok);653 #if XML_PARSER_DEBUG654 printf(" ttys = %d\n", value);655 #endif656 if ( ok )657 {658 vspace[vspace_index]->ttys = value;659 }660 else661 {662 printf("[XML ERROR] illegal or missing <ttys> attribute for vspace %d",663 vspace_index);664 679 exit(1); 665 680 } … … 675 690 else if ( strcmp(tag,"vspace") == 0 ) 676 691 { 677 vspace[vspace_index]->vobjs = vobj_loc_ vspace_index;692 vspace[vspace_index]->vobjs = vobj_loc_index; 678 693 vspace[vspace_index]->tasks = task_loc_index ; 679 694 vspace[vspace_index]->vsegs = vseg_loc_index ; 695 696 // get index of the vobj containing the start vector 680 697 int index = getVobjLocId( vspace_index, str ); 681 698 if(index == -1) 682 699 { 683 printf(" Error funcs entry vobjnot found %s\n",str);700 printf("[XML ERROR] vobj containing the start vector not found %s\n",str); 684 701 exit(-1); 685 702 } 686 vspace[vspace_index]->funcs_offset = index; 703 else 704 { 705 vspace[vspace_index]->start_offset = index; 706 #if XML_PARSER_DEBUG 707 printf(" startname = %s\n", str); 708 printf(" startid = %d\n", index); 709 #endif 710 } 711 712 // checking startid values for all tasks in vspace 713 int task_id; 714 int task_min = vspace[vspace_index]->task_offset; 715 int task_max = task_min + vspace[vspace_index]->tasks; 716 for ( task_id = task_min ; task_id < task_max ; task_id++ ) 717 { 718 if ( task[task_id]->startid >= vspace[vspace_index]->tasks ) 719 { 720 printf("[XML ERROR] <startid> too large for task (%d,%d)\n", 721 vspace_index, task_id ); 722 exit(1); 723 } 724 } 687 725 688 726 vspace_index++; … … 722 760 str = getStringValue( reader, "name", &ok ); 723 761 #if XML_PARSER_DEBUG 724 printf(" -name = %s\n", str);762 printf(" name = %s\n", str); 725 763 #endif 726 764 if ( ok ) … … 737 775 value = getIntValue( reader, "base", &ok ); 738 776 #if XML_PARSER_DEBUG 739 printf(" -base = %x\n", value);777 printf(" base = %x\n", value); 740 778 #endif 741 779 if ( ok ) … … 752 790 value = getIntValue( reader, "length", &ok ); 753 791 #if XML_PARSER_DEBUG 754 printf(" -length = %x\n\n", value);792 printf(" length = %x\n\n", value); 755 793 #endif 756 794 if ( ok ) … … 789 827 cluster[cluster_index] = (mapping_cluster_t*)malloc(sizeof(mapping_cluster_t)); 790 828 829 // get index attribute (optional) 830 value = getIntValue(reader,"index",&ok); 831 #if XML_PARSER_DEBUG 832 printf(" index = %d\n", value); 833 #endif 834 if ( ok && (value != cluster_index) ) 835 { 836 printf("[XML ERROR] wrong cluster index / expected value is %d", 837 cluster_index); 838 exit(1); 839 } 840 791 841 // get procs attribute 792 842 value = getIntValue(reader,"procs",&ok); 793 843 #if XML_PARSER_DEBUG 794 printf(" -procs = %d\n", value);844 printf(" procs = %d\n", value); 795 845 #endif 796 846 if ( ok ) … … 805 855 } 806 856 807 // get timers attribute808 value = getIntValue(reader,"timers",&ok);809 #if XML_PARSER_DEBUG810 printf(" - timers = %d\n", value);811 #endif812 if ( ok )813 {814 cluster[cluster_index]->timers = value;815 }816 else817 {818 printf("[XML ERROR] illegal or missing <timers> attribute for cluster %d",819 cluster_index);820 exit(1);821 }822 823 // get dmas attribute824 value = getIntValue(reader,"dmas",&ok);825 #if XML_PARSER_DEBUG826 printf(" - dmas = %d\n\n", value);827 #endif828 if ( ok )829 {830 cluster[cluster_index]->dmas = value;831 }832 else833 {834 printf("[XML ERROR] illegal or missing <dmas> attribute for cluster %d",835 cluster_index);836 exit(1);837 }838 839 857 cluster_index++; 840 858 } // end clusterNode() … … 846 864 847 865 #if XML_PARSER_DEBUG 848 printf(" clusters set\n");866 printf("\n clusters set\n"); 849 867 #endif 850 868 … … 922 940 923 941 #if XML_PARSER_DEBUG 924 printf(" global vsegs set\n");942 printf(" globals set\n"); 925 943 #endif 926 944 … … 961 979 962 980 #if XML_PARSER_DEBUG 963 printf(" vspaces set\n");981 printf("\n vspaces set\n"); 964 982 #endif 965 983 … … 1011 1029 header = (mapping_header_t*)malloc(sizeof(mapping_header_t)); 1012 1030 1013 // get name attribute1031 ////////// get name attribute 1014 1032 name = getStringValue(reader, "name", &ok); 1015 1033 if ( ok ) 1016 1034 { 1017 1035 #if XML_PARSER_DEBUG 1018 printf(" -name = %s\n", name);1036 printf(" name = %s\n", name); 1019 1037 #endif 1020 1038 strncpy( header->name, name, 31); … … 1026 1044 } 1027 1045 1028 // get clusters attribute1046 /////////// get clusters attribute 1029 1047 value = getIntValue(reader, "clusters", &ok); 1030 1048 if ( ok ) … … 1036 1054 } 1037 1055 #if XML_PARSER_DEBUG 1038 printf(" -clusters = %d\n", value);1056 printf(" clusters = %d\n", value); 1039 1057 #endif 1040 1058 header->clusters = value; … … 1046 1064 } 1047 1065 1048 // get psegs attribute1066 ////////// get psegs attribute 1049 1067 value = getIntValue(reader, "psegs", &ok); 1050 1068 if ( ok ) … … 1056 1074 } 1057 1075 #if XML_PARSER_DEBUG 1058 printf(" -psegs = %d\n", value);1076 printf(" psegs = %d\n", value); 1059 1077 #endif 1060 1078 header->psegs = value; … … 1066 1084 } 1067 1085 1068 // get ttys attribute1086 ///////// get ttys attribute 1069 1087 value = getIntValue(reader, "ttys", &ok); 1070 1088 if ( ok ) 1071 1089 { 1072 1090 #if XML_PARSER_DEBUG 1073 printf(" -ttys = %d\n", value);1091 printf(" ttys = %d\n", value); 1074 1092 #endif 1075 1093 header->ttys = value; … … 1081 1099 } 1082 1100 1083 // get vspaces attribute 1101 ///////// get fbs attribute 1102 value = getIntValue(reader, "fbs", &ok); 1103 if ( ok ) 1104 { 1105 #if XML_PARSER_DEBUG 1106 printf(" fbs = %d\n", value); 1107 #endif 1108 header->fbs = value; 1109 } 1110 else 1111 { 1112 printf("[XML ERROR] illegal or missing <fbs> attribute in header\n"); 1113 exit(1); 1114 } 1115 1116 ///////// get vspaces attribute 1084 1117 value = getIntValue(reader, "vspaces", &ok); 1085 1118 if ( ok ) … … 1091 1124 } 1092 1125 #if XML_PARSER_DEBUG 1093 printf(" -vspaces = %d\n", value);1126 printf(" vspaces = %d\n", value); 1094 1127 #endif 1095 1128 header->vspaces = value; … … 1101 1134 } 1102 1135 1103 // get globals attribute1136 ////////// get globals attribute 1104 1137 value = getIntValue(reader, "globals", &ok); 1105 1138 if ( ok ) … … 1111 1144 } 1112 1145 #if XML_PARSER_DEBUG 1113 printf(" -globals = %d\n", value);1146 printf(" globals = %d\n", value); 1114 1147 #endif 1115 1148 header->globals = value;
Note: See TracChangeset
for help on using the changeset viewer.