mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-12 22:17:11 -04:00
Simplify the process structure
This commit is contained in:
parent
908264e2b2
commit
d0b37eef9b
@ -64,7 +64,6 @@ struct process_t {
|
||||
volatile interrupt::syscall_regs* context;
|
||||
|
||||
std::vector<segment_t> segments;
|
||||
std::vector<size_t> physical_paging;
|
||||
};
|
||||
|
||||
constexpr const size_t program_base = 0x8000000000;
|
||||
|
@ -429,7 +429,7 @@ bool paging::user_map(scheduler::process_t& process, size_t virt, size_t physica
|
||||
clear_physical_page(physical_pdpt);
|
||||
|
||||
process.paging_size += paging::PAGE_SIZE;
|
||||
process.physical_paging.push_back(physical_pdpt);
|
||||
process.segments.push_back({physical_pdpt, 1});
|
||||
}
|
||||
|
||||
auto physical_pdpt = reinterpret_cast<uintptr_t>(pml4t[pml4e]) & ~0xFFF;
|
||||
@ -448,7 +448,7 @@ bool paging::user_map(scheduler::process_t& process, size_t virt, size_t physica
|
||||
clear_physical_page(physical_pd);
|
||||
|
||||
process.paging_size += paging::PAGE_SIZE;
|
||||
process.physical_paging.push_back(physical_pd);
|
||||
process.segments.push_back({physical_pdpt, 1});
|
||||
}
|
||||
|
||||
auto physical_pd = reinterpret_cast<uintptr_t>(pdpt[pdpte]) & ~0xFFF;
|
||||
@ -467,7 +467,7 @@ bool paging::user_map(scheduler::process_t& process, size_t virt, size_t physica
|
||||
clear_physical_page(physical_pt);
|
||||
|
||||
process.paging_size += paging::PAGE_SIZE;
|
||||
process.physical_paging.push_back(physical_pt);
|
||||
process.segments.push_back({physical_pdpt, 1});
|
||||
}
|
||||
|
||||
auto physical_pt = reinterpret_cast<uintptr_t>(pd[pde]) & ~0xFFF;
|
||||
|
@ -92,12 +92,6 @@ void gc_task(){
|
||||
//1. Release physical memory of PML4T
|
||||
physical_allocator::free(desc.physical_cr3, 1);
|
||||
|
||||
//2. Release physical memory of paging structures
|
||||
for(auto page : desc.physical_paging){
|
||||
physical_allocator::free(page, 1);
|
||||
}
|
||||
desc.physical_paging.clear();
|
||||
|
||||
//3. Release physical stacks
|
||||
physical_allocator::free(desc.physical_kernel_stack, scheduler::kernel_stack_size / paging::PAGE_SIZE);
|
||||
physical_allocator::free(desc.physical_user_stack, scheduler::user_stack_size / paging::PAGE_SIZE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user