diff --git a/hypervisor/arch/x86/guest/ept.c b/hypervisor/arch/x86/guest/ept.c index aa9608722..c86880c02 100644 --- a/hypervisor/arch/x86/guest/ept.c +++ b/hypervisor/arch/x86/guest/ept.c @@ -86,7 +86,7 @@ static void reserve_ept_bitmap(void) bitmap_size = (get_ept_page_num() * CONFIG_MAX_VM_NUM) / 8; bitmap_offset = get_ept_page_num() / 8; - bitmap_base = e820_alloc_memory(bitmap_size, ~0UL); + bitmap_base = e820_alloc_memory(bitmap_size, MEM_SIZE_MAX); set_paging_supervisor(bitmap_base, bitmap_size); for(i = 0; i < CONFIG_MAX_VM_NUM; i++){ @@ -103,7 +103,7 @@ void reserve_buffer_for_ept_pages(void) uint16_t vm_id; uint32_t offset = 0U; - page_base = e820_alloc_memory(get_total_ept_4k_pages_size(), ~0UL); + page_base = e820_alloc_memory(get_total_ept_4k_pages_size(), MEM_SIZE_MAX); set_paging_supervisor(page_base, get_total_ept_4k_pages_size()); for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) { ept_pages[vm_id] = (struct page *)(void *)(page_base + offset); diff --git a/hypervisor/arch/x86/guest/vept.c b/hypervisor/arch/x86/guest/vept.c index 6d0855484..baf8327ed 100644 --- a/hypervisor/arch/x86/guest/vept.c +++ b/hypervisor/arch/x86/guest/vept.c @@ -51,12 +51,12 @@ static void init_vept_pool(void) { uint64_t page_base; - page_base = e820_alloc_memory(calc_sept_size(), ~0UL); + page_base = e820_alloc_memory(calc_sept_size(), MEM_SIZE_MAX); set_paging_supervisor(page_base, calc_sept_size()); sept_pages = (struct page *)page_base; - sept_page_bitmap = (uint64_t*)e820_alloc_memory((calc_sept_page_num() / 64U), ~0UL); + sept_page_bitmap = (uint64_t *)e820_alloc_memory((calc_sept_page_num() / 64U), MEM_SIZE_MAX); } static bool is_present_ept_entry(uint64_t ept_entry) diff --git a/hypervisor/include/arch/x86/asm/e820.h b/hypervisor/include/arch/x86/asm/e820.h index 4562d3f8d..cb9be7225 100644 --- a/hypervisor/include/arch/x86/asm/e820.h +++ b/hypervisor/include/arch/x86/asm/e820.h @@ -18,6 +18,8 @@ #define E820_MAX_ENTRIES 64U +#define MEM_SIZE_MAX (~0UL) + /** Defines a single entry in an E820 memory map. */ struct e820_entry { /** The base address of the memory range. */