X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fswitch_x86_64.s;fp=bertos%2Fkern%2Fswitch_x86_64.s;h=5fb4da658d1663d461c4fb91218285d212fb82f2;hb=791e167e053bdd9250d34a9a5ccae6ccde4d6679;hp=0000000000000000000000000000000000000000;hpb=faf2f6bfd5933ff75e6cc01e3d48f9277f731d8f;p=bertos.git diff --git a/bertos/kern/switch_x86_64.s b/bertos/kern/switch_x86_64.s new file mode 100644 index 00000000..5fb4da65 --- /dev/null +++ b/bertos/kern/switch_x86_64.s @@ -0,0 +1,71 @@ +/*! + * \file + * + * + * \brief i386 context switch + * + * \version $Id$ + * + * \author Bernardo Innocenti + */ + +/* + * $Log$ + * Revision 1.4 2006/09/20 14:02:49 marco + * C-style comment. + * + * Revision 1.3 2006/02/24 01:35:40 bernie + * Update for new emulator. + * + * Revision 1.2 2006/02/24 01:17:05 bernie + * Update for new emulator. + * + * 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. + * + */ + +/* I know it's ugly... */ +/* .intel_syntax */ + +/* void AsmSwitchContext(void **new_sp, void **save_sp) */ +/* %rdi %rsi */ +.globl asm_switch_context +asm_switch_context: + 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 + +/* int asm_switch_version(void) */ +.globl asm_switch_version +asm_switch_version: + mov $1,%rax + ret +