Changes between Version 1 and Version 2 of kernel_switch


Ignore:
Timestamp:
Aug 12, 2015, 5:22:21 PM (9 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_switch

    v1 v2  
    44
    55The [source:soft/giet_vm/giet_kernel/ctx_handler.c ctx_handler.c] and [source:soft/giet_vm/giet_kernel/ctx_handler.h ctx_handler.h] files define the data structure and functions used to handle context switching. They are prefixed by "_" to remind that they can only be executed by a processor in kernel mode.
     6
     7A GIET_VM task is  similar to a POSIX thread. A task is statically allocated to a physical processor, as defined in the mapping, and the GIET-VM does not support task migration. There is one scheduler per processor, and the max number of task on one single processor cannot be larger than 13. A task can be in three different states:
     8 * '''RUNNING''' the task is currently executed.
     9 * '''RUNABLE''' the task is not running, but can be selected for execution at the next TICK.
     10 * '''BLOCKED''' the task is blocked, waiting on a condition defined in the NORUN context slot.
    611
    712A task context is an array of 64 words = 256 bytes.
     
    1116 * CP0 registers : EPC, SR, CR, BVAR
    1217 * CP2 registers : PTPR
     18
    1319It contains some general informations associated to the task:
    14  * TTY    : TTY channel global index
    15  * NIC    : NIC channel global index
    16  * CMA    : CMA channel global index
    17  * HBA    : HBA channel global index
    18  * DMA    : DMA channel local index
    19  * TIM    : TIM channel local index
    20  * PTAB   : page table virtual base address
    21  * LTID   : Task local index (in scheduler)
    22  * VSID   : Virtual space index
    23  * RUN    : Task state (0 => sleeping / 1 => runnable )
    24  * TRDID  : Thread ID index (in vspace)
     20 * TTY   : TTY channel allocated to the task
     21 * NIC_RX  : NIC_RX channel allocated to the task
     22 * NIC_TX  : NIC_TX channel allocated to the task
     23 * CMA_RX  : CMA channel for NIC_RX allocated to the task
     24 * CMA_TX  : CMA channel for NIC_TX allocated to the task
     25 * CBA_FB   : CMA channel for FBF display allocated to the task
     26 * HBA  : HBA channel local index
     27 * TIM  : TIM channel local index
     28 * PTAB  : page table virtual base address
     29 * LTID  : Task local index (in scheduler)
     30 * VSID  : Virtual space index
     31 * N0RUN    : bit-vector defining the task state ( non zero => blocked / 0  => runnable )
     32 * TRDID  : Thread index (in vspace)
     33 * SIGNAL  : bit-vector (inter-tasks signalisation)
     34 * ENTRY  : Virtual address of task entry point
     35 * COPROC  : cluster_xy : coordinates of coprocessor allocated to the task
    2536
    26 || [0] ***   || [8]   $8    || [16] $16   || [24] $24  || [32] EPC   || [40] TTY   || [48] TRDID ||
    27 || [1] $1    || [9]   $9    || [17] $17  || [25] $25  || [33] CR     || [41] DMA  || [49] ***      ||
    28 || [2] $2    || [10] $10  || [18] $18  || [26]  LO   || [34] SR      || [42] NIC   || [50] ***      ||
    29 || [3] $3    || [11] $11  || [19] $19  || [27]  HI    || [35] BVAR  || [43] TIM  || [51] ***      ||
    30 || [4] $4    || [12] $12  || [20] $20  || [28] $28  || [36] PTAB  || [44] HBA  || [52] ***      ||
    31 || [5] $5    || [13] $13  || [21] $21  || [29] SP     || [37] LTID  || [45] CMA || [53] ***      ||
    32 || [6] $6    || [14] $14  || [22] $22  || [30] $30  || [38] VSID  || [46] GTID || [54] ***      ||   
    33 || [7] $7    || [15] $15  || [23] $23  || [31] RA    || [39] PTPR   || [47] RUN  || [55] ***      ||
     37|| [0] ***   || [8]   $8    || [16] $16   || [24] $24  || [32] EPC    || [40] TTY         || [48] TRDID      ||
     38|| [1] $1    || [9]   $9    || [17] $17  || [25] $25  || [33] CR      || [41] CMA_FB  || [49] GTID        ||
     39|| [2] $2    || [10] $10  || [18] $18  || [26]  LO   || [34] SR      || [42] CMA_RX  || [50] NORUN   ||
     40|| [3] $3    || [11] $11  || [19] $19  || [27]  HI    || [35] BVAR  || [43] CMA_TX  || [51] COPROC ||
     41|| [4] $4    || [12] $12  || [20] $20  || [28] $28   || [36] PTAB  || [44] NIC_RX   || [52] ENTRY     ||
     42|| [5] $5    || [13] $13  || [21] $21  || [29] SP    || [37] LTID    || [45] NIC_TX   || [53] SIGNAL    ||
     43|| [6] $6    || [14] $14  || [22] $22  || [30] $30   || [38] VSID   || [46] TIM         || [54] ***            ||   
     44|| [7] $7    || [15] $15  || [23] $23  || [31] RA    || [39] PTPR  || [47] HBA        || [55] ***            ||
    3445
    3546
     
    4253The return address contained in $31 is saved in the current task context (in the ctx[31] slot), and the function actually returns to the address contained in the ctx[31] slot of the next task context.
    4354
     55 === void _ctx_exec_task( unsigned int
    4456 === void _ctx_eret() ===
    4557The address of this function is used to initialise the return address in the "idle" task context.
     
    4961
    5062
    51