fix: switch to task: dereference variable rightly

This commit is contained in:
Starnakin 2025-01-23 15:25:49 +01:00
parent 8c63eac00e
commit 19eea56a7e

View File

@ -9,11 +9,14 @@ switch_to_task:
push edi
push esi
// save the current stack pointer to the old stack
mov [current_task+0], esp
mov eax, [current_task]
mov edi, [esp_backup] // get eip
mov [current_task+16], edi // save instruction before Interrupt
// save the current stack pointer to the old stack
mov [eax+0], esp
// save the old eip pointer
mov ebx, [[esp_backup]]
mov [eax+16], ebx
// stack pointer + the 4 regs pushed
// and + 1 to get the argument (next task)
@ -22,21 +25,22 @@ switch_to_task:
mov esp, [current_task] // esp
mov eax, [current_task+4] // esp0
mov ebx, [current_task+8] // cr3
mov edi, [current_task+12] // page_directory
mov [page_directory], edi
mov [TSS+4], eax // tss.esp0
mov ecx, cr3
// mov ebx, [current_task+8] // cr3
// mov edi, [current_task+12] // page_directory
// mov [page_directory], edi
// mov [TSS+4], eax // tss.esp0
// mov ecx, cr3
// if cr3 hasn't change, do nothing
cmp ecx, ebx
je .END
// cmp ecx, ebx
// je .END
// mov cr3, ebx
.END:
mov edi, [current_task+16]
mov [esp_backup], edi
mov eax, [current_task+16]
mov ebx, [esp_backup]
mov [ebx], eax
pop esi
pop edi