Changes between Version 4 and Version 5 of kernel_switch


Ignore:
Timestamp:
Dec 5, 2016, 12:14:52 AM (7 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_switch

    v4 v5  
    1 = GIET-VM / Context Switch Handler =
     1= GIET-VM / Context Handler =
    22
    33[[PageOutline]]
    44
    5 The [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.
     5The [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 threads contexts. They are prefixed by "_" to remind that they can only be executed by a processor in kernel mode.
    66
    7 A 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.
     7The GIET_VM threads try to implement the POSIX threads. A thread is statically allocated to a physical processor, as defined in the mapping, and the GIET-VM does not support thread migration. There is one scheduler per processor, and the max number of threads on one single processor cannot be larger than 13. A thread can be in three different states:
     8 * '''RUNNING''' the thread is currently executed.
     9 * '''RUNNABLE''' the thread is not running, but can be selected for execution at the next TICK.
     10 * '''BLOCKED''' the thread is blocked, waiting on a condition defined in the NORUN context slot.
    1111
    12 A task context is an array of 64 words = 256 bytes.
    13 It contains copies of processor registers (when the task is preempted):
     12A thread context is an array of 64 words = 256 bytes.
     13It contains copies of processor registers (when the thread is preempted):
    1414 * GPR[i] : generally stored in slot (i). $0, $26 & $27 are not saved.
    1515 * HI & LO registers : used by multiply/divide instructions.
     
    3333 * SIGNAL  : bit-vector (inter-tasks signalisation)
    3434 * ENTRY  : Virtual address of task entry point
    35  * COPROC  : cluster_xy : coordinates of coprocessor allocated to the task
     35 * COPROC  : cluster_xy defines the coordinates of coprocessor allocated to the thread
    3636
    3737|| [0] ***   || [8]   $8    || [16] $16   || [24] $24  || [32] EPC    || [40] TTY         || [48] TRDID      ||
     
    4545
    4646
    47 
    4847 === void '''_ctx_switch'''() ===
    49 This function performs a context switch between the running (calling) task and  another runable task, using a round-robin sheduling policy between all tasks allocated to a given processor (static allocation).
    50 It selects the next runable task to resume execution.
    51 If the only runable task is the current task, return without context switch.
    52 If there is no runable task, the scheduler switch to the default "idle" task.
    53 The 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.
    54 
    55  === void '''_ctx_exec_task'''( unsigned int ltid )
    56 
    57  === void '''_ctx_kill_task'''( unsigned int ltid )
     48This function performs a context switch between the running (calling) thread and  another runnable thread, using a round-robin sheduling policy between all threads allocated to a given processor (static allocation).
     49It selects the next runable thread to resume execution.
     50If the only runnable task is the current task, return without context switch.
     51If there is no runable task, the scheduler switch to the default "idle" thread.
     52The return address contained in $31 is saved in the current thread context (in the ctx[31] slot), and the function actually returns to the address contained in the ctx[31] slot of the next thread context.
    5853
    5954 === void '''_ctx_eret'''() ===
    6055The address of this function is used to initialise the return address in the "idle" task context.
    6156
    62  === void _idle_task() ===
    63 This function is executed task when no other task can be executed.
     57 === void _idle_thread() ===
     58This function is executed when no other thread can be executed.
    6459
    6560