kernel: demand_paging: clear BSS after paging is initialized
If BSS section is not present in memory at boot, it would not have been cleared as the data pages are not in physical memory. Manipulating those pages would result in page faults. In this scenario, zeroing BSS can only be done once the paging mechanism has been initialized. So do it there. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
6a006d71b7
commit
f32ea4433c
10
kernel/mmu.c
10
kernel/mmu.c
|
@ -797,6 +797,16 @@ void z_mem_manage_init(void)
|
|||
page_frames_initialized = true;
|
||||
#endif
|
||||
k_spin_unlock(&z_mm_lock, key);
|
||||
|
||||
#ifndef CONFIG_LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT
|
||||
/* If BSS section is not present in memory at boot,
|
||||
* it would not have been cleared. This needs to be
|
||||
* done now since paging mechanism has been initialized
|
||||
* and the BSS pages can be brought into physical
|
||||
* memory to be cleared.
|
||||
*/
|
||||
z_bss_zero();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEMAND_PAGING
|
||||
|
|
Loading…
Reference in a new issue