Doc fixes.
[bertos.git] / kern / switch_i386.s
1 /*!
2  * \file
3  * <!--
4  * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5  * Copyright 1999,2000,2001 Bernardo Innocenti <bernie@develer.com>
6  * This file is part of DevLib - See devlib/README for information.
7  * -->
8  *
9  * \brief i386 context switch
10  *
11  * \version $Id$
12  *
13  * \author Bernardo Innocenti <bernie@develer.com>
14  */
15
16 /* void asm_switch_context(void ** new_sp, void ** save_sp) */
17 .globl asm_switch_context
18 asm_switch_context:
19         pushl   %eax
20         pushl   %ebx
21         pushl   %ecx
22         pushl   %edx
23         pushl   %esi
24         pushl   %edi
25         pushl   %ebp
26         movl    0x24(%esp),%ebp         /* ebp = save_sp */
27         movl    %esp,(%ebp)             /* *save_sp = esp */
28         movl    0x20(%esp),%ebp         /* ebp = new_sp */
29         movl    (%ebp),%esp             /* esp = *new_sp */
30         popl    %ebp
31         popl    %edi
32         popl    %esi
33         popl    %edx
34         popl    %ecx
35         popl    %ebx
36         popl    %eax
37         ret
38
39 /* int asm_switch_version(void) */
40 .globl asm_switch_version
41 asm_switch_version:
42         mov     $1,%eax
43         ret
44