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