Ignore:
Timestamp:
Apr 10, 2019, 10:09:39 AM (5 years ago)
Author:
alain
Message:

Fix a bug in the vmm_remove_vseg() function: the physical pages
associated to an user DATA vseg were released to the kernel when
the target process descriptor was in the reference cluster.
This physical pages release should be done only when the page
forks counter value is zero.
All other modifications are cosmetic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/core/hal_special.c

    r624 r625  
    4040extern cxy_t local_cxy;
    4141extern void  hal_kentry_enter( void );
     42
     43////////////////////////////////////////////////////////////////////////////////
     44// For the TSAR architecture, this function registers the address of the
     45// hal_kentry_enter() function in the MIPS32 cp0_ebase register.
     46////////////////////////////////////////////////////////////////////////////////
     47void hal_set_kentry( void )
     48{
     49    uint32_t kentry = (uint32_t)(&hal_kentry_enter);
     50
     51    asm volatile("mtc0   %0,  $15,  1" : : "r" (kentry) );
     52}
    4253
    4354/////////////////////////////////////////////////////////////////////////////////
     
    4859void hal_mmu_init( gpt_t * gpt )
    4960{
    50 
    51     // set PT1 base address in mmu_ptpr register
     61    // set PT1 base address in cp2_ptpr register
    5262    uint32_t ptpr = (((uint32_t)gpt->ptr) >> 13) | (local_cxy << 19);
    5363    asm volatile ( "mtc2   %0,   $0         \n" : : "r" (ptpr) );
    5464
    55     // set ITLB | ICACHE | DCACHE bits in mmu_mode register
     65    // set ITLB | ICACHE | DCACHE bits in cp2_mode register
    5666    asm volatile ( "ori    $26,  $0,  0xB   \n"
    5767                   "mtc2   $26,  $1         \n" );
     
    5969
    6070////////////////////////////////////////////////////////////////////////////////
    61 // For the TSAR architecture, this function registers the address of the
    62 // hal_kentry_enter() function in the MIPS32 cp0_ebase register.
    63 ////////////////////////////////////////////////////////////////////////////////
    64 void hal_set_kentry( void )
    65 {
    66     uint32_t kentry = (uint32_t)(&hal_kentry_enter);
    67 
    68     asm volatile("mtc0   %0,  $15,  1" : : "r" (kentry) );
    69 }
    70 
    71 ////////////////////////////////
     71// For the TSAR architecture, this function returns the current value
     72// of the 32 bits c0_sr register
     73////////////////////////////////////////////////////////////////////////////////
     74inline reg_t hal_get_sr( void )
     75{
     76    reg_t sr;
     77
     78        asm volatile ("mfc0    %0,    $12" : "=&r" (sr));
     79
     80        return sr;
     81}
     82
     83////////////////////////////////////////////////////////////////////////////////
     84// For the TSAR architecture, this function returns the 10 LSB bits
     85// of the 32 bits c0_ebase register : Y (4 bits) | Y (4 bits) | LID (2 bits)
     86////////////////////////////////////////////////////////////////////////////////
    7287inline gid_t hal_get_gid( void )
    7388{
     
    7994}
    8095
    81 ///////////////////////////////////
     96////////////////////////////////////////////////////////////////////////////////
     97// For the TSAR architecture, this function returns the current value
     98// of the 32 bits c0_count cycle counter.
     99////////////////////////////////////////////////////////////////////////////////
    82100inline reg_t hal_time_stamp( void )
    83101{
     
    87105
    88106    return count;
    89 }
    90 
    91 ///////////////////////////////
    92 inline reg_t hal_get_sr( void )
    93 {
    94     reg_t sr;
    95 
    96         asm volatile ("mfc0    %0,    $12" : "=&r" (sr));
    97 
    98         return sr;
    99107}
    100108
     
    131139}
    132140
    133 ///////////////////////////////////////////////////////
     141////////////////////////////////////////////////////////////////////////////////
     142// For the TSAR architecture, this function returns the current value
     143// of the 32 bits c0_th register.
     144////////////////////////////////////////////////////////////////////////////////
    134145inline struct thread_s * hal_get_current_thread( void )
    135146{
     
    141152}
    142153
    143 ///////////////////////////////////////////////////////
     154////////////////////////////////////////////////////////////////////////////////
     155// For the TSAR architecture, this function set a new value
     156// to the 32 bits c0_th register.
     157////////////////////////////////////////////////////////////////////////////////
    144158void hal_set_current_thread( struct thread_s * thread )
    145159{
     
    182196}
    183197
    184 ///////////////////////////
    185 uint32_t hal_get_sp( void )
     198////////////////////////////////////////////////////////////////////////////////
     199// For the TSAR architecture, this function returns the current value
     200// of the 32 bits sp_29 register.
     201////////////////////////////////////////////////////////////////////////////////
     202reg_t hal_get_sp( void )
    186203{
    187204        register uint32_t sp;
     
    190207 
    191208        return sp;
    192 }
    193 
    194 /////////////////////////////////////
    195 uint32_t hal_set_sp( void * new_val )
    196 {
    197         register uint32_t sp;
    198  
    199         asm volatile
    200         ( "or    %0,   $0,      $29   \n"
    201           "or    $29,  $0,      %1    \n"
    202           : "=&r" (sp) : "r" (new_val)  );
    203  
    204         return sp;
    205 }
    206 
    207 ///////////////////////////
    208 uint32_t hal_get_ra( void )
    209 {
    210         register uint32_t ra;
    211  
    212         asm volatile ("or    %0,   $0,   $31" : "=&r" (ra));
    213  
    214         return ra;
    215209}
    216210
Note: See TracChangeset for help on using the changeset viewer.