Ignore:
Timestamp:
Aug 2, 2018, 11:47:13 AM (4 years ago)
Author:
alain
Message:

This version modifies the exec syscall and fixes a large number of small bugs.
The version number has been updated (0.1)

File:
1 edited

Legend:

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

    r440 r457  
    2222 */
    2323
    24 #include <hal_types.h>
     24#include <hal_kernel_types.h>
    2525#include <hal_irqmask.h>
    2626#include <hal_special.h>
     
    134134        core_t   * core = this->core;
    135135
    136     // enable FPU
     136    // enable FPU (in core SR)
    137137        hal_fpu_enable();
    138138
    139     // save FPU context in current owner thread if required
     139    // save FPU register values in current owner thread if required
    140140        if( core->fpu_owner != NULL )
    141141    {
    142142        if( core->fpu_owner != this )
    143143            {
     144            // save the FPU registers to current owner thread context
    144145                    hal_fpu_context_save( XPTR( local_cxy , core->fpu_owner ) );
     146
     147            // restore FPU registers from requesting thread context
     148                hal_fpu_context_restore( this->fpu_context );
     149
     150            // attach the FPU to the requesting thread
     151                core->fpu_owner = this;
    145152        }
    146153        }
    147 
    148     // attach the FPU to the requesting thread
    149         hal_fpu_context_restore( this->fpu_context );
    150         core->fpu_owner = this;
     154    else
     155    {
     156        // restore FPU registers from requesting thread context
     157            hal_fpu_context_restore( this->fpu_context );
     158
     159        // attach the FPU to the requesting thread
     160            core->fpu_owner = this;
     161    }
    151162
    152163        return EXCP_NON_FATAL;
     
    206217uint32_t cycle = (uint32_t)hal_get_cycles();
    207218if( DEBUG_HAL_EXCEPTIONS < cycle )
    208 printk("\n[DBG] %s : thread %x enter / is_ins %d / %s / vaddr %x / cycle %d\n",
    209 __FUNCTION__, this, is_ins, hal_mmu_exception_str(excp_code), bad_vaddr, cycle );
     219printk("\n[DBG] %s : thread %x in process %x enter / is_ins %d / %s / vaddr %x / cycle %d\n",
     220__FUNCTION__, this->trdid, process->pid, is_ins, hal_mmu_exception_str(excp_code), bad_vaddr, cycle);
    210221#endif
    211222
     
    235246cycle = (uint32_t)hal_get_cycles();
    236247if( DEBUG_HAL_EXCEPTIONS < cycle )
    237 printk("\n[DBG] %s : thread %x exit / page-fault handled for vaddr = %x\n",
    238 __FUNCTION__ , this , bad_vaddr );
     248printk("\n[DBG] %s : thread %x in process %x exit / page-fault handled for vaddr = %x\n",
     249__FUNCTION__, this->trdid, process->pid, bad_vaddr );
    239250#endif
    240251 
     
    275286cycle = (uint32_t)hal_get_cycles();
    276287if( DEBUG_HAL_EXCEPTIONS < cycle )
    277 printk("\n[DBG] %s : thread %x exit / copy-on-write handled for vaddr = %x\n",
    278 __FUNCTION__ , this , bad_vaddr );
     288printk("\n[DBG] %s : thread %x in process %x exit / copy-on-write handled for vaddr = %x\n",
     289__FUNCTION__, this->trdid, process->pid, bad_vaddr );
    279290#endif
    280291
     
    300311        {
    301312            assert( false , __FUNCTION__ ,
    302             "thread %x / core[%x,%d] / epc %x / vaddr %x / cycle %d\n",
    303             this, local_cxy, this->core->lid, excPC, bad_vaddr, (uint32_t)hal_get_cycles() );
     313            "thread %x in process %x / core[%x,%d] / epc %x / vaddr %x / cycle %d\n",
     314            this->trdid, this->process->pid, local_cxy, this->core->lid,
     315            excPC, bad_vaddr, (uint32_t)hal_get_cycles() );
    304316
    305317            return EXCP_KERNEL_PANIC;
     
    398410uint32_t cycle = (uint32_t)hal_get_cycles();
    399411if( DEBUG_HAL_EXCEPTIONS < cycle )
    400 printk("\n[DBG] %s : thread %x enter / core[%x,%d] / pid %x / epc %x / xcode %x / cycle %d\n",
    401 __FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excPC, excCode, cycle );
     412printk("\n[DBG] %s : thread %x in process %x enter / core[%x,%d] / epc %x / xcode %x / cycle %d\n",
     413__FUNCTION__, this->trdid, this->process->pid, local_cxy, this->core->lid, excPC, excCode, cycle );
    402414#endif
    403415
     
    458470cycle = (uint32_t)hal_get_cycles();
    459471if( DEBUG_HAL_EXCEPTIONS < cycle )
    460 printk("\n[DBG] %s : thread %x exit / core[%x,%d] / pid %x / epc %x / xcode %x / cycle %d\n",
    461 __FUNCTION__, this, local_cxy, this->core->lid, this->process->pid, excPC, excCode, cycle );
     472printk("\n[DBG] %s : thread %x in process %x exit / core[%x,%d] / epc %x / xcode %x / cycle %d\n",
     473__FUNCTION__, this->trdid, this->process->pid, local_cxy, this->core->lid, excPC, excCode, cycle );
    462474#endif
    463475
Note: See TracChangeset for help on using the changeset viewer.