[libcpu][risc-v]add comments for rt_hw_mem_setup_early. (#10102)

This commit is contained in:
Guorui Li 2025-03-12 09:40:46 +08:00 committed by GitHub
parent 79c93b6571
commit 5a09694f05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 0 deletions

View File

@ -630,6 +630,19 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr)
}
#define SATP_BASE ((rt_ubase_t)SATP_MODE << SATP_MODE_OFFSET)
/**
* @brief Early memory setup function for hardware initialization.
*
* This function performs early memory setup tasks, including:
* - Calculating the physical-to-virtual (PV) offset.
* - Setting up initial page tables for identity mapping and text region relocation.
* - Applying new memory mappings by updating the SATP register.
*
* @note This function is typically called during the early stages of system initialization (startup_gcc.S),
* before the memory management system is fully operational.
* Here the identity mapping is implemented by a 1-stage page table, whose page size is 1GB.
*/
void rt_hw_mem_setup_early(void)
{
rt_ubase_t pv_off;