Ignore:
Timestamp:
Jan 9, 2019, 3:02:51 PM (3 years ago)
Author:
alain
Message:

Introduce sigificant modifs in VFS to support the <ls> command,
and the . and .. directories entries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/mapper.c

    r610 r611  
    644644}  // end mapper_remote_set_32()
    645645
    646 
     646//////////////////////////////////////////////////
     647error_t mapper_display_page( xptr_t     mapper_xp,
     648                             uint32_t   page_id,
     649                             uint32_t   nbytes,
     650                             char     * string )
     651{
     652    xptr_t     page_xp;        // extended pointer on page descriptor
     653    xptr_t     base_xp;        // extended pointer on page base
     654    char       buffer[4096];   // local buffer
     655    uint32_t * tab;            // pointer on uint32_t to scan the buffer
     656    uint32_t   line;           // line index
     657    uint32_t   word;           // word index
     658
     659    if( nbytes > 4096)
     660    {
     661        printk("\n[ERROR] in %s : nbytes (%d) cannot be larger than 4096\n",
     662        __FUNCTION__, nbytes );
     663        return -1;
     664    }
     665   
     666    // get extended pointer on page descriptor
     667    page_xp = mapper_remote_get_page( mapper_xp , page_id );
     668
     669    if( page_xp == XPTR_NULL)
     670    {
     671        printk("\n[ERROR] in %s : cannot access page %d in mapper\n",
     672        __FUNCTION__, page_id );
     673        return -1;
     674    }
     675
     676    // get extended pointer on page base
     677    base_xp = ppm_page2base( page_xp );
     678   
     679    // copy remote page to local buffer
     680    hal_remote_memcpy( XPTR( local_cxy , buffer ) , base_xp , nbytes );
     681
     682    // display 8 words per line
     683    tab = (uint32_t *)buffer;
     684    printk("\n***** %s : first %d bytes of page %d *****\n", string, nbytes, page_id );
     685    for( line = 0 ; line < (nbytes >> 5) ; line++ )
     686    {
     687        printk("%X : ", line );
     688        for( word = 0 ; word < 8 ; word++ ) printk("%X ", tab[(line<<3) + word] );
     689        printk("\n");
     690    }
     691
     692    return 0;
     693
     694}  // end mapper_display_page
     695
     696
Note: See TracChangeset for help on using the changeset viewer.