Ignore:
Timestamp:
Mar 28, 2018, 2:40:29 PM (4 years ago)
Author:
alain
Message:

Fix various bugs

File:
1 edited

Legend:

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

    r435 r437  
    154154
    155155//////////////////////////////////////////////////////////////////////////////////////////
    156 // This function is called when an MMU exception has been detected.
     156// This function is called when an MMU exception has been detected (IBE / DBE).
    157157// It get the relevant exception arguments from the MMU.
    158158// It signal a fatal error in case of illegal access. In case of page unmapped
     
    167167//////////////////////////////////////////////////////////////////////////////////////////
    168168error_t hal_mmu_exception( thread_t * this,
     169                           uint32_t   excPC,
    169170                           bool_t     is_ins )
    170171{
     
    294295        default:                             // this is a kernel error => panic   
    295296        {
    296             assert( false , __FUNCTION__ , "thread %x / excp_code = %x / vaddr = %x\n",
    297             this->trdid , excp_code , bad_vaddr );
     297            assert( false , __FUNCTION__ , "thread %x / epc %x / %s / vaddr = %x\n",
     298            this, excPC, hal_mmu_exception_str(excp_code) , bad_vaddr );
    298299
    299300            return EXCP_KERNEL_PANIC;
     
    379380        error_t      error;
    380381        uint32_t     excCode;                  // 4 bits XCODE from CP0_CR
     382        uint32_t     excPC;                    // fauty instruction address
    381383
    382384    // get pointer on faulty thread uzone
     
    384386    uzone = (uint32_t *)CURRENT_THREAD->uzone_current;
    385387
    386     // get 4 bits XCODE from CP0_CR register
     388    // get XCODE and EPC from UZONE
    387389        excCode        = (uzone[UZ_CR] >> 2) & 0xF;
     390    excPC          = uzone[UZ_EPC];
    388391
    389392#if CONFIG_DEBUG_HAL_EXCEPTIONS
    390393uint32_t cycle = (uint32_t)hal_get_cycles();
    391394if( CONFIG_DEBUG_HAL_EXCEPTIONS < cycle )
    392 printk("\n[DBG] %s : thread %x on core[%x,%d] enter / process %x / xcode %x / cycle %d\n",
    393 __FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excCode, cycle );
     395printk("\n[DBG] %s : thread %x enter / core[%x,%d] / pid %x / epc %x / xcode %x / cycle %d\n",
     396__FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excPC, excCode, cycle );
    394397#endif
    395398
     
    398401        case XCODE_DBE:     // can be non fatal
    399402        {
    400                     error = hal_mmu_exception( this , false );  // data MMU exception
     403                    error = hal_mmu_exception( this , excPC , false );  // data MMU exception
    401404            break;
    402405        }
    403406            case XCODE_IBE:     // can be non fatal
    404407        {
    405                     error = hal_mmu_exception( this , true );   // ins MMU exception
     408                    error = hal_mmu_exception( this , excPC , true );   // ins MMU exception
    406409                    break;
    407410        }
     
    450453cycle = (uint32_t)hal_get_cycles();
    451454if( CONFIG_DEBUG_HAL_EXCEPTIONS < cycle )
    452 printk("\n[DBG] %s : thread %x on core[%x,%d] exit / process %x / xcode %x / cycle %d\n",
    453 __FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excCode, cycle );
     455printk("\n[DBG] %s : thread %x exit / core[%x,%d] / pid %x / epc %x / xcode %x / cycle %d\n",
     456__FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excPC, excCode, cycle );
    454457#endif
    455458
Note: See TracChangeset for help on using the changeset viewer.