Changeset 160 for soft/giet_vm/xml
- Timestamp:
- Jun 12, 2012, 4:21:27 PM (13 years ago)
- Location:
- soft/giet_vm/xml
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/xml/Makefile
r158 r160 8 8 gcc -Wall -I. -I/usr/include/libxml2 xml_parser.c -o xml2bin -lxml2 9 9 10 test: 11 ./xml2bin map.xml test.bin 12 ./bin2xml test.bin test.xml 13 14 up_test: 15 ./xml2bin ../map.xml ../test.bin 16 ./bin2xml ../test.bin ../test.xml 17 18 10 19 clean: 11 20 rm xml2bin bin2xml -
soft/giet_vm/xml/mapping_info.h
r158 r160 18 18 // - mapping_vspace_t vspace[vspaces] (MAPPING_VSPACE_SIZE * vspaces) 19 19 // - mapping_vseg_t vseg[vsegs] (MAPPING_VSEG_SIZE * vsegs) 20 // - mapping_vseg_t vobj[vsegs] (MAPPING_VOBJ_SIZE * vsegs) 20 21 // - mapping_task_t task[tasks] (MAPPING_TASK_SIZE * tasks) 21 // - mapping_mwmr_t mwmr[mwmrs] (MAPPING_MWMR_SIZE * mwmrs)22 22 // 23 23 // The number of clusters and the number of vspaces are defined in the header. … … 43 43 #define MAPPING_VSPACE_SIZE sizeof(mapping_vspace_t) 44 44 #define MAPPING_VSEG_SIZE sizeof(mapping_vseg_t) 45 #define MAPPING_VOBJ_SIZE sizeof(mapping_vobj_t) 45 46 #define MAPPING_PSEG_SIZE sizeof(mapping_pseg_t) 46 47 #define MAPPING_TASK_SIZE sizeof(mapping_task_t) … … 54 55 #define OUT_MAPPING_SIGNATURE 0xBABEF00D 55 56 57 enum 58 { 59 ELF = 0, //loadable code object 60 PTAB, //page table 61 PERI, //hardware component 62 MWMR, //MWMR channel 63 LOCK, //Lock 64 BUFFER, //Any "no intialiasation needed" objects (stacks...) 65 BARRIER //Barrier 66 }; 67 68 56 69 /////////////////////////////// 57 70 typedef struct mapping_header_s … … 63 76 unsigned int globals; // number of vsegs mapped in all vspaces 64 77 unsigned int vspaces; // number of virtual spaces 65 unsigned int vsegs; // total number of virtual segments (for all vspaces 78 unsigned int vsegs; // total number of virtual segments (for all vspaces) 79 unsigned int vobjs; // total number of virtual memory objects (for all vspaces) 66 80 unsigned int tasks; // total number of tasks (for all vspaces) 67 81 char name[32]; // mapping name 68 char syspath[64]; // path for the system binary code ("sys.bin")69 82 } mapping_header_t; 70 83 … … 90 103 { 91 104 char name[32]; // virtual space name 92 char binpath[64]; // pathname to the binary code ("app.bin")105 unsigned int funcs_offset; // offset of the vobj containing the function entry table (relative to vobj_offset) 93 106 unsigned int vsegs; // number of private virtual segments 107 unsigned int vobjs; // number of vobjs channels 94 108 unsigned int tasks; // number of tasks 95 unsigned int mwmrs; // number of mwmr channels96 109 unsigned int ttys; // number of required TTY terminals 97 110 unsigned int vseg_offset; // index of first vseg in vspace 111 unsigned int vobj_offset; // index of first vobjs in vspace 98 112 unsigned int task_offset; // index of first task in vspace 99 unsigned int mwmr_offset; // index of first mwmr in vspace100 113 } mapping_vspace_t; 101 114 … … 110 123 unsigned char mode; // C-X-W-U flags 111 124 unsigned char ident; // identity mapping if non zero 112 unsigned char mwmr; // mwmr channel if non zero 125 unsigned int vobjs; // number of vobjs channels 126 unsigned int vobj_offset; // index of first vobjs in vspace 113 127 unsigned char reserved; // unused 114 128 } mapping_vseg_t; … … 120 134 unsigned int clusterid; // physical cluster index 121 135 unsigned int proclocid; // processor local index (inside cluster) 122 unsigned int v seglocid; // stack vsegindex in vspace136 unsigned int vobjlocid; // stack vobj index in vspace 123 137 unsigned int startid; // index in start_vector (in seg_data) 124 138 unsigned int ttylocid; // tty index (inside the vspace) 125 139 } mapping_task_t; 140 141 ///////////////////////////// 142 typedef struct mapping_vobj_s 143 { 144 char name[32]; // vobj name (unique in a vspace) 145 char binpath[64]; // path for the binary code ("*.bin") 146 unsigned int type; // type of vobj 147 unsigned int length; // size (bytes) 148 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) 151 } mapping_vobj_t; 126 152 127 153 #endif -
soft/giet_vm/xml/xml_driver.c
r158 r160 20 20 void buildXml( mapping_header_t* header, FILE* fpout) 21 21 { 22 23 const char* 24 vobj_type[] = 25 { 26 "ELF", 27 "PTAB", //page table 28 "PERI", //hardware component 29 "MWMR", //MWMR channel 30 "LOCK", //Lock 31 "BUFFER", //Any "no intialiasation needed" objects (stacks...) 32 "BARRIER" //Barrier 33 }; 22 34 const char* mode_str[] = { "____", 23 35 "___U", … … 41 53 unsigned int pseg_id; 42 54 unsigned int vseg_id; 55 unsigned int vobj_id; 43 56 unsigned int task_id; 44 57 … … 47 60 mapping_vspace_t* vspace; 48 61 mapping_vseg_t* vseg; 62 mapping_vobj_t* vobj; 49 63 mapping_task_t* task; 50 64 … … 71 85 MAPPING_VSPACE_SIZE*header->vspaces ); 72 86 87 // computes the base adresss for vobjs array, 88 vobj = (mapping_vobj_t*) ((char*)header + 89 MAPPING_HEADER_SIZE + 90 MAPPING_CLUSTER_SIZE*header->clusters + 91 MAPPING_PSEG_SIZE*header->psegs + 92 MAPPING_VSPACE_SIZE*header->vspaces + 93 MAPPING_VSEG_SIZE*header->vsegs ); 94 73 95 // computes the base address for tasks array 74 96 task = (mapping_task_t*) ((char*)header + … … 77 99 MAPPING_PSEG_SIZE*header->psegs + 78 100 MAPPING_VSPACE_SIZE*header->vspaces + 101 MAPPING_VOBJ_SIZE*header->vobjs + 79 102 MAPPING_VSEG_SIZE*header->vsegs ); 80 103 … … 89 112 fprintf( fpout, " ttys = \"%d\"\n", header->ttys); 90 113 fprintf( fpout, " vspaces = \"%d\"\n", header->vspaces); 91 fprintf( fpout, " globals = \"%d\"\n", header->globals); 92 fprintf( fpout, " syspath = \"%s\" >\n", header->syspath); 114 fprintf( fpout, " globals = \"%d\" />\n\n", header->globals); 93 115 94 116 ///////////////////// clusters /////////////////////////////////////////////// … … 124 146 fprintf( fpout, " <vseg name = \"%s\"\n", vseg[vseg_id].name); 125 147 fprintf( fpout, " vbase = \"0x%x\"\n", vseg[vseg_id].vbase); 126 fprintf( fpout, " length = \"0x%x\"\n", vseg[vseg_id].length);127 148 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]); 128 149 fprintf( fpout, " psegname = \"%s\"\n", pseg[pseg_id].name); 129 fprintf( fpout, " ident = \"%d\" />\n\n", vseg[vseg_id].ident); 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"); 130 165 } 131 166 fprintf( fpout, " </globalset>\n" ); … … 136 171 for ( vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++ ) 137 172 { 173 unsigned int func_id = vspace[vspace_id].vobj_offset + vspace[vspace_id].funcs_offset; 138 174 fprintf( fpout, " <vspace name = \"%s\"\n", vspace[vspace_id].name); 139 fprintf( fpout, " binpath = \"%s\"\n", vspace[vspace_id].binpath); 140 fprintf( fpout, " vsegs = \"%d\"\n", vspace[vspace_id].vsegs); 141 fprintf( fpout, " tasks = \"%d\"\n", vspace[vspace_id].tasks); 142 fprintf( fpout, " mwmrs = \"%d\"\n", vspace[vspace_id].mwmrs); 175 fprintf( fpout, " funcs = \"%s\"\n", vobj[func_id].name); 143 176 fprintf( fpout, " ttys = \"%d\" >\n\n", vspace[vspace_id].ttys); 144 177 … … 150 183 fprintf( fpout, " <vseg name = \"%s\"\n", vseg[vseg_id].name); 151 184 fprintf( fpout, " vbase = \"0x%x\"\n", vseg[vseg_id].vbase); 152 fprintf( fpout, " length = \"0x%x\"\n", vseg[vseg_id].length);153 185 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]); 154 186 fprintf( fpout, " psegname = \"%s\"\n", pseg[pseg_id].name); 155 fprintf( fpout, " mwmr = \"%d\"\n", vseg[vseg_id].mwmr); 156 fprintf( fpout, " ident = \"%d\" />\n\n", vseg[vseg_id].ident); 187 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident); 188 189 for ( vobj_id = vseg[vseg_id].vobj_offset ; 190 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs) ; vobj_id++ ) 191 { 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"); 201 } 202 fprintf( fpout, "\t\t </vseg>\n\n"); 157 203 } 158 204 for ( task_id = vspace[vspace_id].task_offset ; 159 205 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks) ; task_id++ ) 160 206 { 161 unsigned int v seg_id = task[task_id].vseglocid + vspace[vspace_id].vseg_offset;207 unsigned int vobj_id = task[task_id].vobjlocid + vspace[vspace_id].vobj_offset; 162 208 163 209 fprintf( fpout, " <task name = \"%s\"\n", task[task_id].name); 164 210 fprintf( fpout, " clusterid = \"%d\"\n", task[task_id].clusterid); 165 211 fprintf( fpout, " proclocid = \"%d\"\n", task[task_id].proclocid); 166 fprintf( fpout, " stackname = \"%s\"\n", v seg[vseg_id].name);212 fprintf( fpout, " stackname = \"%s\"\n", vobj[vobj_id].name); 167 213 fprintf( fpout, " startid = \"%d\"\n", task[task_id].startid); 168 214 fprintf( fpout, " ttylocid = \"%d\" />\n\n", task[task_id].ttylocid); -
soft/giet_vm/xml/xml_parser.c
r158 r160 18 18 #include <mapping_info.h> 19 19 20 #define MAX_CLUSTERS 20 #define MAX_CLUSTERS 1024 21 21 #define MAX_PSEGS 4096 22 22 #define MAX_VSPACES 1024 … … 24 24 #define MAX_MWMRS 4096 25 25 #define MAX_VSEGS 4096 26 #define MAX_VOBJS 8192 26 27 27 28 #define XML_PARSER_DEBUG 0 … … 36 37 mapping_vspace_t* vspace[MAX_VSPACES]; // vspace array 37 38 mapping_vseg_t* vseg[MAX_VSEGS]; // vseg array 39 mapping_vobj_t* vobj[MAX_VOBJS]; // vobj array 38 40 mapping_task_t* task[MAX_TASKS]; // task array 39 41 … … 46 48 unsigned int task_index = 0; 47 49 unsigned int task_loc_index = 0; 48 unsigned int mwmr_index = 0; 49 unsigned int mwmr_loc_index = 0; 50 unsigned int vobj_index = 0; 51 unsigned int vobj_loc_index = 0; 52 unsigned int vobj_loc_vspace_index = 0; 53 54 char one_elf_found = 0;//bool: wether a first vobj of type elf was found 50 55 51 56 ////////////////////////////////////////////////// … … 132 137 133 138 ////////////////////////////////////////// 134 int getV segLocId( unsigned int vspace_id,139 int getVobjLocId( unsigned int vspace_id, 135 140 char* str ) 136 141 { 137 unsigned int vseg_id; 138 unsigned int vseg_min = vspace[vspace_id]->vseg_offset; 139 unsigned int vseg_max = vseg_min + vspace[vspace_id]->vsegs; 140 141 for ( vseg_id = vseg_min ; vseg_id < vseg_max ; vseg_id++ ) 142 { 143 if ( strcmp(vseg[vseg_id]->name, str) == 0 ) return (vseg_id - vseg_min); 142 unsigned int vobj_id; 143 unsigned int vobj_min = vspace[vspace_id]->vobj_offset; 144 unsigned int vobj_max = vobj_min + vobj_loc_vspace_index; 145 146 for ( vobj_id = vobj_min ; vobj_id < vobj_max ; vobj_id++ ) 147 { 148 if ( strcmp(vobj[vobj_id]->name, str) == 0 ) 149 { 150 return (vobj_id - vobj_min); 151 } 144 152 } 145 153 return -1; … … 218 226 if ( ok ) 219 227 { 220 int index = getV segLocId( vspace_index, str );228 int index = getVobjLocId( vspace_index, str ); 221 229 if ( index >= 0 ) 222 230 { … … 225 233 printf(" vsegid = %d\n", index); 226 234 #endif 227 task[task_index]->v seglocid = index;235 task[task_index]->vobjlocid = index; 228 236 } 229 237 else … … 283 291 } // end taskNode() 284 292 285 /////////////////////////////////////////////////////////////// 286 void vsegNode ( xmlTextReaderPtr reader ) 293 void vobjNode ( xmlTextReaderPtr reader ) 287 294 { 288 295 unsigned int ok; … … 292 299 if ( xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT ) return; 293 300 301 if ( vobj_index >= MAX_VOBJS ) 302 { 303 printf("[XML ERROR] The number of vobjs is larger than %d\n", MAX_VSEGS); 304 exit(1); 305 } 306 307 if(one_elf_found != 0) 308 { 309 printf("[XML ERROR] a vobj of the type ELF must be defined alone in a vseg (%d,%d)\n", 310 vspace_index, vobj_loc_vspace_index); 311 exit(1); 312 313 } 314 315 #if XML_PARSER_DEBUG 316 printf(" vobj %d\n", vobj_loc_index); 317 #endif 318 319 vobj[vobj_index] = (mapping_vobj_t*)malloc(sizeof(mapping_vobj_t)); 320 321 ///////// get name attribute 322 str = getStringValue(reader, "name", &ok); 323 if ( ok ) 324 { 325 #if XML_PARSER_DEBUG 326 printf(" name = %s\n", str); 327 #endif 328 strncpy( vobj[vobj_index]->name, str, 31); 329 } 330 else 331 { 332 printf("[XML ERROR] illegal or missing <name> attribute for vobj (%d,%d)\n", 333 vseg_index, vobj_loc_index); 334 exit(1); 335 } 336 337 338 // get type attribute 339 str = getStringValue(reader, "type", &ok); 340 #if XML_PARSER_DEBUG 341 printf(" type = %s\n", str); 342 #endif 343 if (ok && (strcmp(str, "ELF") == 0)){ 344 vobj[vobj_index]->type = ELF; 345 one_elf_found = 1; 346 if(vobj_loc_index != 0) //check that this vobj is the first 347 { 348 printf("[XML ERROR] a vobj of the type ELF must be defined alone in a vobj (%d,%d)\n", 349 vspace_index, vobj_loc_vspace_index); 350 exit(1); 351 352 } 353 } 354 else if (ok && (strcmp(str, "PTAB") == 0)) vobj[vobj_index]->type = PTAB; 355 else if (ok && (strcmp(str, "PERI") == 0)) vobj[vobj_index]->type = PERI; 356 else if (ok && (strcmp(str, "MWMR") == 0)) vobj[vobj_index]->type = MWMR; 357 else if (ok && (strcmp(str, "LOCK") == 0)) vobj[vobj_index]->type = LOCK; 358 else if (ok && (strcmp(str, "BUFFER") == 0)) vobj[vobj_index]->type = BUFFER; 359 else if (ok && (strcmp(str, "BARRIER") == 0)) vobj[vobj_index]->type = BARRIER; 360 else 361 { 362 printf("[XML ERROR] illegal or missing <type> attribute for vobj (%d,%d)\n", 363 vspace_index, vobj_loc_vspace_index); 364 exit(1); 365 } 366 367 368 ////////// get length attribute (0 if missing) 369 value = getIntValue(reader,"length", &ok); 370 if ( ok ) 371 { 372 #if XML_PARSER_DEBUG 373 printf(" length = %d\n", value); 374 #endif 375 vobj[vobj_index]->length = value; 376 } 377 else 378 { 379 vobj[vobj_index]->length = 0; 380 } 381 382 ////////// get align attribute (0 if missing) 383 value = getIntValue(reader,"align", &ok); 384 if ( ok ) 385 { 386 #if XML_PARSER_DEBUG 387 printf(" align = %d\n", value); 388 #endif 389 vobj[vobj_index]->align = value; 390 } 391 else 392 { 393 vobj[vobj_index]->align = 0; 394 } 395 396 ////////// get binpath attribute ('\0' if missing) 397 str = getStringValue(reader, "binpath", &ok); 398 if ( ok ) 399 { 400 #if XML_PARSER_DEBUG 401 printf(" binpath = %s\n", str); 402 #endif 403 strncpy(vobj[vobj_index]->binpath, str, 63); 404 } 405 else 406 { 407 vobj[vobj_index]->binpath[0] = '\0'; 408 } 409 410 vobj_index++; 411 vobj_loc_index++; 412 vobj_loc_vspace_index++; 413 } 414 415 416 /////////////////////////////////////////////////////////////// 417 void vsegNode ( xmlTextReaderPtr reader ) 418 { 419 unsigned int ok; 420 unsigned int value; 421 char* str; 422 vobj_loc_index = 0; 423 one_elf_found = 0; 424 425 if ( xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT ) return; 426 294 427 if ( vseg_index >= MAX_VSEGS ) 295 428 { … … 303 436 304 437 vseg[vseg_index] = (mapping_vseg_t*)malloc(sizeof(mapping_vseg_t)); 438 439 ////////// set vobj_offset attributes 440 vseg[vseg_index]->vobj_offset = vobj_index; 441 #if XML_PARSER_DEBUG 442 printf("- vobj_offset = %d\n", vobj_index); 443 #endif 305 444 306 445 ///////// get name attribute … … 336 475 } 337 476 338 ////////// get length attribute339 value = getIntValue(reader,"length", &ok);340 if ( ok )341 {342 #if XML_PARSER_DEBUG343 printf(" length = 0x%x\n", value);344 #endif345 vseg[vseg_index]->length = value;346 }347 else348 {349 printf("[XML ERROR] illegal or missing <length> attribute for vseg (%d,%d)\n",350 vspace_index, vseg_loc_index);351 exit(1);352 }353 477 354 478 ////////// get ident attribute (0 if missing) … … 366 490 } 367 491 368 ////////// get mwmr attribute (0 if missing)369 value = getIntValue(reader,"mwmr", &ok);370 if ( ok )371 {372 #if XML_PARSER_DEBUG373 printf(" mwmr = %d\n", value);374 #endif375 vseg[vseg_index]->mwmr = value;376 if ( value )377 {378 mwmr_index++;379 mwmr_loc_index++;380 }381 }382 else383 {384 vseg[vseg_index]->mwmr = 0;385 }386 492 387 493 ////////// get psegname attribute … … 440 546 } 441 547 442 vseg_index++; 443 vseg_loc_index++; 548 549 ////////// set the length attribute to 0 550 //the final value will be set by the VLoader 551 vseg[vseg_index]->length = value; 552 553 ////////// get vobjs 554 int status = xmlTextReaderRead ( reader ); 555 while ( status == 1 ) 556 { 557 const char* tag = (const char*)xmlTextReaderConstName(reader); 558 559 if ( strcmp(tag,"vobj") == 0 ) vobjNode(reader); 560 else if ( strcmp(tag,"#text" ) == 0 ) { } 561 else if ( strcmp(tag,"vseg") == 0 ) 562 { 563 // checking source file consistency? 564 vseg[vseg_index]->vobjs = vobj_loc_index; 565 vseg_index++; 566 vseg_loc_index++; 567 return; 568 } 569 else 570 { 571 printf("[XML ERROR] Unknown tag %s",tag); 572 exit(1); 573 } 574 status = xmlTextReaderRead ( reader ); 575 } 576 577 444 578 } // end vsegNode() 445 579 … … 450 584 unsigned int ok; 451 585 unsigned int value; 586 vobj_loc_vspace_index = 0; 587 vseg_loc_index = 0; 588 task_loc_index = 0; 452 589 453 590 if ( xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT ) return; … … 467 604 vspace[vspace_index] = (mapping_vspace_t*)malloc(sizeof(mapping_vspace_t)); 468 605 469 ////////// set vseg_offset 606 ////////// set vseg_offsetand task_offset attributes 470 607 vspace[vspace_index]->vseg_offset = vseg_index; 608 vspace[vspace_index]->vobj_offset = vobj_index; 471 609 vspace[vspace_index]->task_offset = task_index; 472 610 473 611 #if XML_PARSER_DEBUG 474 612 printf("- vseg_offset = %d\n", vseg_index); 613 printf("- vobj_offset = %d\n", vobj_index); 475 614 printf("- task_offset = %d\n", task_index); 476 615 #endif … … 492 631 } 493 632 494 ////////// / get binpathattribute495 str = getStringValue(reader, " binpath", &ok);496 if ( ok ) 497 { 498 #if XML_PARSER_DEBUG 499 printf(" binpath= %s\n", str);500 #endif 501 strncpy(vspace[vspace_index]->binpath, str, 63);502 } 503 else 504 { 505 printf("[XML ERROR] illegal or missing < binpath> attribute for vspace %d",633 ////////// get funcs_entry attribute 634 str = getStringValue(reader, "funcs", &ok); 635 if ( ok ) 636 { 637 #if XML_PARSER_DEBUG 638 printf(" name = %s\n", str); 639 #endif 640 //used after parsing all the vobjs 641 } 642 else 643 { 644 printf("[XML ERROR] illegal or missing <name> attribute for vspace %d", 506 645 vspace_index); 507 646 exit(1); 508 }509 510 ////////// get vsegs attribute511 value = getIntValue(reader,"vsegs",&ok);512 if ( ok )513 {514 #if XML_PARSER_DEBUG515 printf(" vsegs = %d\n", value);516 #endif517 vspace[vspace_index]->vsegs = value;518 }519 else520 {521 printf("[XML ERROR] illegal or missing <vsegs> attribute for vspace %d",522 vspace_index);523 exit(1);524 }525 526 // get tasks attribute527 value = getIntValue(reader,"tasks", &ok);528 if ( ok )529 {530 #if XML_PARSER_DEBUG531 printf(" tasks = %d\n", value);532 #endif533 vspace[vspace_index]->tasks = value;534 }535 else536 {537 printf("[XML ERROR] illegal or missing <tasks> attribute for vspace %d",538 vspace_index);539 exit(1);540 }541 542 // get mwmrs attribute543 value = getIntValue(reader,"mwmrs", &ok);544 if ( ok )545 {546 #if XML_PARSER_DEBUG547 printf(" mwmrs = %d\n", value);548 #endif549 vspace[vspace_index]->mwmrs = value;550 }551 else552 {553 vspace[vspace_index]->mwmrs = 0;554 647 } 555 648 … … 580 673 else if ( strcmp(tag,"vspace") == 0 ) 581 674 { 582 // checking source file consistency 583 if ( vseg_loc_index != vspace[vspace_index]->vsegs ) 675 vspace[vspace_index]->vobjs = vobj_loc_vspace_index; 676 vspace[vspace_index]->tasks = task_loc_index ; 677 vspace[vspace_index]->vsegs = vseg_loc_index ; 678 int index = getVobjLocId( vspace_index, str ); 679 if(index == -1) 584 680 { 585 printf(" [XML ERROR] Wrong number of vsegs in vspace %d\n", vspace_index);586 exit( 1);681 printf("Error funcs entry vobj not found %s\n",str); 682 exit(-1); 587 683 } 588 else if ( task_loc_index != vspace[vspace_index]->tasks ) 589 { 590 printf("[XML ERROR] Wrong number of tasks in vspace %d\n", vspace_index); 591 exit(1); 592 } 593 else if ( mwmr_loc_index != vspace[vspace_index]->mwmrs ) 594 { 595 printf("[XML ERROR] Wrong number of mwmrs in vspace %d\n", vspace_index); 596 exit(1); 597 } 598 else 599 { 600 vseg_loc_index = 0; 601 task_loc_index = 0; 602 mwmr_loc_index = 0; 603 vspace_index++; 604 return; 605 } 684 vspace[vspace_index]->funcs_offset = index; 685 686 vspace_index++; 687 return; 606 688 } 607 689 else … … 898 980 { 899 981 header->vsegs = vseg_index; 982 header->vobjs = vobj_index; 900 983 header->tasks = task_index; 901 984 return; … … 1033 1116 { 1034 1117 printf("[XML ERROR] illegal or missing <globals> attribute in mapping_info_header\n"); 1035 exit(1);1036 }1037 1038 // get syspath attribute1039 name = getStringValue(reader, "syspath", &ok);1040 if ( ok )1041 {1042 #if XML_PARSER_DEBUG1043 printf("- syspath = %s\n\n", name);1044 #endif1045 strncpy( header->syspath, name, 63);1046 }1047 else1048 {1049 printf("[XML ERROR] illegal or missing <syspath> attribute in header\n");1050 1118 exit(1); 1051 1119 } … … 1086 1154 unsigned int vspace_id; 1087 1155 unsigned int vseg_id; 1156 unsigned int vobj_id; 1088 1157 unsigned int task_id; 1089 1158 … … 1142 1211 #if XML_PARSER_DEBUG 1143 1212 printf("write vspace %d\n", vspace_id); 1213 printf("vspace->vobj_offset: %d\n", vspace[vspace_id]->vobj_offset); 1214 printf("vspace->vobjs: %d\n", vspace[vspace_id]->vobjs); 1215 printf("header->vobjs: %d\n", header->vobjs); 1144 1216 #endif 1145 1217 … … 1163 1235 { 1164 1236 perror("write vseg"); 1237 exit(1); 1238 } 1239 } 1240 1241 // write vobjs 1242 for ( vobj_id = 0 ; vobj_id < header->vobjs ; vobj_id++ ) 1243 { 1244 length = write(fdout, (char*)vobj[vobj_id], sizeof(mapping_vobj_t)); 1245 1246 #if XML_PARSER_DEBUG 1247 printf("write vobj %d\n", vobj_id); 1248 printf("write vobj name %s\n", vobj[vobj_id]->name); 1249 printf("write vobj length %x\n", vobj[vobj_id]->length); 1250 printf("write vobj type %d\n", vobj[vobj_id]->type); 1251 #endif 1252 1253 if ( length != sizeof(mapping_vobj_t) ) 1254 { 1255 perror("write vobj"); 1165 1256 exit(1); 1166 1257 }
Note: See TracChangeset
for help on using the changeset viewer.