Changeset 626 for trunk/libs/libalmosmkh
- Timestamp:
- Apr 29, 2019, 7:25:09 PM (6 years ago)
- Location:
- trunk/libs/libalmosmkh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libalmosmkh/almosmkh.c
r623 r626 199 199 } // end get_uint32() 200 200 201 ////////////////////////////// 202 int get_string( char * string, 203 int maxlen ) 204 { 205 int c; 206 int done = 0; 207 int length = 0; 208 209 while( done == 0 ) 210 { 211 // check buffer overflow 212 if( length >= maxlen-1 ) 213 { 214 return -1; // return failure 215 } 216 217 // read one character 218 c = getchar(); 219 220 // analyse this character 221 if ( (c >= 0x20) && (c < 0x7F) ) // printable character 222 { 223 putchar( c ); // echo 224 string[length] = (char)c; // register character in string 225 length++; // update length 226 } 227 else if (c == 0x0A) // LF character marks end of string 228 { 229 done = 1; 230 } 231 else if ( (c == 0x7F) || // DEL character 232 (c == 0x08) ) // BS character 233 { 234 if ( length > 0 ) 235 { 236 length--; 237 printf("\b \b"); // BS / / BS 238 } 239 } 240 else if ( c == 0 ) // EOF character 241 { 242 return -1; // return failure 243 } 244 } 245 246 // set NUL character in string and return success 247 string[length] = 0; 248 return 0; 249 250 } // end get_string() 251 201 252 202 253 /////////////// non standard debug functions ////////////////////////// … … 298 349 } 299 350 351 /////////////////////////////////////// 352 int display_fat( unsigned int page_id, 353 unsigned int nb_entries ) 354 { 355 return hal_user_syscall( SYS_DISPLAY, 356 DISPLAY_FAT, 357 (reg_t)page_id, 358 (reg_t)nb_entries, 0 ); 359 } 360 300 361 /////////////////////////////// 301 362 int trace( unsigned int active, … … 313 374 { 314 375 char cmd; 315 unsigned int cxy;316 unsigned int lid;317 unsigned int txt;318 unsigned int pid;319 unsigned int trdid;320 unsigned int active;321 376 322 377 while( 1 ) 323 378 { 379 // display prompt 324 380 printf("\n[idbg] cmd = "); 381 382 // get a one character command 325 383 cmd = (char)getchar(); 326 384 327 if( cmd == 'h' ) 328 { 329 printf("h\n" 330 "p : display on TXT0 process descriptors in cluster[cxy]\n" 331 "s : display on TXT0 scheduler state for core[cxy,lid]\n" 332 "v : display on TXT0 VMM state for process[cxy,pid]\n" 333 "t : display on TXT0 process decriptors attached to TXT[tid]\n" 334 "b : display on TXT0 busylocks taken by thread[pid,trdid]\n" 335 "q : display on TXT0 DQDT state\n" 336 "y : activate/desactivate trace for core[cxy,lid]\n" 337 "x : force calling process to exit\n" 338 "c : resume calling process execution\n" 339 "h : list supported commands\n"); 340 } 385 // display all busylocks owned by thread(pid,trdid) 386 if( cmd == 'b' ) 387 { 388 printf("b / pid = "); 389 unsigned int pid = get_uint32(); 390 printf(" / trdid = "); 391 unsigned int trdid = get_uint32(); 392 display_busylocks( pid , trdid ); 393 } 394 // return to calling process 395 else if( cmd == 'c' ) 396 { 397 printf("c\n"); 398 break; 399 } 400 // display FAT mapper(page,entries) 401 else if( cmd == 'f' ) 402 { 403 printf("f / page = "); 404 unsigned int page = get_uint32(); 405 printf(" / entries = "); 406 unsigned int entries = get_uint32(); 407 display_fat( page , entries ); 408 } 409 // list all supported commands 410 else if( cmd == 'h' ) 411 { 412 printf("h\n" 413 "- b : display on TXT0 busylocks taken by thread[pid,trdid]\n" 414 "- c : resume calling process execution\n" 415 "- f : display on TXT0 FAT mapper[page,entries]\n" 416 "- h : list of supported commands\n" 417 "- m : display on TXT0 mapper[path,page,nbytes]\n" 418 "- p : display on TXT0 process descriptors in cluster[cxy]\n" 419 "- q : display on TXT0 DQDT state\n" 420 "- s : display on TXT0 scheduler state for core[cxy,lid]\n" 421 "- t : display on TXT0 process decriptors attached to TXT[tid]\n" 422 "- v : display on TXT0 VMM state for process[cxy,pid]\n" 423 "- x : force calling process to exit\n" 424 "- y : activate/desactivate trace for core[cxy,lid]\n" 425 ); 426 } 427 // display MAPPER(path,page,nbytes) 428 else if( cmd == 'm' ) 429 { 430 char path[128]; 431 printf("m / path = "); 432 int error = get_string( path , 128 ); 433 printf(" / page = "); 434 unsigned int page = get_uint32(); 435 printf(" / nbytes = "); 436 unsigned int nbytes = get_uint32(); 437 if( error == 0 ) display_mapper( path , page , nbytes ); 438 } 439 // display all processes in cluster(cxy) 341 440 else if( cmd == 'p' ) 342 441 { 343 442 printf("p / cxy = "); 344 cxy = get_uint32();443 unsigned int cxy = get_uint32(); 345 444 display_cluster_processes( cxy , 0 ); 346 445 } 347 else if( cmd == 's' ) 348 { 349 printf("s / cxy = "); 350 cxy = get_uint32(); 351 printf(" / lid = "); 352 lid = get_uint32(); 353 display_sched( cxy , lid ); 354 } 355 else if( cmd == 'v' ) 356 { 357 printf("v / cxy = "); 358 cxy = get_uint32(); 359 printf(" / pid = "); 360 pid = get_uint32(); 361 display_vmm( cxy , pid ); 362 } 363 else if( cmd == 't' ) 364 { 365 printf("t / txt_id = "); 366 txt = get_uint32(); 367 display_txt_processes( txt ); 368 } 446 // display DQDT 369 447 else if( cmd == 'q' ) 370 448 { … … 372 450 display_dqdt(); 373 451 } 374 else if( cmd == 'y' ) 375 { 376 printf("y / active = "); 377 active = get_uint32(); 378 printf(" / cxy = "); 379 cxy = get_uint32(); 452 // display scheduler state for core(cxy,lid) 453 else if( cmd == 's' ) 454 { 455 printf("s / cxy = "); 456 unsigned int cxy = get_uint32(); 380 457 printf(" / lid = "); 381 lid = get_uint32(); 382 trace( active , cxy , lid ); 383 } 384 else if( cmd == 'b' ) 385 { 386 printf("b / pid = "); 387 pid = get_uint32(); 388 printf(" / trdid = "); 389 trdid = get_uint32(); 390 display_busylocks( pid , trdid ); 391 } 458 unsigned int lid = get_uint32(); 459 display_sched( cxy , lid ); 460 } 461 // display all processes attached to TXT(txt_id) 462 else if( cmd == 't' ) 463 { 464 printf("t / txt_id = "); 465 unsigned int txt_id = get_uint32(); 466 display_txt_processes( txt_id ); 467 } 468 // display vmm state for process(cxy, pid) 469 else if( cmd == 'v' ) 470 { 471 printf("v / cxy = "); 472 unsigned int cxy = get_uint32(); 473 printf(" / pid = "); 474 unsigned int pid = get_uint32(); 475 display_vmm( cxy , pid ); 476 } 477 // force the calling process to exit 392 478 else if( cmd == 'x' ) 393 479 { … … 395 481 exit( 0 ); 396 482 } 397 else if( cmd == 'c' ) 398 { 399 printf("c\n"); 400 break; 401 } 402 } 483 // activate scheduler trace for core(cxy,lid) 484 else if( cmd == 'y' ) 485 { 486 printf("y / active = "); 487 unsigned int active = get_uint32(); 488 printf(" / cxy = "); 489 unsigned int cxy = get_uint32(); 490 printf(" / lid = "); 491 unsigned int lid = get_uint32(); 492 trace( active , cxy , lid ); 493 } 494 } // en while 403 495 } // end idbg() 404 496 -
trunk/libs/libalmosmkh/almosmkh.h
r625 r626 238 238 int display_barrier( unsigned int pid ); 239 239 240 /*************************************************************************************** 241 * This debug syscall displays on the kernel terminal TXT0 the content of one given 242 * page of the FAT mapper. 243 * It can be called by any thread running in any cluster. 244 *************************************************************************************** 245 * @ page_id : page index in file. 246 * @ nb_entries : number of bytes to display. 247 * @ return 0 if success / return -1 if page not found. 248 **************************************************************************************/ 249 int display_fat( unsigned int page_id, 250 unsigned int nb_entries ); 251 240 252 /***************************************************************************************** 241 253 * This debug syscall is used to activate / desactivate the context switches trace
Note: See TracChangeset
for help on using the changeset viewer.