kernel: Implement some functions

This commit is contained in:
IndecisiveTurtle 2024-06-21 18:22:37 +03:00 committed by georgemoralis
parent 7bdaeafdfd
commit 2506a285f4
9 changed files with 69 additions and 12 deletions

View file

@ -84,7 +84,7 @@ int MemoryManager::MapMemory(void** out_addr, VAddr virtual_addr, size_t size, M
MemoryMapFlags flags, VMAType type, std::string_view name,
bool is_exec, PAddr phys_addr, u64 alignment) {
std::scoped_lock lk{mutex};
if (type == VMAType::Flexible && total_flexible_usage + size > 448_MB) {
if (type == VMAType::Flexible && flexible_usage + size > total_flexible_size) {
return SCE_KERNEL_ERROR_ENOMEM;
}
@ -106,7 +106,7 @@ int MemoryManager::MapMemory(void** out_addr, VAddr virtual_addr, size_t size, M
MapVulkanMemory(mapped_addr, size);
}
if (type == VMAType::Flexible) {
total_flexible_usage += size;
flexible_usage += size;
}
};
@ -184,7 +184,7 @@ void MemoryManager::UnmapMemory(VAddr virtual_addr, size_t size) {
UnmapVulkanMemory(virtual_addr, size);
}
if (type == VMAType::Flexible) {
total_flexible_usage -= size;
flexible_usage -= size;
}
// Mark region as free and attempt to coalesce it with neighbours.