pmm: Ignore allow_high_allocs on non x86-64 architectures

This commit is contained in:
48cf 2023-10-24 03:43:13 +02:00 committed by mintsuki
parent a795dc1972
commit 45b39285f1

View File

@ -573,7 +573,7 @@ void *ext_mem_alloc_type_aligned(size_t count, uint32_t type, size_t alignment)
// Allocate memory top down. // Allocate memory top down.
void *ext_mem_alloc_type_aligned_mode(size_t count, uint32_t type, size_t alignment, bool allow_high_allocs) { void *ext_mem_alloc_type_aligned_mode(size_t count, uint32_t type, size_t alignment, bool allow_high_allocs) {
#if !defined (__x86_64__) && !defined (__aarch64__) && !defined (__riscv64) #if !defined (__x86_64__)
(void)allow_high_allocs; (void)allow_high_allocs;
#endif #endif
@ -589,9 +589,10 @@ void *ext_mem_alloc_type_aligned_mode(size_t count, uint32_t type, size_t alignm
int64_t entry_base = (int64_t)(memmap[i].base); int64_t entry_base = (int64_t)(memmap[i].base);
int64_t entry_top = (int64_t)(memmap[i].base + memmap[i].length); int64_t entry_top = (int64_t)(memmap[i].base + memmap[i].length);
#if defined(__x86_64__) || defined(__i386__)
// Let's make sure the entry is not > 4GiB // Let's make sure the entry is not > 4GiB
if (entry_top >= 0x100000000 if (entry_top >= 0x100000000
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64) #if defined (__x86_64__)
&& !allow_high_allocs && !allow_high_allocs
#endif #endif
) { ) {
@ -599,6 +600,7 @@ void *ext_mem_alloc_type_aligned_mode(size_t count, uint32_t type, size_t alignm
if (entry_base >= entry_top) if (entry_base >= entry_top)
continue; continue;
} }
#endif
int64_t alloc_base = ALIGN_DOWN(entry_top - (int64_t)count, alignment); int64_t alloc_base = ALIGN_DOWN(entry_top - (int64_t)count, alignment);