mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-03 01:06:53 +00:00
hv: minor fixes in init_paging()
- change variable name from hpa to hva because in this function we are dealing with hva, not hpa. - can get the address of ld_text_end by directly referring to this symbol, because relative addressing yields the correct hva, not the hva before relocation. Tracked-On: #4441 Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
parent
734ad6ce30
commit
93fa2bc0fc
@ -211,7 +211,7 @@ void hv_access_memory_region_update(uint64_t base, uint64_t size)
|
|||||||
|
|
||||||
void init_paging(void)
|
void init_paging(void)
|
||||||
{
|
{
|
||||||
uint64_t hv_hpa, text_end, size;
|
uint64_t hv_hva;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint64_t low32_max_ram = 0UL;
|
uint64_t low32_max_ram = 0UL;
|
||||||
uint64_t high64_max_ram;
|
uint64_t high64_max_ram;
|
||||||
@ -265,19 +265,17 @@ void init_paging(void)
|
|||||||
* Before the new PML4 take effect in enable_paging(), HPA->HVA is always 1:1 mapping,
|
* Before the new PML4 take effect in enable_paging(), HPA->HVA is always 1:1 mapping,
|
||||||
* simply treat the return value of get_hv_image_base() as HPA.
|
* simply treat the return value of get_hv_image_base() as HPA.
|
||||||
*/
|
*/
|
||||||
hv_hpa = get_hv_image_base();
|
hv_hva = get_hv_image_base();
|
||||||
mmu_modify_or_del((uint64_t *)ppt_mmu_pml4_addr, hv_hpa & PDE_MASK,
|
mmu_modify_or_del((uint64_t *)ppt_mmu_pml4_addr, hv_hva & PDE_MASK,
|
||||||
CONFIG_HV_RAM_SIZE + (((hv_hpa & (PDE_SIZE - 1UL)) != 0UL) ? PDE_SIZE : 0UL),
|
CONFIG_HV_RAM_SIZE + (((hv_hva & (PDE_SIZE - 1UL)) != 0UL) ? PDE_SIZE : 0UL),
|
||||||
PAGE_CACHE_WB, PAGE_CACHE_MASK | PAGE_USER, &ppt_mem_ops, MR_MODIFY);
|
PAGE_CACHE_WB, PAGE_CACHE_MASK | PAGE_USER, &ppt_mem_ops, MR_MODIFY);
|
||||||
|
|
||||||
size = ((uint64_t)&ld_text_end - hv_hpa);
|
|
||||||
text_end = hv_hpa + size;
|
|
||||||
/*
|
/*
|
||||||
* remove 'NX' bit for pages that contain hv code section, as by default XD bit is set for
|
* remove 'NX' bit for pages that contain hv code section, as by default XD bit is set for
|
||||||
* all pages, including pages for guests.
|
* all pages, including pages for guests.
|
||||||
*/
|
*/
|
||||||
mmu_modify_or_del((uint64_t *)ppt_mmu_pml4_addr, round_pde_down(hv_hpa),
|
mmu_modify_or_del((uint64_t *)ppt_mmu_pml4_addr, round_pde_down(hv_hva),
|
||||||
round_pde_up(text_end) - round_pde_down(hv_hpa), 0UL,
|
round_pde_up((uint64_t)&ld_text_end) - round_pde_down(hv_hva), 0UL,
|
||||||
PAGE_NX, &ppt_mem_ops, MR_MODIFY);
|
PAGE_NX, &ppt_mem_ops, MR_MODIFY);
|
||||||
|
|
||||||
mmu_modify_or_del((uint64_t *)ppt_mmu_pml4_addr, (uint64_t)get_reserve_sworld_memory_base(),
|
mmu_modify_or_del((uint64_t *)ppt_mmu_pml4_addr, (uint64_t)get_reserve_sworld_memory_base(),
|
||||||
|
Loading…
Reference in New Issue
Block a user