c4a23da12861e988ab0982533c782b0aeced3abe
[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  * All Rights Reserved.
7  * -->
8  *
9  * \brief i386 context switch
10  *
11  * \version $Id$
12  *
13  * \author Bernardo Innocenti <bernie@develer.com>
14  */
15
16  *
17  * $Log$
18  * Revision 1.1  2004/05/23 17:27:00  bernie
19  * Import kern/ subdirectory.
20  *
21  */
22
23 !!!!!! THIS FILE HAS NOT BEEN REVISED FOR THE NEW SCHEDULER API !!!!!!
24
25 /* I know it's ugly... */
26 #.intel_syntax
27
28 /* void AsmSwitchContext(void * new_sp, void ** save_sp) */
29 .globl AsmSwitchContext
30 AsmSwitchContext:
31         pushl   %eax
32         pushl   %ebx
33         pushl   %ecx
34         pushl   %edx
35         pushl   %esi
36         pushl   %edi
37         pushl   %ebp
38         movl    0x24(%esp),%ebp         /* ebp = save_sp */
39         movl    %esp,(%ebp)                     /* *save_sp = esp */
40         movl    0x20(%esp),%esp         /* esp = new_sp */
41         popl    %ebp
42         popl    %edi
43         popl    %esi
44         popl    %edx
45         popl    %ecx
46         popl    %ebx
47         popl    %eax
48         ret
49
50 /* void AsmReplaceContext(void * new_sp, void ** dummy) */
51 .globl AsmReplaceContext
52 AsmReplaceContext:
53         movl    4(%esp),%esp            /* esp = new_sp */
54         popl    %ebp
55         popl    %edi
56         popl    %esi
57         popl    %edx
58         popl    %ecx
59         popl    %ebx
60         popl    %eax
61         ret
62