Merge da SC: macros.h, pool.h, BIT_CHANGE, nome dei processi, etc.
[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  *
17  * $Log$
18  * Revision 1.2  2004/06/06 16:14:12  bernie
19  * Add DevLib license information.
20  *
21  * Revision 1.1  2004/05/23 17:27:00  bernie
22  * Import kern/ subdirectory.
23  *
24  */
25
26 !!!!!! THIS FILE HAS NOT BEEN REVISED FOR THE NEW SCHEDULER API !!!!!!
27
28 /* I know it's ugly... */
29 #.intel_syntax
30
31 /* void AsmSwitchContext(void * new_sp, void ** save_sp) */
32 .globl AsmSwitchContext
33 AsmSwitchContext:
34         pushl   %eax
35         pushl   %ebx
36         pushl   %ecx
37         pushl   %edx
38         pushl   %esi
39         pushl   %edi
40         pushl   %ebp
41         movl    0x24(%esp),%ebp         /* ebp = save_sp */
42         movl    %esp,(%ebp)                     /* *save_sp = esp */
43         movl    0x20(%esp),%esp         /* esp = new_sp */
44         popl    %ebp
45         popl    %edi
46         popl    %esi
47         popl    %edx
48         popl    %ecx
49         popl    %ebx
50         popl    %eax
51         ret
52
53 /* void AsmReplaceContext(void * new_sp, void ** dummy) */
54 .globl AsmReplaceContext
55 AsmReplaceContext:
56         movl    4(%esp),%esp            /* esp = new_sp */
57         popl    %ebp
58         popl    %edi
59         popl    %esi
60         popl    %edx
61         popl    %ecx
62         popl    %ebx
63         popl    %eax
64         ret
65