Skip to content

Commit 5a09694

Browse files
authored
[libcpu][risc-v]add comments for rt_hw_mem_setup_early. (#10102)
1 parent 79c93b6 commit 5a09694

File tree

1 file changed

+13
-0
lines changed
  • libcpu/risc-v/common64

1 file changed

+13
-0
lines changed

libcpu/risc-v/common64/mmu.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,19 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr)
630630
}
631631

632632
#define SATP_BASE ((rt_ubase_t)SATP_MODE << SATP_MODE_OFFSET)
633+
634+
/**
635+
* @brief Early memory setup function for hardware initialization.
636+
*
637+
* This function performs early memory setup tasks, including:
638+
* - Calculating the physical-to-virtual (PV) offset.
639+
* - Setting up initial page tables for identity mapping and text region relocation.
640+
* - Applying new memory mappings by updating the SATP register.
641+
*
642+
* @note This function is typically called during the early stages of system initialization (startup_gcc.S),
643+
* before the memory management system is fully operational.
644+
* Here the identity mapping is implemented by a 1-stage page table, whose page size is 1GB.
645+
*/
633646
void rt_hw_mem_setup_early(void)
634647
{
635648
rt_ubase_t pv_off;

0 commit comments

Comments
 (0)