Update for new emulator.
[bertos.git] / kern / switch_x86_64.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  2006/02/24 01:17:05  bernie
19  * Update for new emulator.
20  *
21  * Revision 1.1  2005/11/27 03:06:15  bernie
22  * Add x86_64 task switching (to be updated to new-style scheduler).
23  *
24  * Revision 1.1  2005/11/14 21:06:38  bernie
25  * Add x86_64 support.
26  *
27  * Revision 1.2  2004/06/06 16:14:12  bernie
28  * Add DevLib license information.
29  *
30  * Revision 1.1  2004/05/23 17:27:00  bernie
31  * Import kern/ subdirectory.
32  *
33  */
34
35 /* I know it's ugly... */
36 #.intel_syntax
37
38 /* void AsmSwitchContext(void **new_sp, void **save_sp) */
39 /*                       %rdi           %rsi
40 .globl AsmSwitchContext
41 AsmSwitchContext:
42         pushq   %rax
43         pushq   %rbx
44         pushq   %rcx
45         pushq   %rdx
46         pushq   %rsi
47         pushq   %rdi
48         pushq   %rbp
49         movq    %rsp,(%rsi)             /* *save_sp = rsp */
50         movq    (%rdi),%rsp             /* rsp = *new_sp */
51         popq    %rbp
52         popq    %rdi
53         popq    %rsi
54         popq    %rdx
55         popq    %rcx
56         popq    %rbx
57         popq    %rax
58         ret
59
60 /* int asm_switch_version(void) */
61 .globl asm_switch_version
62 asm_switch_version:
63         mov     $1,%rax
64         ret
65