[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/XPTI: use %r12 to write zero into xen_cr3
commit d62d0e5b64e512d2993d75773369e16b0045d9da Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Jun 28 12:48:47 2018 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Jun 28 12:48:47 2018 +0200 x86/XPTI: use %r12 to write zero into xen_cr3 Now that we zero all registers early on all entry paths, use that to avoid a couple of immediates here. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Tested-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/x86_64/compat/entry.S | 6 ++++-- xen/arch/x86/x86_64/entry.S | 31 ++++++++++++++++++------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S index f697e05a30..d737583d93 100644 --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -220,7 +220,8 @@ ENTRY(cstar_enter) jz .Lcstar_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx) mov %rcx, %cr3 - movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) .Lcstar_cr3_okay: sti @@ -244,7 +245,8 @@ UNLIKELY_START(z, compat_syscall_gpf) movq VCPU_trap_ctxt(%rbx),%rdi movl $TRAP_gp_fault,UREGS_entry_vector(%rsp) subl $2,UREGS_rip(%rsp) - movl $0,TRAPBOUNCE_error_code(%rdx) + /* %r12 is still zero at this point. */ + mov %r12d, TRAPBOUNCE_error_code(%rdx) movl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rdi),%eax movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rdi),%esi testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rdi) diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index 58054edf82..e5c9ef1b4b 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -266,7 +266,8 @@ ENTRY(lstar_enter) jz .Llstar_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx) mov %rcx, %cr3 - movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) .Llstar_cr3_okay: sti @@ -302,7 +303,8 @@ GLOBAL(sysenter_eflags_saved) jz .Lsyse_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx) mov %rcx, %cr3 - movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) .Lsyse_cr3_okay: sti @@ -351,7 +353,8 @@ ENTRY(int80_direct_trap) jz .Lint80_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx) mov %rcx, %cr3 - movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx) .Lint80_cr3_okay: sti @@ -566,11 +569,11 @@ ENTRY(common_interrupt) jz .Lintr_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14) mov %rcx, %cr3 - xor %ecx, %ecx - mov %rcx, STACK_CPUINFO_FIELD(xen_cr3)(%r14) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%r14) testb $3, UREGS_cs(%rsp) - cmovnz %rcx, %r15 - cmovnz %rcx, %rbx + cmovnz %r12, %r15 + cmovnz %r12d, %ebx .Lintr_cr3_okay: CR4_PV32_RESTORE @@ -598,11 +601,11 @@ GLOBAL(handle_exception) jz .Lxcpt_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14) mov %rcx, %cr3 - xor %ecx, %ecx - mov %rcx, STACK_CPUINFO_FIELD(xen_cr3)(%r14) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%r14) testb $3, UREGS_cs(%rsp) - cmovnz %rcx, %r15 - cmovnz %rcx, %r13 + cmovnz %r12, %r15 + cmovnz %r12d, %r13d .Lxcpt_cr3_okay: handle_exception_saved: @@ -775,7 +778,8 @@ ENTRY(double_fault) jz .Ldblf_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14) mov %rbx, %cr3 - movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%r14) .Ldblf_cr3_okay: movq %rsp,%rdi @@ -809,7 +813,8 @@ handle_ist_exception: jz .List_cr3_okay movb $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14) mov %rcx, %cr3 - movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14) + /* %r12 is still zero at this point. */ + mov %r12, STACK_CPUINFO_FIELD(xen_cr3)(%r14) .List_cr3_okay: CR4_PV32_RESTORE -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |