Changeset 657 for trunk/libs/libalmosmkh/almosmkh.c
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libalmosmkh/almosmkh.c
r650 r657 2 2 * almosmkh.c - User level ALMOS-MKH specific library implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 122 122 } 123 123 124 /////////////////////////////// 125 unsigned int get_uint32( void)124 /////////////////////////////////////// 125 int get_uint32( unsigned int * buffer ) 126 126 { 127 127 unsigned int i; … … 168 168 else if ( c == 0 ) // EOF character 169 169 { 170 return -1; 170 overflow = 1; 171 done = 1; 171 172 } 172 173 … … 208 209 { 209 210 // return value 210 return value; 211 *buffer = value; 212 return 0; 211 213 } 212 214 else … … 222 224 223 225 // return 0 value 224 return 0; 226 *buffer = 0; 227 return -1; 225 228 } 226 229 } // end get_uint32() … … 388 391 389 392 /////////////////////////////////////// 390 int display_fat( unsigned int page_id,391 unsigned int nb_ entries )393 int display_fat( unsigned int min_slot, 394 unsigned int nb_slots ) 392 395 { 393 396 return hal_user_syscall( SYS_DISPLAY, 394 397 DISPLAY_FAT, 395 (reg_t) page_id,396 (reg_t)nb_ entries, 0 );398 (reg_t)min_slot, 399 (reg_t)nb_slots, 0 ); 397 400 } 398 401 … … 412 415 { 413 416 char cmd; 417 int error; 414 418 415 419 while( 1 ) … … 424 428 if( cmd == 'b' ) 425 429 { 430 unsigned int pid; 431 unsigned int trdid; 432 426 433 printf("b / pid = "); 427 unsigned int pid = get_uint32(); 434 error = get_uint32( &pid ); 435 428 436 printf(" / trdid = "); 429 unsigned int trdid = get_uint32(); 430 display_busylocks( pid , trdid ); 437 error |= get_uint32( &trdid ); 438 439 if( error == 0 ) display_busylocks( pid , trdid ); 431 440 } 432 441 // return to calling process … … 436 445 break; 437 446 } 438 // display FAT mapper( page,entries)447 // display FAT mapper(min,slots) 439 448 else if( cmd == 'f' ) 440 449 { 441 printf("f / page = "); 442 unsigned int page = get_uint32(); 443 printf(" / entries = "); 444 unsigned int entries = get_uint32(); 445 display_fat( page , entries ); 450 unsigned int min; 451 unsigned int slots; 452 453 printf(" / min = "); 454 error = get_uint32( &min ); 455 456 printf(" / slots = "); 457 error |= get_uint32( &slots ); 458 459 if( error == 0 ) display_fat( min , slots ); 446 460 } 447 461 // list all supported commands … … 451 465 "- b : display on TXT0 busylocks taken by thread[pid,trdid]\n" 452 466 "- c : resume calling process execution\n" 453 "- f : display on TXT0 FAT mapper[ page,entries]\n"467 "- f : display on TXT0 FAT mapper[min_slot,nb_slotss]\n" 454 468 "- h : list of supported commands\n" 455 469 "- m : display on TXT0 mapper[path,page,nbytes]\n" … … 467 481 { 468 482 char path[128]; 483 unsigned int page; 484 unsigned int nbytes; 485 469 486 printf("m / path = "); 470 int error = get_string( path , 128 ); 487 error = get_string( path , 128 ); 488 471 489 printf(" / page = "); 472 unsigned int page = get_uint32(); 490 error |= get_uint32( &page ); 491 473 492 printf(" / nbytes = "); 474 unsigned int nbytes = get_uint32(); 493 error |= get_uint32( &nbytes ); 494 475 495 if( error == 0 ) display_mapper( path , page , nbytes ); 476 496 } … … 478 498 else if( cmd == 'p' ) 479 499 { 500 unsigned int cxy; 501 480 502 printf("p / cxy = "); 481 unsigned int cxy = get_uint32(); 482 display_cluster_processes( cxy , 0 ); 503 error = get_uint32( &cxy ); 504 505 if( error == 0 ) display_cluster_processes( cxy , 0 ); 483 506 } 484 507 // display DQDT … … 491 514 else if( cmd == 's' ) 492 515 { 516 unsigned int cxy; 517 unsigned int lid; 518 493 519 printf("s / cxy = "); 494 unsigned int cxy = get_uint32(); 520 error = get_uint32( &cxy ); 521 495 522 printf(" / lid = "); 496 unsigned int lid = get_uint32(); 497 display_sched( cxy , lid ); 523 error |= get_uint32( &lid ); 524 525 if( error == 0 ) display_sched( cxy , lid ); 498 526 } 499 527 // display all processes attached to TXT(txt_id) 500 528 else if( cmd == 't' ) 501 529 { 530 unsigned int txt_id; 531 502 532 printf("t / txt_id = "); 503 unsigned int txt_id = get_uint32(); 504 display_txt_processes( txt_id ); 533 error = get_uint32( &txt_id ); 534 535 if( error == 0 ) display_txt_processes( txt_id ); 505 536 } 506 537 // display vmm state for process(cxy, pid) 507 538 else if( cmd == 'v' ) 508 539 { 540 unsigned int cxy; 541 unsigned int pid; 542 unsigned int map; 543 509 544 printf("v / cxy = "); 510 unsigned int cxy = get_uint32(); 545 error = get_uint32( &cxy ); 546 511 547 printf(" / pid = "); 512 unsigned int pid = get_uint32(); 548 error |= get_uint32( &pid ); 549 513 550 printf(" / mapping = "); 514 unsigned int map = get_uint32(); 515 display_vmm( cxy , pid , map ); 551 error |= get_uint32( &map ); 552 553 if( error == 0 ) display_vmm( cxy , pid , map ); 516 554 } 517 555 // force the calling process to exit … … 524 562 else if( cmd == 'y' ) 525 563 { 564 unsigned int active; 565 unsigned int cxy; 566 unsigned int lid; 567 526 568 printf("y / active = "); 527 unsigned int active = get_uint32(); 569 error = get_uint32( &active ); 570 528 571 printf(" / cxy = "); 529 unsigned int cxy = get_uint32(); 572 error |= get_uint32( &cxy ); 573 530 574 printf(" / lid = "); 531 unsigned int lid = get_uint32(); 532 trace( active , cxy , lid ); 575 error |= get_uint32( &lid ); 576 577 if( error == 0 ) trace( active , cxy , lid ); 533 578 } 534 579 } // en while … … 1500 1545 { 1501 1546 return hal_user_syscall( SYS_FBF, 1502 FBF_GET_CONFIG,1547 (reg_t)FBF_GET_CONFIG, 1503 1548 (reg_t)width, 1504 1549 (reg_t)height, … … 1512 1557 { 1513 1558 return hal_user_syscall( SYS_FBF, 1514 FBF_READ,1559 (reg_t)FBF_DIRECT_READ, 1515 1560 (reg_t)buffer, 1516 1561 (reg_t)length, … … 1524 1569 { 1525 1570 return hal_user_syscall( SYS_FBF, 1526 FBF_WRITE,1571 (reg_t)FBF_DIRECT_WRITE, 1527 1572 (reg_t)buffer, 1528 1573 (reg_t)length, 1529 1574 (reg_t)offset ); 1575 } 1576 1577 ////////////////////////////////////////////// 1578 int fbf_create_window( unsigned int l_zero, 1579 unsigned int p_zero, 1580 unsigned int nlines, 1581 unsigned int npixels, 1582 void ** buffer ) 1583 { 1584 return hal_user_syscall( SYS_FBF, 1585 (reg_t)FBF_CREATE_WINDOW, 1586 (reg_t)((l_zero << 16) | p_zero), 1587 (reg_t)((nlines << 16) | npixels), 1588 (reg_t)buffer ); 1589 } 1590 1591 ////////////////////////////////////////// 1592 int fbf_delete_window( unsigned int wid ) 1593 { 1594 return hal_user_syscall( SYS_FBF, 1595 (reg_t)FBF_DELETE_WINDOW, 1596 (reg_t)wid, 0, 0 ); 1597 } 1598 1599 /////////////////////////////////////// 1600 int fbf_move_window( unsigned int wid, 1601 unsigned int l_zero, 1602 unsigned int p_zero ) 1603 { 1604 return hal_user_syscall( SYS_FBF, 1605 (reg_t)FBF_MOVE_WINDOW, 1606 (reg_t)wid, 1607 (reg_t)l_zero, 1608 (reg_t)p_zero ); 1609 } 1610 1611 ///////////////////////////////////////// 1612 int fbf_resize_window( unsigned int wid, 1613 unsigned int width, 1614 unsigned int height ) 1615 { 1616 return hal_user_syscall( SYS_FBF, 1617 (reg_t)FBF_RESIZE_WINDOW, 1618 (reg_t)wid, 1619 (reg_t)width, 1620 (reg_t)height ); 1621 } 1622 1623 ////////////////////////////////////////// 1624 int fbf_refresh_window( unsigned int wid, 1625 unsigned int line_first, 1626 unsigned int line_last ) 1627 { 1628 return hal_user_syscall( SYS_FBF, 1629 (reg_t)FBF_REFRESH_WINDOW, 1630 (reg_t)wid, 1631 (reg_t)line_first, 1632 (reg_t)line_last ); 1530 1633 } 1531 1634
Note: See TracChangeset
for help on using the changeset viewer.