Created
September 18, 2010 21:58
-
-
Save temoto/586089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Copied from http://newos.org/txt/context_switch.txt | |
BITS 32 | |
global HalSwitchContext | |
section .text | |
; void i386_context_switch(void **from_esp, void *esp) | |
HalSwitchContext: | |
pusha ; save all 8 general purpose regs on the stack | |
lea eax, [esp+36] | |
mov [eax], esp ; save the current esp -> *from_esp | |
mov eax, [esp+40] | |
mov esp, eax ; load esp from -> *esp | |
popa ; restore all 8 general purpose regs from the new stack | |
ret ; return to caller: usually the bottom part of reschedule() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nasm -g -f elf32 -o arch/i386/hal/taskswitch.o arch/i386/hal/taskswitch.s
arch/i386/hal/taskswitch.s:13: error: expression syntax error