vm: Remove vm::dealloc_verbose_nothrow

This commit is contained in:
Eladash 2021-01-09 16:35:54 +02:00 committed by Ivan
parent ea916fd7e1
commit e4c3b1c2bd
9 changed files with 23 additions and 36 deletions

View file

@ -998,51 +998,40 @@ namespace vm
if (!block)
{
fmt::throw_exception("Invalid memory location (%u)", +location);
vm_log.error("vm::alloc(): Invalid memory location (%u)", +location);
ensure(location < memory_location_max); // The only allowed locations to fail
return 0;
}
return block->alloc(size, nullptr, align);
}
u32 falloc(u32 addr, u32 size, memory_location_t location)
u32 falloc(u32 addr, u32 size, memory_location_t location, const std::shared_ptr<utils::shm>* src)
{
const auto block = get(location, addr);
if (!block)
{
fmt::throw_exception("Invalid memory location (%u, addr=0x%x)", +location, addr);
vm_log.error("vm::falloc(): Invalid memory location (%u, addr=0x%x)", +location, addr);
ensure(location == any || location < memory_location_max); // The only allowed locations to fail
return 0;
}
return block->falloc(addr, size);
return block->falloc(addr, size, src);
}
u32 dealloc(u32 addr, memory_location_t location)
u32 dealloc(u32 addr, memory_location_t location, const std::shared_ptr<utils::shm>* src)
{
const auto block = get(location, addr);
if (!block)
{
fmt::throw_exception("Invalid memory location (%u, addr=0x%x)", +location, addr);
vm_log.error("vm::dealloc(): Invalid memory location (%u, addr=0x%x)", +location, addr);
ensure(location == any || location < memory_location_max); // The only allowed locations to fail
return 0;
}
return block->dealloc(addr);
}
void dealloc_verbose_nothrow(u32 addr, memory_location_t location) noexcept
{
const auto block = get(location, addr);
if (!block)
{
vm_log.error("vm::dealloc(): invalid memory location (%u, addr=0x%x)\n", +location, addr);
return;
}
if (!block->dealloc(addr))
{
vm_log.error("vm::dealloc(): deallocation failed (addr=0x%x)\n", addr);
return;
}
return block->dealloc(addr, src);
}
void lock_sudo(u32 addr, u32 size)