Changeset 619 for trunk/hal


Ignore:
Timestamp:
Feb 12, 2019, 1:15:47 PM (5 years ago)
Author:
alain
Message:

1) Fix a bug in KSH : after the "load" command,

the [ksh] prompt is now printed after completion
of the loaded application.

2) Fix a bug in vmm_handle_cow() : the copy-on-write

use now a hal_remote_memcpy() to replicate the page content.


Location:
trunk/hal
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/generic/hal_exception.h

    r587 r619  
    2626
    2727#include <hal_kernel_types.h>
     28#include <thread.h>
    2829
    2930//////////////////////////////////////////////////////////////////////////////////////////
     
    5960    EXCP_USER_ERROR,
    6061    EXCP_KERNEL_PANIC,
     62
    6163}
    6264exception_handling_type_t;
     
    6971void hal_do_exception( void );
    7072
     73
    7174#endif  // _HAL_EXCEPTION_H_
  • trunk/hal/generic/hal_remote.h

    r570 r619  
    166166 * destination remote buffer in kernel space.
    167167 *****************************************************************************************
    168  * @ dst     : extended pointer to destination buffer
    169  * @ src     : extended pointer to source buffer
     168 * @ dst_xp  : extended pointer to destination buffer
     169 * @ src_xp  : extended pointer to source buffer
    170170 * @ size    : number of bytes to move
    171171 ****************************************************************************************/
    172 void hal_remote_memcpy( xptr_t   dst,
    173                         xptr_t   src,
     172void hal_remote_memcpy( xptr_t   dst_xp,
     173                        xptr_t   src_xp,
    174174                        uint32_t size );
    175175
  • trunk/hal/generic/hal_special.h

    r480 r619  
    8484 * This function returns the current value of stack pointer from core register.
    8585 ****************************************************************************************/
    86 uint32_t hal_get_stack( void );
     86uint32_t hal_get_sp( void );
     87
     88/*****************************************************************************************
     89 * This function returns the current value of the return adddress from core register.
     90 ****************************************************************************************/
     91uint32_t hal_get_ra( void );
    8792
    8893/*****************************************************************************************
    8994 * This function registers a new value in the core stack pointer and returns previous one.
    9095 ****************************************************************************************/
    91 inline uint32_t hal_set_stack( void * new_val );
     96inline uint32_t hal_set_sp( void * new_val );
    9297
    9398/*****************************************************************************************
  • trunk/hal/tsar_mips32/core/hal_exception.c

    r611 r619  
    219219uint32_t cycle = (uint32_t)hal_get_cycles();
    220220if( DEBUG_HAL_EXCEPTIONS < cycle )
    221 printk("\n[%s] thread[%x,%x] on core [%x,%x] enter / is_ins %d / %s / vaddr %x / cycle %d\n",
     221printk("\n[%s] thread[%x,%x] on core [%x,%x] enter\n is_ins %d / %s / vaddr %x / cycle %d\n",
    222222__FUNCTION__, process->pid, this->trdid, local_cxy, this->core->lid,
    223223is_ins, hal_mmu_exception_str(excp_code), bad_vaddr, cycle);
     
    242242cycle = (uint32_t)hal_get_cycles();
    243243if( DEBUG_HAL_EXCEPTIONS < cycle )
    244 printk("\n[%s] thread[%x,%x] on core [%x,%x] exit / page-fault handled for vaddr = %x\n",
     244printk("\n[%s] thread[%x,%x] on core [%x,%x] exit\n page-fault handled for vaddr = %x\n",
    245245__FUNCTION__, process->pid, this->trdid, local_cxy, this->core->lid, bad_vaddr );
    246246#endif
     
    342342
    343343//////////////////////////////////////////////////////////////////////////////////////////
    344 // This static function prints on the kernel terminal the saved context (core registers)
     344// This function prints on the kernel terminal the saved context (core registers)
    345345// and the thread state of a faulty thread.
    346346//////////////////////////////////////////////////////////////////////////////////////////
    347347// @ this     : pointer on faulty thread descriptor.
    348 // @ uzone    : pointer on register array.
    349348// @ error    : EXCP_USER_ERROR or EXCP_KERNEL_PANIC
    350349//////////////////////////////////////////////////////////////////////////////////////////
    351350static void hal_exception_dump( thread_t * this,
    352                                 reg_t    * uzone,
    353351                                error_t    error )
    354352{
    355353    core_t    * core    = this->core;
    356354    process_t * process = this->process;
     355    reg_t     * uzone   = this->uzone_current;
    357356
    358357    // get pointers on TXT0 chdev
     
    399398        uzone[UZ_S0], uzone[UZ_S1], uzone[UZ_S2], uzone[UZ_S3], uzone[UZ_S4] );
    400399 
    401     nolock_printk("s5_21   %X  s6_22   %X  s7_23  %X  s8_24  %X  ra_25  %X\n",
     400    nolock_printk("s5_21   %X  s6_22   %X  s7_23  %X  t8_24  %X  t9_25  %X\n",
    402401        uzone[UZ_S5], uzone[UZ_S6], uzone[UZ_S7], uzone[UZ_T8], uzone[UZ_T9] );
    403402
     
    508507        if( error == EXCP_USER_ERROR )          //  user error => kill user process
    509508        {
    510         hal_exception_dump( this , uzone , error );
     509        hal_exception_dump( this , error );
    511510
    512511        sys_exit( EXIT_FAILURE );
     
    514513    else if( error == EXCP_KERNEL_PANIC )   // kernel error => kernel panic
    515514    {
    516         hal_exception_dump( this , uzone , error );
     515        hal_exception_dump( this , error );
    517516
    518517        hal_core_sleep();
  • trunk/hal/tsar_mips32/core/hal_special.c

    r570 r619  
    2525#include <hal_kernel_types.h>
    2626#include <hal_special.h>
     27#include <hal_exception.h>
    2728#include <core.h>
    2829#include <thread.h>
     
    145146}
    146147
    147 //////////////////////////////
    148 uint32_t hal_get_stack( void )
     148///////////////////////////
     149uint32_t hal_get_sp( void )
    149150{
    150151        register uint32_t sp;
     
    155156}
    156157
    157 ////////////////////////////////////////
    158 uint32_t hal_set_stack( void * new_val )
     158/////////////////////////////////////
     159uint32_t hal_set_sp( void * new_val )
    159160{
    160161        register uint32_t sp;
     
    168169}
    169170
     171///////////////////////////
     172uint32_t hal_get_ra( void )
     173{
     174        register uint32_t ra;
     175 
     176        asm volatile ("or    %0,   $0,   $31" : "=&r" (ra));
     177 
     178        return ra;
     179}
     180
    170181//////////////////////////////////
    171182uint32_t hal_get_bad_vaddr( void )
     
    216227void hal_core_sleep( void )
    217228{
     229    thread_t * this = CURRENT_THREAD;
     230
     231    printk("\n*** thread[%x,%x] on core[%x,%d]/n"
     232           "  sr = %X / sp = %X / ra = %X\n",
     233           this->process->pid, this->trdid, local_cxy, this->core->lid, 
     234           hal_get_sr(), hal_get_sp(), hal_get_ra() );
     235
    218236        while( 1 ) asm volatile ("nop");
    219237}
  • trunk/hal/tsar_mips32/drivers/soclib_tty.c

    r570 r619  
    131131#endif
    132132
     133#if( DEBUG_HAL_TXT_TX || DEBUG_HAL_TXT_RX )
     134thread_t * this = CURRENT_THREAD;
     135#endif
     136
    133137    // get TXT device cluster and pointers
    134138    xptr_t     dev_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->txt_cmd.dev_xp ) );
     
    160164
    161165#if DEBUG_HAL_TXT_TX
    162 uint32_t tx_cycle = (uint32_t)hal_get_cycles();
     166uint32_t   tx_cycle = (uint32_t)hal_get_cycles();
    163167if( DEBUG_HAL_TXT_TX < tx_cycle )
    164 printk("\n[DBG] %s : thread %x put character <%c> to TXT%d_TX fifo / cycle %d\n",
    165 __FUNCTION__, CURRENT_THREAD, byte, channel, tx_cycle );
     168printk("\n[%s] thread[%x,%x] put character <%c> to TXT%d_TX fifo / cycle %d\n",
     169__FUNCTION__, this->process->pid, this->trdid, byte, channel, tx_cycle );
    166170#endif
    167171                // write byte to FIFO
     
    195199    }
    196200    ///////////////////////////
    197     else if( type == TXT_READ )       // read bytes from TTY_RX FIFO   
     201    else if( type == TXT_READ )       // read several bytes from TTY_RX FIFO   
    198202    {
    199203        fifo = &tty_rx_fifo[channel];
     
    211215uint32_t rx_cycle = (uint32_t)hal_get_cycles();
    212216if( DEBUG_HAL_TXT_RX < rx_cycle )
    213 printk("\n[DBG] %s : thread %x get character <%c> from TXT%d_RX fifo / cycle %d\n",
    214 __FUNCTION__, CURRENT_THREAD, byte, channel, rx_cycle );
     217printk("\n[%s] thread[%x,%x] get character <%c> from TXT%d_RX fifo / cycle %d\n",
     218__FUNCTION__, this->process->pid, this->trdid, byte, channel, rx_cycle );
    215219#endif
    216220                // update FIFO state
     
    328332#if DEBUG_HAL_TXT_RX
    329333if( DEBUG_HAL_TXT_RX < rx_cycle )
    330 printk("\n[DBG] %s : read ^Z character from TXT%d\n", __FUNCTION__, channel );
     334printk("\n[%s] read ^Z character from TXT%d\n", __FUNCTION__, channel );
    331335#endif
    332336                // get pointers on TXT owner process in owner cluster
     
    381385#if DEBUG_HAL_TXT_RX
    382386if( DEBUG_HAL_TXT_RX < rx_cycle )
    383 printk("\n[DBG] %s : read ^C character from TXT%d\n", __FUNCTION__, channel );
     387printk("\n[%s] read ^C character from TXT%d\n", __FUNCTION__, channel );
    384388#endif
    385389                // get pointer on TXT owner process in owner cluster
     
    434438#if DEBUG_HAL_TXT_RX
    435439if( DEBUG_HAL_TXT_RX < rx_cycle )
    436 printk("\n[DBG] %s : put character <%c> to TXT%d_RX fifo\n",
     440printk("\n[%s] put character <%c> to TXT%d_RX fifo\n",
    437441__FUNCTION__, byte, channel );
    438442#endif
     
    481485#if DEBUG_HAL_TXT_TX
    482486if( DEBUG_HAL_TXT_TX < tx_cycle )
    483 printk("\n[DBG] %s : get character <%c> from TXT%d_TX fifo\n",
     487printk("\n[%s] get character <%c> from TXT%d_TX fifo\n",
    484488__FUNCTION__, byte, channel );
    485489#endif
Note: See TracChangeset for help on using the changeset viewer.