Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (5 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

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

    r406 r407  
    2929#include <hal_special.h>
    3030#include <hal_ppm.h>
     31#include <remote_fifo.h>
    3132#include <printk.h>
    3233#include <errno.h>
     
    7778    // initialize cluster local parameters
    7879        cluster->cores_nr        = info->cores_nr;
    79     cluster->cores_in_kernel = 0;
    8080
    8181    // initialize the lock protecting the embedded kcm allocator
    8282        spinlock_init( &cluster->kcm_lock );
    8383
    84     cluster_dmsg("\n[DMSG] %s for cluster %x enters\n",
    85                  __FUNCTION__ , local_cxy );
     84cluster_dmsg("\n[DBG] %s for cluster %x enters\n",
     85__FUNCTION__ , local_cxy );
    8686
    8787    // initialises DQDT
     
    102102    }
    103103
    104     cluster_dmsg("\n[DMSG] %s : PPM initialized in cluster %x at cycle %d\n",
    105                  __FUNCTION__ , local_cxy , hal_get_cycles() );
     104cluster_dmsg("\n[DBG] %s : PPM initialized in cluster %x at cycle %d\n",
     105__FUNCTION__ , local_cxy , hal_get_cycles() );
    106106
    107107    // initialises embedded KHM
    108108        khm_init( &cluster->khm );
    109109
    110     cluster_dmsg("\n[DMSG] %s : KHM initialized in cluster %x at cycle %d\n",
     110    cluster_dmsg("\n[DBG] %s : KHM initialized in cluster %x at cycle %d\n",
    111111                 __FUNCTION__ , local_cxy , hal_get_cycles() );
    112112
     
    114114        kcm_init( &cluster->kcm , KMEM_KCM );
    115115
    116     cluster_dmsg("\n[DMSG] %s : KCM initialized in cluster %x at cycle %d\n",
     116    cluster_dmsg("\n[DBG] %s : KCM initialized in cluster %x at cycle %d\n",
    117117                 __FUNCTION__ , local_cxy , hal_get_cycles() );
    118118
     
    125125        }
    126126
    127     cluster_dmsg("\n[DMSG] %s : cores initialized in cluster %x at cycle %d\n",
    128                  __FUNCTION__ , local_cxy , hal_get_cycles() );
     127cluster_dmsg("\n[DBG] %s : cores initialized in cluster %x at cycle %d\n",
     128__FUNCTION__ , local_cxy , hal_get_cycles() );
    129129
    130130    // initialises RPC fifo
    131         rpc_fifo_init( &cluster->rpc_fifo );
     131        local_fifo_init( &cluster->rpc_fifo );
    132132    cluster->rpc_threads = 0;
    133133
    134     cluster_dmsg("\n[DMSG] %s : RPC fifo inialized in cluster %x at cycle %d\n",
    135                  __FUNCTION__ , local_cxy , hal_get_cycles() );
     134cluster_dmsg("\n[DBG] %s : RPC fifo inialized in cluster %x at cycle %d\n",
     135__FUNCTION__ , local_cxy , hal_get_cycles() );
    136136
    137137    // initialise pref_tbl[] in process manager
     
    157157    }
    158158
    159     cluster_dmsg("\n[DMSG] %s Process Manager initialized in cluster %x at cycle %d\n",
    160                  __FUNCTION__ , local_cxy , hal_get_cycles() );
     159cluster_dmsg("\n[DBG] %s Process Manager initialized in cluster %x at cycle %d\n",
     160__FUNCTION__ , local_cxy , hal_get_cycles() );
    161161
    162162    hal_fence();
     
    184184//  Cores related functions
    185185////////////////////////////////////////////////////////////////////////////////////
    186 
    187 ////////////////////////////////
    188 void cluster_core_kernel_enter()
    189 {
    190     cluster_t * cluster = LOCAL_CLUSTER;
    191         hal_atomic_add( &cluster->cores_in_kernel , 1 );
    192 }
    193 
    194 ///////////////////////////////
    195 void cluster_core_kernel_exit()
    196 {
    197     cluster_t * cluster = LOCAL_CLUSTER;
    198         hal_atomic_add( &cluster->cores_in_kernel , -1 );
    199 }
    200186
    201187/////////////////////////////////
     
    353339void cluster_process_local_link( process_t * process )
    354340{
     341    uint32_t irq_state;
    355342    pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
    356343
    357344    // get lock protecting the process manager local list
    358     remote_spinlock_lock( XPTR( local_cxy , &pm->local_lock ) );
     345    remote_spinlock_lock_busy( XPTR( local_cxy , &pm->local_lock ) , & irq_state );
    359346
    360347    xlist_add_first( XPTR( local_cxy , &pm->local_root ),
     
    363350
    364351    // release lock protecting the process manager local list
    365     remote_spinlock_unlock( XPTR( local_cxy , &pm->local_lock ) );
     352    remote_spinlock_unlock_busy( XPTR( local_cxy , &pm->local_lock ) , irq_state );
    366353}
    367354
     
    369356void cluster_process_local_unlink( process_t * process )
    370357{
     358    uint32_t irq_state;
    371359    pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
    372360
    373361    // get lock protecting the process manager local list
    374     remote_spinlock_lock( XPTR( local_cxy , &pm->local_lock ) );
     362    remote_spinlock_lock_busy( XPTR( local_cxy , &pm->local_lock ) , &irq_state );
    375363
    376364    xlist_unlink( XPTR( local_cxy , &process->local_list ) );
     
    378366
    379367    // release lock protecting the process manager local list
    380     remote_spinlock_unlock( XPTR( local_cxy , &pm->local_lock ) );
     368    remote_spinlock_unlock_busy( XPTR( local_cxy , &pm->local_lock ) , irq_state );
    381369}
    382370
     
    384372void cluster_process_copies_link( process_t * process )
    385373{
     374    uint32_t irq_state;
    386375    pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
    387376
     
    401390
    402391    // get lock protecting copies_list[lpid]
    403     remote_spinlock_lock( copies_lock );
     392    remote_spinlock_lock_busy( copies_lock , &irq_state );
    404393
    405394    xlist_add_first( copies_root , copies_entry );
     
    407396
    408397    // release lock protecting copies_list[lpid]
    409     remote_spinlock_unlock( copies_lock );
     398    remote_spinlock_unlock_busy( copies_lock , irq_state );
    410399}
    411400
     
    413402void cluster_process_copies_unlink( process_t * process )
    414403{
     404    uint32_t irq_state;
    415405    pmgr_t * pm = &LOCAL_CLUSTER->pmgr;
    416406
     
    427417
    428418    // get lock protecting copies_list[lpid]
    429     remote_spinlock_lock( copies_lock );
     419    remote_spinlock_lock_busy( copies_lock , &irq_state );
    430420
    431421    xlist_unlink( copies_entry );
     
    433423
    434424    // release lock protecting copies_list[lpid]
    435     remote_spinlock_unlock( copies_lock );
     425    remote_spinlock_unlock_busy( copies_lock , irq_state );
    436426}
    437427
Note: See TracChangeset for help on using the changeset viewer.