[Kernel] Implemented: NtAllocateEncryptedMemory
This commit is contained in:
parent
9992d20079
commit
94759861c5
|
@ -347,6 +347,38 @@ dword_result_t NtQueryVirtualMemory_entry(
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(NtQueryVirtualMemory, kMemory, kImplemented);
|
||||
|
||||
dword_result_t NtAllocateEncryptedMemory_entry(dword_t unk, dword_t region_size,
|
||||
lpdword_t base_addr_ptr) {
|
||||
if (!region_size) {
|
||||
return X_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
const uint32_t region_size_adjusted =
|
||||
xe::round_up(region_size, 64 * 1024, true);
|
||||
|
||||
if (region_size_adjusted > 16 * 1024 * 1024) {
|
||||
return X_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
uint32_t out_address = 0;
|
||||
auto heap = kernel_memory()->LookupHeap(0x8C000000);
|
||||
const bool result =
|
||||
heap->AllocRange(0x8C000000, 0x8FFFFFFF, region_size_adjusted, 64 * 1024,
|
||||
MemoryAllocationFlag::kMemoryAllocationCommit,
|
||||
MemoryProtectFlag::kMemoryProtectRead |
|
||||
MemoryProtectFlag::kMemoryProtectWrite,
|
||||
false, &out_address);
|
||||
|
||||
if (!result) {
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
XELOGD("NtAllocateEncryptedMemory = {:08X}", out_address);
|
||||
*base_addr_ptr = out_address;
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(NtAllocateEncryptedMemory, kMemory, kImplemented);
|
||||
|
||||
dword_result_t MmAllocatePhysicalMemoryEx_entry(
|
||||
dword_t flags, dword_t region_size, dword_t protect_bits,
|
||||
dword_t min_addr_range, dword_t max_addr_range, dword_t alignment) {
|
||||
|
@ -711,7 +743,6 @@ dword_result_t MmIsAddressValid_entry(dword_t address,
|
|||
|
||||
DECLARE_XBOXKRNL_EXPORT1(MmIsAddressValid, kMemory, kImplemented);
|
||||
|
||||
|
||||
} // namespace xboxkrnl
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
|
Loading…
Reference in New Issue