ia64/xen-unstable

changeset 17488:dac7703e8d93

x86, hvm: Assembly stub cleanups.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 21 12:19:15 2008 +0100 (2008-04-21)
parents 658f031557f6
children 491074885dcb
files xen/arch/x86/hvm/svm/x86_32/exits.S xen/arch/x86/hvm/svm/x86_64/exits.S xen/arch/x86/hvm/vmx/x86_32/exits.S xen/arch/x86/hvm/vmx/x86_64/exits.S
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/x86_32/exits.S	Mon Apr 21 10:33:40 2008 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/x86_32/exits.S	Mon Apr 21 12:19:15 2008 +0100
     1.3 @@ -42,7 +42,7 @@ ENTRY(svm_asm_do_resume)
     1.4          movl VCPU_processor(%ebx),%eax
     1.5          shl  $IRQSTAT_shift,%eax
     1.6          testl $~0,irq_stat(%eax,1)
     1.7 -        jnz  svm_process_softirqs
     1.8 +        jnz  .Lsvm_process_softirqs
     1.9  
    1.10          call svm_asid_handle_vmrun
    1.11          call svm_intr_assist
    1.12 @@ -52,8 +52,8 @@ ENTRY(svm_asm_do_resume)
    1.13           * instead of having a mostly taken branch over the unlikely code.
    1.14           */
    1.15          cmpb $0,tb_init_done
    1.16 -        jnz  svm_trace
    1.17 -svm_trace_done:
    1.18 +        jnz  .Lsvm_trace
    1.19 +.Lsvm_trace_done:
    1.20  
    1.21          movl VCPU_svm_vmcb(%ebx),%ecx
    1.22          movl UREGS_eax(%esp),%eax
    1.23 @@ -108,7 +108,7 @@ svm_trace_done:
    1.24  #endif
    1.25  
    1.26          STGI
    1.27 -.globl svm_stgi_label;
    1.28 +.globl svm_stgi_label
    1.29  svm_stgi_label:
    1.30          movl %esp,%eax
    1.31          push %eax
    1.32 @@ -116,16 +116,11 @@ svm_stgi_label:
    1.33          addl $4,%esp
    1.34          jmp  svm_asm_do_resume
    1.35  
    1.36 -        ALIGN
    1.37 -svm_process_softirqs:
    1.38 +.Lsvm_process_softirqs:
    1.39          STGI
    1.40          call do_softirq
    1.41          jmp  svm_asm_do_resume
    1.42  
    1.43 -svm_trace:
    1.44 -        /* Call out to C, as this is not speed critical path
    1.45 -         * Note: svm_trace_vmentry will recheck the tb_init_done,
    1.46 -         * but this is on the slow path, so who cares 
    1.47 -         */
    1.48 +.Lsvm_trace:
    1.49          call svm_trace_vmentry
    1.50 -        jmp  svm_trace_done
    1.51 +        jmp  .Lsvm_trace_done
     2.1 --- a/xen/arch/x86/hvm/svm/x86_64/exits.S	Mon Apr 21 10:33:40 2008 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/x86_64/exits.S	Mon Apr 21 12:19:15 2008 +0100
     2.3 @@ -43,7 +43,7 @@ ENTRY(svm_asm_do_resume)
     2.4          shl  $IRQSTAT_shift,%rax
     2.5          leaq irq_stat(%rip),%rdx
     2.6          testl $~0,(%rdx,%rax,1)
     2.7 -        jnz  svm_process_softirqs
     2.8 +        jnz  .Lsvm_process_softirqs
     2.9  
    2.10          call svm_asid_handle_vmrun
    2.11          call svm_intr_assist
    2.12 @@ -53,8 +53,8 @@ ENTRY(svm_asm_do_resume)
    2.13           * instead of having a mostly taken branch over the unlikely code.
    2.14           */
    2.15          cmpb $0,tb_init_done(%rip)
    2.16 -        jnz  svm_trace
    2.17 -svm_trace_done:
    2.18 +        jnz  .Lsvm_trace
    2.19 +.Lsvm_trace_done:
    2.20  
    2.21          movq VCPU_svm_vmcb(%rbx),%rcx
    2.22          movq UREGS_rax(%rsp),%rax
    2.23 @@ -127,22 +127,17 @@ svm_trace_done:
    2.24  #endif
    2.25  
    2.26          STGI
    2.27 -.globl svm_stgi_label;
    2.28 +.globl svm_stgi_label
    2.29  svm_stgi_label:
    2.30          movq %rsp,%rdi
    2.31          call svm_vmexit_handler
    2.32          jmp  svm_asm_do_resume
    2.33  
    2.34 -        ALIGN
    2.35 -svm_process_softirqs:
    2.36 +.Lsvm_process_softirqs:
    2.37          STGI
    2.38          call do_softirq
    2.39          jmp  svm_asm_do_resume
    2.40  
    2.41 -svm_trace:
    2.42 -        /* Call out to C, as this is not speed critical path
    2.43 -         * Note: svm_trace_vmentry will recheck the tb_init_done,
    2.44 -         * but this is on the slow path, so who cares 
    2.45 -         */
    2.46 +.Lsvm_trace:
    2.47          call svm_trace_vmentry
    2.48 -        jmp  svm_trace_done
    2.49 +        jmp  .Lsvm_trace_done
     3.1 --- a/xen/arch/x86/hvm/vmx/x86_32/exits.S	Mon Apr 21 10:33:40 2008 +0100
     3.2 +++ b/xen/arch/x86/hvm/vmx/x86_32/exits.S	Mon Apr 21 12:19:15 2008 +0100
     3.3 @@ -58,10 +58,13 @@
     3.4          popl %eax
     3.5  
     3.6          ALIGN
     3.7 -ENTRY(vmx_asm_vmexit_handler)
     3.8 +.globl vmx_asm_vmexit_handler
     3.9 +vmx_asm_vmexit_handler:
    3.10          HVM_SAVE_ALL_NOSEGREGS
    3.11          GET_CURRENT(%ebx)
    3.12  
    3.13 +        movb $1,VCPU_vmx_launched(%ebx)
    3.14 +
    3.15          movl $GUEST_RIP,%eax
    3.16          VMREAD(UREGS_eip)
    3.17          movl $GUEST_RSP,%eax
    3.18 @@ -89,28 +92,21 @@ ENTRY(vmx_asm_vmexit_handler)
    3.19          push %eax
    3.20          call vmx_vmexit_handler
    3.21          addl $4,%esp
    3.22 -        jmp vmx_asm_do_vmentry
    3.23  
    3.24 -        ALIGN
    3.25 -vmx_process_softirqs:
    3.26 -        sti
    3.27 -        call do_softirq
    3.28 -        jmp vmx_asm_do_vmentry
    3.29 -
    3.30 -        ALIGN
    3.31 -ENTRY(vmx_asm_do_vmentry)
    3.32 +.globl vmx_asm_do_vmentry
    3.33 +vmx_asm_do_vmentry:
    3.34          GET_CURRENT(%ebx)
    3.35          cli                             # tests must not race interrupts
    3.36  
    3.37          movl VCPU_processor(%ebx),%eax
    3.38          shl  $IRQSTAT_shift,%eax
    3.39          cmpl $0,irq_stat(%eax,1)
    3.40 -        jnz  vmx_process_softirqs
    3.41 +        jnz  .Lvmx_process_softirqs
    3.42  
    3.43          call vmx_intr_assist
    3.44  
    3.45          testb $0xff,VCPU_vmx_emul(%ebx)
    3.46 -        jnz  vmx_goto_realmode
    3.47 +        jnz  .Lvmx_goto_realmode
    3.48  
    3.49          movl VCPU_hvm_guest_cr2(%ebx),%eax
    3.50          movl %eax,%cr2
    3.51 @@ -124,25 +120,28 @@ ENTRY(vmx_asm_do_vmentry)
    3.52          VMWRITE(UREGS_eflags)
    3.53  
    3.54          cmpb $0,VCPU_vmx_launched(%ebx)
    3.55 -        je   vmx_launch
    3.56 +        HVM_RESTORE_ALL_NOSEGREGS
    3.57 +        je   .Lvmx_launch
    3.58  
    3.59 -/*vmx_resume:*/
    3.60 -        HVM_RESTORE_ALL_NOSEGREGS
    3.61 +/*.Lvmx_resume:*/
    3.62          VMRESUME
    3.63          call vm_resume_fail
    3.64          ud2
    3.65  
    3.66 -vmx_launch:
    3.67 -        movb $1,VCPU_vmx_launched(%ebx)
    3.68 -        HVM_RESTORE_ALL_NOSEGREGS
    3.69 +.Lvmx_launch:
    3.70          VMLAUNCH
    3.71          call vm_launch_fail
    3.72          ud2
    3.73  
    3.74 -vmx_goto_realmode:
    3.75 +.Lvmx_goto_realmode:
    3.76          sti
    3.77          movl %esp,%eax
    3.78          push %eax
    3.79          call vmx_realmode
    3.80          addl $4,%esp
    3.81          jmp vmx_asm_do_vmentry
    3.82 +
    3.83 +.Lvmx_process_softirqs:
    3.84 +        sti
    3.85 +        call do_softirq
    3.86 +        jmp vmx_asm_do_vmentry
     4.1 --- a/xen/arch/x86/hvm/vmx/x86_64/exits.S	Mon Apr 21 10:33:40 2008 +0100
     4.2 +++ b/xen/arch/x86/hvm/vmx/x86_64/exits.S	Mon Apr 21 12:19:15 2008 +0100
     4.3 @@ -74,10 +74,13 @@
     4.4          popq %rdi
     4.5  
     4.6          ALIGN
     4.7 -ENTRY(vmx_asm_vmexit_handler)
     4.8 +.globl vmx_asm_vmexit_handler
     4.9 +vmx_asm_vmexit_handler:
    4.10          HVM_SAVE_ALL_NOSEGREGS
    4.11          GET_CURRENT(%rbx)
    4.12  
    4.13 +        movb $1,VCPU_vmx_launched(%rbx)
    4.14 +
    4.15          leaq UREGS_rip(%rsp),%rdi
    4.16          movl $GUEST_RIP,%eax
    4.17          /*VMREAD(UREGS_rip)*/
    4.18 @@ -105,16 +108,9 @@ ENTRY(vmx_asm_vmexit_handler)
    4.19  
    4.20          movq %rsp,%rdi
    4.21          call vmx_vmexit_handler
    4.22 -        jmp vmx_asm_do_vmentry
    4.23  
    4.24 -        ALIGN
    4.25 -vmx_process_softirqs:
    4.26 -        sti
    4.27 -        call do_softirq
    4.28 -        jmp vmx_asm_do_vmentry
    4.29 -
    4.30 -        ALIGN
    4.31 -ENTRY(vmx_asm_do_vmentry)
    4.32 +.globl vmx_asm_do_vmentry
    4.33 +vmx_asm_do_vmentry:
    4.34          GET_CURRENT(%rbx)
    4.35          cli                             # tests must not race interrupts
    4.36  
    4.37 @@ -122,12 +118,12 @@ ENTRY(vmx_asm_do_vmentry)
    4.38          shl   $IRQSTAT_shift,%rax
    4.39          leaq  irq_stat(%rip),%rdx
    4.40          cmpl  $0,(%rdx,%rax,1)
    4.41 -        jnz   vmx_process_softirqs
    4.42 +        jnz   .Lvmx_process_softirqs
    4.43  
    4.44          call vmx_intr_assist
    4.45  
    4.46          testb $0xff,VCPU_vmx_emul(%rbx)
    4.47 -        jnz  vmx_goto_realmode
    4.48 +        jnz  .Lvmx_goto_realmode
    4.49  
    4.50          movq VCPU_hvm_guest_cr2(%rbx),%rax
    4.51          movq %rax,%cr2
    4.52 @@ -143,23 +139,27 @@ ENTRY(vmx_asm_do_vmentry)
    4.53          VMWRITE(UREGS_eflags)
    4.54  
    4.55          cmpb $0,VCPU_vmx_launched(%rbx)
    4.56 -        je   vmx_launch
    4.57 +        HVM_RESTORE_ALL_NOSEGREGS
    4.58 +        je   .Lvmx_launch
    4.59  
    4.60 -/*vmx_resume:*/
    4.61 -        HVM_RESTORE_ALL_NOSEGREGS
    4.62 +/*.Lvmx_resume:*/
    4.63          VMRESUME
    4.64          call vm_resume_fail
    4.65          ud2
    4.66  
    4.67 -vmx_launch:
    4.68 -        movb $1,VCPU_vmx_launched(%rbx)
    4.69 -        HVM_RESTORE_ALL_NOSEGREGS
    4.70 +.Lvmx_launch:
    4.71          VMLAUNCH
    4.72          call vm_launch_fail
    4.73          ud2
    4.74  
    4.75 -vmx_goto_realmode:
    4.76 +.Lvmx_goto_realmode:
    4.77          sti
    4.78          movq %rsp,%rdi
    4.79          call vmx_realmode
    4.80          jmp vmx_asm_do_vmentry
    4.81 +        jmp vmx_asm_do_vmentry
    4.82 +
    4.83 +.Lvmx_process_softirqs:
    4.84 +        sti
    4.85 +        call do_softirq
    4.86 +        jmp vmx_asm_do_vmentry