Ignore:
Timestamp:
May 10, 2017, 5:04:01 PM (7 years ago)
Author:
alain
Message:

mprove the HAL for interrupt, exception, syscall handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_thread_exit.c

    r1 r16  
    3232int sys_thread_exit ( void * exit_val )
    3333{
    34         thread_t * this = current_thread;
    35     cpu_t    * cpu  = current_cpu;
    36         uint32_t   state;
    37         bool_t     isEmpty;
    38         bool_t     isReleased;
     34        thread_t  * this = CURRENT_THREAD;
     35    core_t    * core = this->core;
     36        bool_t      isEmpty;
     37        bool_t      isReleased;
     38    uint32_t    irq_state;
    3939
    40         /* TODO: the cpu->lid must match the core index in the logical cluster */
    41         if(this->process->pid != 1)
    42                 dqdt_update_threads_number( local_cxy , cpu->lid , -1 );
     40        // update DQDT TODO must be done by thread destroy
     41        if(this->process->pid != 1) dqdt_local_update_threads( -1 );
    4342
    4443        spinlock_lock( &this->lock );
     
    4645        if(!(thread_isJoinable(this)))
    4746        {
    48                 spinlock_unlock_nosched(&this->lock);
    4947                goto exit_dead;
    5048        }
    5149
    52         // Check if there's a thread waiting the end of callee thread
     50        // Check if there's a thread waiting the end of calling thread
    5351        isEmpty = wait_queue_isEmpty(&this->info.wait_queue);
    5452
     
    7270
    7371        // Release FPU if required
    74         cpu_disable_all_irq(&state);
    75         if(current_cpu->fpu_owner == this)
     72        hal_disable_irq( &irq_state );
     73        if(core->fpu_owner == this)
    7674        {
    77                 current_cpu->fpu_owner = NULL;
     75                core->fpu_owner = NULL;
    7876                isReleased = true;
    7977        }
    80         cpu_restore_irq(state);
     78        hal_restore_irq( irq_state );
    8179
    8280        if(isReleased)
Note: See TracChangeset for help on using the changeset viewer.