GLOBAL	run_task
EXTERN	tss

SEGMENT .text
[BITS 32]

run_task:
			
			mov		ebx, [ss:esp+4]
			mov		eax, [ebx+68]					; get task page dir from process_table.page_dir
			mov		cr3, eax							; set up task page dir (from process context)
			
			mov		eax, [ss:esp+4]

			cli													; now on user stack - interrupts not allowed
			lea		esp, [eax]
			popa
			pop		ds
			pop		es
			pop		fs
			pop		gs
			iretd												; switch to task
