Ignore:
Timestamp:
Apr 29, 2019, 7:25:09 PM (5 years ago)
Author:
alain
Message:

This version has been tested on the sort multithreaded application
for TSAR_IOB architectures ranging from 1 to 8 clusters.
It fixes three bigs bugs:
1) the dev_ioc device API has been modified: the dev_ioc_sync_read()
and dev_ioc_sync_write() function use now extended pointers on the
kernel buffer to access a mapper stored in any cluster.
2) the hal_uspace API has been modified: the hal_copy_to_uspace()
and hal_copy_from_uspace() functions use now a (cxy,ptr) couple
to identify the target buffer (equivalent to an extended pointer.
3) an implementation bug has been fixed in the assembly code contained
in the hal_copy_to_uspace() and hal_copy_from_uspace() functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/libalmosmkh/almosmkh.c

    r623 r626  
    199199}  // end get_uint32()
    200200
     201//////////////////////////////
     202int 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
    201252
    202253///////////////    non standard debug functions    //////////////////////////
     
    298349}
    299350
     351///////////////////////////////////////
     352int 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
    300361///////////////////////////////
    301362int trace( unsigned int active,
     
    313374{
    314375   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;
    321376
    322377   while( 1 )
    323378   {
     379        // display prompt
    324380        printf("\n[idbg] cmd = ");
     381
     382        // get a one character command
    325383        cmd = (char)getchar();
    326384
    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)
    341440        else if( cmd == 'p' )
    342441        {
    343442            printf("p / cxy = ");
    344             cxy = get_uint32();
     443            unsigned int cxy = get_uint32();
    345444            display_cluster_processes( cxy , 0 );
    346445        }
    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
    369447        else if( cmd == 'q' )
    370448        {
     
    372450            display_dqdt();
    373451        }
    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();
    380457            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
    392478        else if( cmd == 'x' )
    393479        {
     
    395481            exit( 0 );
    396482        }
    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
    403495}  // end idbg()
    404496
Note: See TracChangeset for help on using the changeset viewer.