Changeset 313 for trunk/hal


Ignore:
Timestamp:
Aug 2, 2017, 3:24:57 PM (4 years ago)
Author:
alain
Message:

RSeveral modifs in the page-fault handling.

Location:
trunk/hal
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/generic/hal_gpt.h

    r41 r313  
    168168
    169169/****************************************************************************************
    170  * This function copies all valid entries from the source <src_gpt> to the <dst_pgt>.
     170 * This function copies all valid entries from the source <src_gpt> to the <dst_gpt>.
    171171 * The <src_gpt> and the <dst_gpt> point on the same physical pages.
    172172 * If the <cow> argument is true, the GPT_WRITABLE attribute is reset for all writable
  • trunk/hal/generic/hal_ppm.h

    r296 r313  
    6262void hal_core_init( boot_info_t * info );
    6363
     64/*****************************************************************************************
     65 * This function returns the PPN from the page descriptor extended pointer.
     66 *****************************************************************************************
     67 * @ page_xp   : pointer to page descriptor
     68 * @ returns physical page number
     69 ****************************************************************************************/
     70inline ppn_t hal_page2ppn( xptr_t page_xp );
    6471
     72/*****************************************************************************************
     73 * This function returns the page descriptor extended pointer from the PPN.
     74 *****************************************************************************************
     75 * @ ppn          : physical page number
     76 * @ returns extended pointer on page descriptor
     77 ****************************************************************************************/
     78inline xptr_t hal_ppn2page( ppn_t ppn );
    6579
    6680#endif  /* HAL_PPM_H_ */
  • trunk/hal/generic/hal_remote.h

    r121 r313  
    184184                        xptr_t src );
    185185
     186/*****************************************************************************************
     187 * This function makes a memset to a remote buffer in kernel space.
     188 *****************************************************************************************
     189 * @ buf_xp  : extended pointer to destination buffer.
     190 * @ byte    : Rvalue to be set in all buffer slots.
     191 * @ size    : number of bytes to move.
     192 ****************************************************************************************/
     193void hal_remote_memset( xptr_t   buf_xp,
     194                        uint8_t  byte,
     195                        uint32_t size );
     196
    186197#endif  /* _HAL_REMOTE_H_ */
  • trunk/hal/tsar_mips32/core/hal_ppm.c

    r296 r313  
    3535
    3636//////////////////////////////////////////////////////////////////////////////////////////
    37 // This file contains the TSAR specific code for cores registers,
    38 // and for physical memory allocators initialisation in a given cluster.
    39 
     37// This file contains the TSAR specific code for :
     38// - cores registers initialisation,
     39// - memory allocators initialisation.
     40//
    4041// For The TSAR architecture, the kernel pointers are identity mapped:
    4142// - the 32 bits PTR value is identical to the 32 bits LPA value,
     
    133134
    134135}  // end hal_core_init()
     136
     137///////////////////////////////////////////
     138inline ppn_t hal_page2ppn( xptr_t page_xp )
     139{
     140        ppm_t  * ppm      = &LOCAL_CLUSTER->ppm;
     141
     142    cxy_t    page_cxy = GET_CXY( page_xp );
     143    page_t * page_ptr = (page_t *)GET_PTR( page_xp );
     144
     145    return (ppn_t)(page_ptr - ppm->pages_tbl) | (ppn_t)(page_cxy << 20);
     146
     147}  // end hal_page2ppn()
     148
     149////////////////////////////////////////
     150inline xptr_t  hal_ppn2page( ppn_t ppn )
     151{
     152        ppm_t  * ppm      = &LOCAL_CLUSTER->ppm;
     153
     154    cxy_t    page_cxy = (ppn & 0xFFF00000) >> 20;
     155    page_t * page_ptr = &ppm->pages_tbl[ppn & 0x000FFFFF];
     156
     157    return XPTR( page_xy , page_ptr );
     158
     159}  // end hal_ppn2page
     160
     161
  • trunk/hal/tsar_mips32/core/hal_remote.c

    r296 r313  
    447447
    448448} // end hal_remote_strcpy()
     449
     450////////////////////////////////////////
     451void hal_remote_memset( xptr_t   buf_xp,
     452                        uint8_t  byte,
     453                        uint32_t size )
     454{
     455    uint32_t save_sr;
     456        uint32_t i;
     457        uint32_t wsize;
     458    uint32_t buf_ptr = (uint32_t)GET_PTR( buf_xp );
     459    uint32_t buf_cxy = (uint32_t)GET_CXY( buf_xp );
     460    uint32_t word    = ((uint32_t)byte)<<24 |
     461                       ((uint32_t)byte)<<16 |
     462                       ((uint32_t)byte)<<8  |
     463                       ((uint32_t)byte)     ;
     464
     465    hal_disable_irq( &save_sr );
     466
     467        if( (buf_ptr & 0x3) ) wsize = 0;  // do it all in bytes
     468    else                  wsize = size >> 2;
     469
     470        for( i = 0 ; i < wsize ; i++ )          // transfer one word per iteration
     471        {
     472        asm volatile(
     473            ".set noreorder              \n"
     474            "mfc2   $15,    $24          \n"  /* $15 <= PADDR_EXT     */
     475            "mtc2   %0,     $24          \n"  /* PADDR_EXT <= buf_cxy */   
     476            "sw     %2,     0(%1)        \n"  /* set one word         */
     477            "mtc2   $15,    $24          \n"  /* PADDR_EXT <= $15     */   
     478            ".set reorder                \n"
     479                    : : "r"(buf_cxy), "r" (buf_ptr+(i<<2)), "r"(byte) : "$15" );               
     480        }
     481
     482        for( i = wsize << 2 ; i < size ; i++ )  // transfer one byte per iteration
     483        {
     484        asm volatile(
     485            ".set noreorder              \n"
     486            "mfc2   $15,    $24          \n"  /* $15 <= PADDR_EXT     */
     487            "mtc2   %0,     $24          \n"  /* PADDR_EXT <= buf_cxy */   
     488            "sb     %2,     0(%1)        \n"  /* set one byte         */
     489            "mtc2   $15,    $24          \n"  /* PADDR_EXT <= $15     */   
     490            ".set reorder                \n"
     491                    : : "r"(buf_cxy), "r"(buf_ptr+i), "r"(word) : "$15" );             
     492        }
     493
     494    hal_restore_irq( save_sr );
     495
     496}  // end hal_remote_memset()
     497
Note: See TracChangeset for help on using the changeset viewer.