Changeset 418 for trunk/kernel


Ignore:
Timestamp:
Jan 8, 2018, 2:25:39 PM (6 years ago)
Author:
alain
Message:

Fix a bug in hal_kentry.S : the "uzone" pointer in the thread descriptor
must not be modified in case of interrupt.

Location:
trunk/kernel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/chdev.c

    r408 r418  
    123123    uint32_t   save_sr;       // for critical section
    124124
     125#if CONFIG_READ_DEBUG
     126enter_chdev_cmd = hal_time_stamp();
     127#endif
     128
    125129    thread_t * this = CURRENT_THREAD;
    126130
     
    187191    hal_restore_irq( save_sr );
    188192
     193#if CONFIG_READ_DEBUG
     194exit_chdev_cmd = hal_time_stamp();
     195#endif
     196
    189197}  // end chdev_register_command()
    190198
     
    253261            xlist_unlink( XPTR( client_cxy , &client_ptr->wait_list ) );
    254262            remote_spinlock_unlock( lock_xp );
     263
     264            // unblock client thread
     265            thread_unblock( client_xp , THREAD_BLOCKED_IO );
    255266
    256267chdev_dmsg("\n[DBG] %s : thread %x complete operation for client %x / cycle %d\n",
  • trunk/kernel/kern/thread.c

    r416 r418  
    868868
    869869        }
    870         else                                // yield each ~ 100000 cycles
    871 
     870        else                                // search a runable thread
    872871        {
    873              hal_fixed_delay( 500000 );
     872            sched_yield( "IDLE" );
    874873        }
    875 
    876         // force scheduling at each iteration
    877         sched_yield( "idle" );
    878    }
     874    }
    879875}  // end thread_idle()
    880876
  • trunk/kernel/kern/thread.h

    r416 r418  
    133133        void              * cpu_context;     /*! pointer on CPU context switch            */
    134134        void              * fpu_context;     /*! pointer on FPU context switch            */
    135     void              * uzone;           /*! pointer on uzone for hal_kentry          */
     135    void              * uzone;           /*! used by hal_do_syscakl & hal_do_except   */
    136136
    137137        intptr_t            k_stack_base;    /*! kernel stack base address                */
  • trunk/kernel/syscalls/sys_panic.c

    r410 r418  
    4747        if( error )
    4848        {
    49         printk("\n[USER DBG] thread %x / process %x/ core[%x,%d] / cycle %d\n"
     49        printk("\n[USER PANIC] thread %x / process %x/ core[%x,%d] / cycle %d\n"
    5050        "cause unknown, because string not in user space\n",
    5151        this->trdid , process->pid , local_cxy , core->lid ,
     
    5656    if( hal_strlen_from_uspace( string ) >= 256 )
    5757        {
    58         printk("\n[USER DBG] thread %x / process %x/ core[%x,%d] / cycle %d\n"
     58        printk("\n[USER PANIC] thread %x / process %x/ core[%x,%d] / cycle %d\n"
    5959        "cause unknown, because string larger than 256 characters\n",
    6060        this->trdid , process->pid , local_cxy , core->lid ,
     
    6666
    6767    // print user debug message on kernel terminal
    68     printk("\n[USER DBG] thread %x / process %x / core[%x,%d] / cycle %d\n %s\n",
     68    printk("\n[USER PANIC] thread %x / process %x / core[%x,%d] / cycle %d\n %s\n",
    6969    this->trdid , process->pid , local_cxy, core->lid ,
    7070    (uint32_t)hal_get_cycles() , kbuf );
     
    7272        return 0;
    7373
    74 }  // end sys_get_cycle()
     74}  // end sys_panic()
  • trunk/kernel/syscalls/sys_read.c

    r416 r418  
    6464    reg_t        save_sr;     // required to enable IRQs during syscall
    6565
    66 #if CONFIG_SYSCALL_DEBUG
    67 uint32_t     tm_start;
    68 uint32_t     tm_end;
     66#if CONFIG_READ_DEBUG
     67uint64_t     tm_start;
     68uint64_t     tm_end;
    6969tm_start = hal_get_cycles();
    7070#endif
    7171
    7272#if CONFIG_READ_DEBUG
    73 enter_sys_read = tm_start;
     73enter_sys_read = (uint32_t)tm_start;
    7474#endif
    7575
     
    9898
    9999    // enable IRQs
    100     hal_enable_irq( &save_sr );
     100    // hal_enable_irq( &save_sr );
    101101
    102102    // get extended pointer on remote file descriptor
     
    158158
    159159    // restore IRQs
    160     hal_restore_irq( save_sr );
     160    // hal_restore_irq( save_sr );
    161161
    162162    hal_fence();
    163163
    164 #if CONFIG_SYSCALL_DEBUG
     164#if CONFIG_READ_DEBUG
    165165tm_end = hal_get_cycles();
    166166printk("\n[DBG] %s : core[%x,%d] / thread %x in process %x / cycle %d\n"
     
    171171#endif
    172172
    173 #if CONFIG_READ_DEBUG
    174 exit_sys_read = tm_end;
     173#if CONFIG_READ_DEBUG 
     174exit_sys_read = (uint32_t)tm_end;
    175175
    176176printk("\n@@@@@@@@@@@@ timing to read character %c\n"
  • trunk/kernel/syscalls/sys_write.c

    r416 r418  
    4646    reg_t        save_sr;         // required to enable IRQs during syscall
    4747
    48 #if CONFIG_SYSCALL_DEBUG
     48#if CONFIG_WRITE_DEBUG
    4949uint32_t     tm_start;
    5050uint32_t     tm_end;
     
    139139    hal_fence();
    140140
    141 #if CONFIG_SYSCALL_DEBUG
     141#if CONFIG_WRITE_DEBUG
    142142tm_end = hal_get_cycles();
    143143printk("\n[DBG] %s : core[%x,%d] / thread %x in process %x / cycle %d\n"
     
    148148#endif
    149149 
     150#if CONFIG_WRITE_DEBUG
     151printk("\n@@@@@@@@@@@@ timing to write character %c\n"
     152" - enter_sys_write    = %d\n"
     153" - exit_sys_write     = %d\n",
     154*((char *)(intptr_t)paddr) , (uint32_t)tm_start , (uint32_t)tm_end );
     155#endif
     156
    150157        return nbytes;
    151158
Note: See TracChangeset for help on using the changeset viewer.