Version 2 (modified by 10 years ago) (diff) | ,
---|
GIET_VM / Kernel Initialisation
The 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.
It makes the following assuptions, regarding the work done by the boot-loader:
- The page tables associated to the various vspaces have been build in physical memory.
- All schedulers (including all task contexts) have been initialised.
- For each task, the page table virtual address is stored in the CTX_PTAB slot.
- For each task, the page table physical address is stored in the CTX_PTPR slots.
- The CP0_SCHED register of each processor contains a pointer on its private scheduler (virtual address).
- The CP2_PTPR register contains a pointer on the page table of vspace[0] (physical address>>13).
- For all processors, the MMU is activated (CP2_MODE contains 0xF).
Each processor performs the following actions:
- contribute to _schedulers_paddr[] array initialisation.
- contribute to _ptabs_paddr[] and _ptabs_vaddr arrays initialisation.
- completes task context initialisation for each allocated task.
- compute and set the XCU mask for its private XCU channel.
- initialise its private TICK timer (if tasks > 0)
- initialise the "idle" task context in its private scheduler
- initialise SP, SR, PTPR, EPC registers and jump to user code with an eret.
This kernel_init code must be loaded in the .kinit section, in order to control the seg_kinit_base value that is used by the boot code to jump into kernel code.