Clean up & comment task_init

This commit is contained in:
pjht 2020-07-23 21:00:54 -05:00
parent a2756266f0
commit cd8b2eddcf

View File

@ -50,24 +50,24 @@ switch_to_thread_asm:
global task_init
; Switch to usermode, given a usermode stack and EIP to switch to
task_init:
pop ecx
pop ebx
cli
mov ax, 0x23
pop ecx ; ecx = user ESP
pop ebx ; ebx = user EIP
mov ax, 0x23 ; Load data segment selectors with the usermode data segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov eax, ecx
push 0x23
push eax
pushf
pop eax
or eax, 0x200
push eax
push 0x1B
push ebx
push 0x23 ; Push SS
push ecx ; push user ESP
pushf ; push flags
pop eax ; pop flags into eax
or eax, 0x200 ; enable interrupts when iret runs
push eax ; push modified flags
push 0x1B ; push CS
push ebx ; push user EIP
iret
global wait_for_unblocked_thread_asm