Use mostly the same registers for consistency

The exception to this is %eax is used not %edi on x86 because its
caller-save
pull/1/head
John Ericson 2016-07-16 12:28:07 -07:00 committed by edef
parent bc184237cc
commit 1ea4b01eda
2 changed files with 6 additions and 6 deletions

View File

@ -81,7 +81,7 @@ pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer)
# Remember stack pointer of the old context, in case %rdx==%rsi. # Remember stack pointer of the old context, in case %rdx==%rsi.
movl %esp, %ebx movl %esp, %ebx
# Load stack pointer of the new context. # Load stack pointer of the new context.
movl (%edi), %esp movl (%edx), %esp
# Save stack pointer of the old context. # Save stack pointer of the old context.
movl %ebx, (%esi) movl %ebx, (%esi)
@ -95,7 +95,7 @@ pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer)
: "={eax}" (ret) : "={eax}" (ret)
: "{eax}" (arg) : "{eax}" (arg)
"{esi}" (old_sp) "{esi}" (old_sp)
"{edi}" (new_sp) "{edx}" (new_sp)
: "eax", "ebx", "ecx", "edx", "esi", "edi", //"ebp", "esp", : "eax", "ebx", "ecx", "edx", "esi", "edi", //"ebp", "esp",
"mmx0", "mmx1", "mmx2", "mmx3", "mmx4", "mmx5", "mmx6", "mmx7", "mmx0", "mmx1", "mmx2", "mmx3", "mmx4", "mmx5", "mmx6", "mmx7",
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",

View File

@ -58,17 +58,17 @@ pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer)
1: 1:
# Remember stack pointer of the old context, in case %rdx==%rsi. # Remember stack pointer of the old context, in case %rdx==%rsi.
movq %rsp, %rax movq %rsp, %rbx
# Load stack pointer of the new context. # Load stack pointer of the new context.
movq (%rdx), %rsp movq (%rdx), %rsp
# Save stack pointer of the old context. # Save stack pointer of the old context.
movq %rax, (%rsi) movq %rbx, (%rsi)
# Pop instruction pointer of the new context (placed onto stack by # Pop instruction pointer of the new context (placed onto stack by
# the call above) and jump there; don't use `ret` to avoid return # the call above) and jump there; don't use `ret` to avoid return
# address mispredictions (~8ns on Ivy Bridge). # address mispredictions (~8ns on Ivy Bridge).
popq %rax popq %rbx
jmpq *%rax jmpq *%rbx
2: 2:
"# "#
: "={rdi}" (ret) : "={rdi}" (ret)