mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-11 13:03:15 +00:00
hv: fix e820.c violations
fix e820.c violations related misra c. Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
This commit is contained in:
parent
60f78e1e70
commit
93e588bc7e
@ -121,6 +121,7 @@ uint64_t e820_alloc_low_memory(uint32_t size_arg)
|
|||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t size = size_arg;
|
uint32_t size = size_arg;
|
||||||
|
uint64_t ret = ACRN_INVALID_HPA;
|
||||||
struct e820_entry *entry, *new_entry;
|
struct e820_entry *entry, *new_entry;
|
||||||
|
|
||||||
/* We want memory in page boundary and integral multiple of pages */
|
/* We want memory in page boundary and integral multiple of pages */
|
||||||
@ -144,7 +145,8 @@ uint64_t e820_alloc_low_memory(uint32_t size_arg)
|
|||||||
if (length == size) {
|
if (length == size) {
|
||||||
entry->type = E820_TYPE_RESERVED;
|
entry->type = E820_TYPE_RESERVED;
|
||||||
e820_mem.total_mem_size -= size;
|
e820_mem.total_mem_size -= size;
|
||||||
return start;
|
ret = start;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -161,11 +163,14 @@ uint64_t e820_alloc_low_memory(uint32_t size_arg)
|
|||||||
e820_mem.total_mem_size -= new_entry->length;
|
e820_mem.total_mem_size -= new_entry->length;
|
||||||
e820_entries_count++;
|
e820_entries_count++;
|
||||||
|
|
||||||
return new_entry->baseaddr;
|
ret = new_entry->baseaddr;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_fatal("Can't allocate memory under 1M from E820\n");
|
if (ret == ACRN_INVALID_HPA) {
|
||||||
return ACRN_INVALID_HPA;
|
pr_fatal("Can't allocate memory under 1M from E820\n");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HV read multiboot header to get e820 entries info and calc total RAM info */
|
/* HV read multiboot header to get e820 entries info and calc total RAM info */
|
||||||
|
Loading…
Reference in New Issue
Block a user