tasking, mm: remove unused functions and page_directory field from the Task struct

This commit is contained in:
2025-06-01 14:04:49 +03:00
parent 5f87e55067
commit d1ac41deeb
7 changed files with 10 additions and 642 deletions
+6 -6
View File
@@ -56,7 +56,7 @@ Process* task_create(uint32_t func, void** args, uint32_t arg_count, uint32_t ri
p->tf->eflags = FL_IF;
p->tf->eip = (uint32_t)func;
p->page_directory = pagedir;//(uint32_t*)create_page_dir();
p->pagedir = pagedir;//(uint32_t*)create_page_dir();
if(ring == 3)
{
@@ -65,7 +65,7 @@ Process* task_create(uint32_t func, void** args, uint32_t arg_count, uint32_t ri
uint32_t user_stack_virtual_top = 0xBFFFF000 - ((p->pid -1) * (USTACKSIZE + 4096)); // Уникальный верх стека для каждого процесса
uint32_t user_stack_virtual_base = user_stack_virtual_top - USTACKSIZE;
map_page_in_directory(p->page_directory, user_stack_physical, (void*)user_stack_virtual_base, PAGE_PRESENT | PAGE_RW | PAGE_USER); // Флаги 0x7
map_page_in_directory(p->pagedir, user_stack_physical, (void*)user_stack_virtual_base, PAGE_PRESENT | PAGE_RW | PAGE_USER); // Флаги 0x7
p->tf->usermode_esp = user_stack_virtual_top;
@@ -193,12 +193,12 @@ void jump_usermode2(void) {
printf("Copied code to 0x%x (virt 0x%x)\n",
(uint32_t)code_phys, kernel_temp_virt);
uint32_t* proc_pd = (uint32_t*)create_page_dir();
uint32_t* proc2_pd = (uint32_t*)create_page_dir();
uint32_t* proc_pd = create_page_dir();
uint32_t* proc2_pd = create_page_dir();
Process* p_task1 = task_create(0x400000, NULL, 0, 3, proc_pd);
Process* p_task2 = task_create(0x400000, NULL, 0, 3, proc2_pd);
if (map_page_in_directory(p_task1->page_directory,
if (map_page_in_directory(p_task1->pagedir,
code_phys,
(void*)0x400000,
PAGE_PRESENT | PAGE_RW | PAGE_USER) != 0) { // PAGE_USER is critical, PAGE_RW for now, can be R-X
@@ -208,7 +208,7 @@ void jump_usermode2(void) {
return;
}
if (map_page_in_directory(p_task2->page_directory,
if (map_page_in_directory(p_task2->pagedir,
second_code_phys,
(void*)0x400000,
PAGE_PRESENT | PAGE_RW | PAGE_USER) != 0) { // PAGE_USER is critical, PAGE_RW for now, can be R-X