[Core] QueryRegionInfo - report the original allocation size

This commit is contained in:
DrChat 2018-02-10 19:14:58 -06:00
parent 325599948a
commit e3787c05c1
2 changed files with 8 additions and 1 deletions

View File

@ -1100,10 +1100,15 @@ bool BaseHeap::QueryRegionInfo(uint32_t base_address,
// Committed/reserved region.
out_info->allocation_base = start_page_entry.base_address * page_size_;
out_info->allocation_protect = start_page_entry.allocation_protect;
out_info->allocation_size = start_page_entry.region_page_count * page_size_;
out_info->state = start_page_entry.state;
out_info->protect = start_page_entry.current_protect;
// Scan forward and report the size of the region matching the initial
// base address's attributes.
for (uint32_t page_number = start_page_number;
page_number < start_page_number + start_page_entry.region_page_count;
page_number <
start_page_entry.base_address + start_page_entry.region_page_count;
++page_number) {
auto page_entry = page_table_[page_number];
if (page_entry.base_address != start_page_entry.base_address ||

View File

@ -56,6 +56,8 @@ struct HeapAllocationInfo {
uint32_t allocation_base;
// The memory protection option when the region was initially allocated.
uint32_t allocation_protect;
// The size specified when the region was initially allocated, in bytes.
uint32_t allocation_size;
// The size of the region beginning at the base address in which all pages
// have identical attributes, in bytes.
uint32_t region_size;