fix: switch to task: dereference variable rightly
This commit is contained in:
parent
8c63eac00e
commit
19eea56a7e
@ -9,11 +9,14 @@ switch_to_task:
|
|||||||
push edi
|
push edi
|
||||||
push esi
|
push esi
|
||||||
|
|
||||||
// save the current stack pointer to the old stack
|
mov eax, [current_task]
|
||||||
mov [current_task+0], esp
|
|
||||||
|
|
||||||
mov edi, [esp_backup] // get eip
|
// save the current stack pointer to the old stack
|
||||||
mov [current_task+16], edi // save instruction before Interrupt
|
mov [eax+0], esp
|
||||||
|
|
||||||
|
// save the old eip pointer
|
||||||
|
mov ebx, [[esp_backup]]
|
||||||
|
mov [eax+16], ebx
|
||||||
|
|
||||||
// stack pointer + the 4 regs pushed
|
// stack pointer + the 4 regs pushed
|
||||||
// and + 1 to get the argument (next task)
|
// and + 1 to get the argument (next task)
|
||||||
@ -22,21 +25,22 @@ switch_to_task:
|
|||||||
|
|
||||||
mov esp, [current_task] // esp
|
mov esp, [current_task] // esp
|
||||||
mov eax, [current_task+4] // esp0
|
mov eax, [current_task+4] // esp0
|
||||||
mov ebx, [current_task+8] // cr3
|
// mov ebx, [current_task+8] // cr3
|
||||||
mov edi, [current_task+12] // page_directory
|
// mov edi, [current_task+12] // page_directory
|
||||||
mov [page_directory], edi
|
// mov [page_directory], edi
|
||||||
mov [TSS+4], eax // tss.esp0
|
// mov [TSS+4], eax // tss.esp0
|
||||||
mov ecx, cr3
|
// mov ecx, cr3
|
||||||
|
|
||||||
// if cr3 hasn't change, do nothing
|
// if cr3 hasn't change, do nothing
|
||||||
cmp ecx, ebx
|
// cmp ecx, ebx
|
||||||
je .END
|
// je .END
|
||||||
// mov cr3, ebx
|
// mov cr3, ebx
|
||||||
|
|
||||||
|
|
||||||
.END:
|
.END:
|
||||||
mov edi, [current_task+16]
|
mov eax, [current_task+16]
|
||||||
mov [esp_backup], edi
|
mov ebx, [esp_backup]
|
||||||
|
mov [ebx], eax
|
||||||
|
|
||||||
pop esi
|
pop esi
|
||||||
pop edi
|
pop edi
|
||||||
|
Loading…
Reference in New Issue
Block a user