| | 1 | = GIET_VM / Kernel Initialisation = |
| | 2 | |
| | 3 | |
| | 4 | The [source:soft/giet_vm/giet_kernel/kernel_init.c kernel_init()] function completes the system initialisation, that has been done by the boot-loader running on processor[0,0,0]. This kernel_init() function is executed sequencially by all processors. |
| | 5 | |
| | 6 | It makes the following assuptions, regarding the work done by the boot-loader: |
| | 7 | |
| | 8 | * The page tables associated to the various vspaces have been build in physical memory. |
| | 9 | * All schedulers (including all task contexts) have been initialised. |
| | 10 | * For each task, the page table virtual address is stored in the CTX_PTAB slot. |
| | 11 | * For each task, the page table physical address is stored in the CTX_PTPR slots. |
| | 12 | * The CP0_SCHED register of each processor contains a pointer on its private scheduler (virtual address). |
| | 13 | * The CP2_PTPR register contains a pointer on the page table of vspace[0] (physical address>>13). |
| | 14 | * For all processors, the MMU is activated (CP2_MODE contains 0xF). |
| | 15 | |
| | 16 | Each processor performs the following actions: |
| | 17 | 1. contribute to _schedulers_paddr[] array initialisation. |
| | 18 | 2. contribute to _ptabs_paddr[] and _ptabs_vaddr arrays initialisation. |
| | 19 | 3. completes task context initialisation for each allocated task. |
| | 20 | 4. compute and set the XCU mask for its private XCU channel. |
| | 21 | 5. initialise its private TICK timer (if tasks > 0) |
| | 22 | 6. initialise the "idle" task context in its private scheduler |
| | 23 | 7. initialise SP, SR, PTPR, EPC registers and jump to user code with an eret. |
| | 24 | |
| | 25 | This kernel_init code must be loaded in .kinit section, in order to control the seg_kinit_base value that is used by the boot code to jump into kernel code. |
| | 26 | |
| | 27 | |