fix creating ring 3 tasks finally

This commit is contained in:
2025-05-29 21:18:09 +03:00
parent b8752ee39d
commit c808a5d295
2 changed files with 40 additions and 31 deletions
+9 -10
View File
@@ -15,29 +15,28 @@ global switchProcess
extern current
extern trapret
; void switchProcess(Process* next_process_ptr)
switchProcess:
mov eax, [esp + 4] ; eax = old
mov edx, [esp + 8] ; edx = new
mov edx, [esp + 4] ; edx = next_process_ptr (получаем аргумент СРАЗУ)
cli ; Запретить прерывания
push ebp
push ebx
push esi
push edi
mov [eax+4], esp
mov esp, [edx+4]
mov eax, [current]
mov [eax + 4], esp ; current->kesp = esp
;mov eax, [edx+12]
;sub eax, 0xC0000000
;mov cr3, eax
; edx уже содержит next_process_ptr
mov esp, [edx + 4] ; esp = next_process_ptr->kesp
mov [current], edx ; current = next_process_ptr
pop edi
pop esi
pop ebx
pop ebp
ret ; Для ring 0 просто возвращаемся
ret
trapret: