From: bernie Date: Sun, 27 Nov 2005 03:06:15 +0000 (+0000) Subject: Add x86_64 task switching (to be updated to new-style scheduler). X-Git-Tag: 1.0.0~791 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=057acc534d78302f2dc31b3b363f605c99ea8ebb;p=bertos.git Add x86_64 task switching (to be updated to new-style scheduler). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@450 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/kern/switch_x86_64.s b/kern/switch_x86_64.s new file mode 100755 index 00000000..60a31e28 --- /dev/null +++ b/kern/switch_x86_64.s @@ -0,0 +1,70 @@ +/*! + * \file + * + * + * \brief i386 context switch + * + * \version $Id$ + * + * \author Bernardo Innocenti + */ + +/* + * $Log$ + * Revision 1.1 2005/11/27 03:06:15 bernie + * Add x86_64 task switching (to be updated to new-style scheduler). + * + * Revision 1.1 2005/11/14 21:06:38 bernie + * Add x86_64 support. + * + * Revision 1.2 2004/06/06 16:14:12 bernie + * Add DevLib license information. + * + * Revision 1.1 2004/05/23 17:27:00 bernie + * Import kern/ subdirectory. + * + */ + +!!!!!! THIS FILE HAS NOT BEEN REVISED FOR THE NEW SCHEDULER API !!!!!! + +/* I know it's ugly... */ +#.intel_syntax + +/* void AsmSwitchContext(void * new_sp, void ** save_sp) */ +.globl AsmSwitchContext +AsmSwitchContext: + pushq %rax + pushq %rbx + pushq %rcx + pushq %rdx + pushq %rsi + pushq %rdi + pushq %rbp + movq %rsp,(%rsi) /* *save_sp = rsp */ + movq %rdi,%rsp /* rsp = new_sp */ + popq %rbp + popq %rdi + popq %rsi + popq %rdx + popq %rcx + popq %rbx + popq %rax + ret + +/* void AsmReplaceContext(void * new_sp, void ** dummy) */ +.globl AsmReplaceContext +AsmReplaceContext: + movq %rdi,%rsp /* rsp = new_sp */ + popq %rbp + popq %rdi + popq %rsi + popq %rdx + popq %rcx + popq %rbx + popq %rax + ret +