Skip to content

Instantly share code, notes, and snippets.

@aglasgall
Created February 2, 2009 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aglasgall/57109 to your computer and use it in GitHub Desktop.
Save aglasgall/57109 to your computer and use it in GitHub Desktop.
do_switch_task:
cli
pop ecx ; throw away return address
pop ecx ; first parameter is the new eip
pop esi ; second parameter is new esp, store in esi temporarily
pop edi ; third is new ebp, store in edi temporarily
pop edx ; fourth is new cr3, but we can't pop
mov esp, esi
mov ebp, edi
mov cr3, edx ; directly into that
mov eax, 0xdeadbeef ; magic cookie value
sti
jmp ecx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment