Allow AllocFixed of unreserved ranges.
This commit is contained in:
parent
d97a6d1929
commit
c4ef5d4eb8
|
@ -484,7 +484,10 @@ void CommandProcessor::UpdateWritePointer(uint32_t value) {
|
||||||
|
|
||||||
void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
|
void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
|
||||||
RegisterFile* regs = register_file_;
|
RegisterFile* regs = register_file_;
|
||||||
assert_true(index < RegisterFile::kRegisterCount);
|
if (index >= RegisterFile::kRegisterCount) {
|
||||||
|
XELOGW("CommandProcessor::WriteRegister index out of bounds: %d", index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
regs->values[index].u32 = value;
|
regs->values[index].u32 = value;
|
||||||
|
|
||||||
|
|
|
@ -560,7 +560,7 @@ bool BaseHeap::AllocFixed(uint32_t base_address, uint32_t size,
|
||||||
uint32_t end_page_number = start_page_number + page_count - 1;
|
uint32_t end_page_number = start_page_number + page_count - 1;
|
||||||
if (start_page_number >= page_table_.size() ||
|
if (start_page_number >= page_table_.size() ||
|
||||||
end_page_number > page_table_.size()) {
|
end_page_number > page_table_.size()) {
|
||||||
XELOGE("BaseHeap::Alloc passed out of range address range");
|
XELOGE("BaseHeap::AllocFixed passed out of range address range");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,14 +575,18 @@ bool BaseHeap::AllocFixed(uint32_t base_address, uint32_t size,
|
||||||
uint32_t state = page_table_[page_number].state;
|
uint32_t state = page_table_[page_number].state;
|
||||||
if ((allocation_type == kMemoryAllocationReserve) && state) {
|
if ((allocation_type == kMemoryAllocationReserve) && state) {
|
||||||
// Already reserved.
|
// Already reserved.
|
||||||
XELOGE("BaseHeap::Alloc attempting to reserve an already reserved range");
|
XELOGE(
|
||||||
|
"BaseHeap::AllocFixed attempting to reserve an already reserved "
|
||||||
|
"range");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((allocation_type == kMemoryAllocationCommit) &&
|
if ((allocation_type == kMemoryAllocationCommit) &&
|
||||||
!(state & kMemoryAllocationReserve)) {
|
!(state & kMemoryAllocationReserve)) {
|
||||||
// Attempting a commit-only op on an unreserved page.
|
// Attempting a commit-only op on an unreserved page.
|
||||||
XELOGE("BaseHeap::Alloc attempting commit on unreserved page");
|
// This may be OK.
|
||||||
return false;
|
XELOGW("BaseHeap::AllocFixed attempting commit on unreserved page");
|
||||||
|
allocation_type |= kMemoryAllocationReserve;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +603,7 @@ bool BaseHeap::AllocFixed(uint32_t base_address, uint32_t size,
|
||||||
page_count * page_size_, flAllocationType,
|
page_count * page_size_, flAllocationType,
|
||||||
ToWin32ProtectFlags(protect));
|
ToWin32ProtectFlags(protect));
|
||||||
if (!result) {
|
if (!result) {
|
||||||
XELOGE("BaseHeap::Alloc failed to alloc range from host");
|
XELOGE("BaseHeap::AllocFixed failed to alloc range from host");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue