4 * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5 * Copyright 1999,2000,2001 Bernie Innocenti <bernie@codewiz.org>
6 * This file is part of DevLib - See devlib/README for information.
9 * \brief i386 context switch
13 * \author Bernie Innocenti <bernie@codewiz.org>
19 //This workaround is necessary to compile under OS X assembler.
20 #define SWITCH_CONTEXT _asm_switch_context
21 #define SWITCH_VERSION _asm_switch_version
23 #define SWITCH_CONTEXT asm_switch_context
24 #define SWITCH_VERSION asm_switch_version
27 /* void asm_switch_context(void ** new_sp, void ** save_sp) */
37 movl 0x24(%esp),%ebp /* ebp = save_sp */
38 movl %esp,(%ebp) /* *save_sp = esp */
39 movl 0x20(%esp),%ebp /* ebp = new_sp */
40 movl (%ebp),%esp /* esp = *new_sp */
50 /* int asm_switch_version(void) */