Organize resources into process groups
This commit is contained in:
@@ -5,29 +5,7 @@
|
||||
#include <proc/resource.h>
|
||||
#include <sync/spin_lock.h>
|
||||
|
||||
bool proc_create_resource_mem (struct proc_resource_mem* mem, struct proc_resource_mem_init* init) {
|
||||
if (init->pages == 0)
|
||||
return false;
|
||||
|
||||
if (init->managed) {
|
||||
mem->paddr = init->paddr;
|
||||
mem->managed = true;
|
||||
} else {
|
||||
uintptr_t paddr = pmm_alloc (init->pages);
|
||||
if (paddr == PMM_ALLOC_ERR)
|
||||
return false;
|
||||
mem->paddr = paddr;
|
||||
mem->managed = false;
|
||||
}
|
||||
|
||||
mem->pages = mem->alive_pages = init->pages;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void proc_cleanup_resource_mem (struct proc* proc, struct proc_resource* resource) {
|
||||
(void)proc;
|
||||
|
||||
void proc_cleanup_resource_mem (struct proc_resource* resource) {
|
||||
if (!resource->u.mem.managed)
|
||||
pmm_free (resource->u.mem.paddr, resource->u.mem.pages);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user