xv6

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 38330b1aafc83946ee301b9f4f74f4babeb8982a
parent 78a1c79b59a1545fe6105ab3919a05c772c45873
Author: Brian Swetland <swetland@frotz.net>
Date:   Tue, 31 Dec 2013 09:12:34 -0800

x64 version of swtch

- x64 passes the first few arguments via registers
- x64 has different callee/caller-save register lists

Diffstat:
Akernel/swtch64.S | 32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)

diff --git a/kernel/swtch64.S b/kernel/swtch64.S @@ -0,0 +1,32 @@ +# Context switch +# +# void swtch(struct context **old, struct context *new); +# +# Save current register context in old +# and then load register context from new. + +.globl swtch +swtch: + # Save old callee-save registers + push %rbp + push %rbx + push %r11 + push %r12 + push %r13 + push %r14 + push %r15 + + # Switch stacks + mov %rsp, (%rdi) + mov %rsi, %rsp + + # Load new callee-save registers + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %r11 + pop %rbx + pop %rbp + + ret #??