summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrChat <arkolbed@gmail.com>2018-02-10 19:14:58 -0600
committerDrChat <arkolbed@gmail.com>2018-02-10 19:14:58 -0600
commite3787c05c14486cfcb6187d3a9cb11185ee98078 (patch)
treecf1d39bd175a8e33cdbe75aa0dbdf7cdecbc2d6a
parent325599948a81f8389a2f3485a00c78c0e5cfe885 (diff)
[Core] QueryRegionInfo - report the original allocation size
-rw-r--r--src/xenia/memory.cc7
-rw-r--r--src/xenia/memory.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc
index 516c155e6..9636b38e7 100644
--- a/src/xenia/memory.cc
+++ b/src/xenia/memory.cc
@@ -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 ||
diff --git a/src/xenia/memory.h b/src/xenia/memory.h
index 8f5e3b535..64f8c57e9 100644
--- a/src/xenia/memory.h
+++ b/src/xenia/memory.h
@@ -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;