2 * Asm versions of Xen pv-ops, suitable for direct use.
4 * We only bother with direct forms (ie, vcpu in pda) of the
5 * operations here; the indirect forms are better handled in C.
9 #include <asm/percpu.h>
10 #include <asm/processor-flags.h>
11 #include <asm/segment.h>
12 #include <asm/asm-offsets.h>
13 #include <asm/thread_info.h>
15 #include <xen/interface/xen.h>
17 #include <linux/linkage.h>
19 .macro xen_pv_trap name
27 xen_pv_trap divide_error
35 xen_pv_trap invalid_op
36 xen_pv_trap device_not_available
37 xen_pv_trap double_fault
38 xen_pv_trap coprocessor_segment_overrun
39 xen_pv_trap invalid_TSS
40 xen_pv_trap segment_not_present
41 xen_pv_trap stack_segment
42 xen_pv_trap general_protection
43 xen_pv_trap page_fault
44 xen_pv_trap spurious_interrupt_bug
45 xen_pv_trap coprocessor_error
46 xen_pv_trap alignment_check
48 xen_pv_trap machine_check
49 #endif /* CONFIG_X86_MCE */
50 xen_pv_trap simd_coprocessor_error
51 #ifdef CONFIG_IA32_EMULATION
52 xen_pv_trap entry_INT80_compat
54 xen_pv_trap hypervisor_callback
56 hypercall_iret = hypercall_page + __HYPERVISOR_iret * 32
64 * rip <-- standard iret frame
69 * r11 }<-- pushed by hypercall page
78 * We're already on the usermode stack at this point, but
79 * still with the kernel gs, so we can easily switch back
81 movq %rsp, PER_CPU_VAR(rsp_scratch)
82 movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
85 pushq PER_CPU_VAR(rsp_scratch)
90 pushq $VGCF_in_syscall
94 * Xen handles syscall callbacks much like ordinary exceptions, which
98 * - an iret-like stack frame on the stack (including rcx and r11):
108 /* Normal 64-bit system call target */
109 ENTRY(xen_syscall_target)
114 * Neither Xen nor the kernel really knows what the old SS and
115 * CS were. The kernel expects __USER_DS and __USER_CS, so
116 * report those values even though Xen will guess its own values.
118 movq $__USER_DS, 4*8(%rsp)
119 movq $__USER_CS, 1*8(%rsp)
121 jmp entry_SYSCALL_64_after_hwframe
122 ENDPROC(xen_syscall_target)
124 #ifdef CONFIG_IA32_EMULATION
126 /* 32-bit compat syscall target */
127 ENTRY(xen_syscall32_target)
132 * Neither Xen nor the kernel really knows what the old SS and
133 * CS were. The kernel expects __USER32_DS and __USER32_CS, so
134 * report those values even though Xen will guess its own values.
136 movq $__USER32_DS, 4*8(%rsp)
137 movq $__USER32_CS, 1*8(%rsp)
139 jmp entry_SYSCALL_compat_after_hwframe
140 ENDPROC(xen_syscall32_target)
142 /* 32-bit compat sysenter target */
143 ENTRY(xen_sysenter_target)
147 jmp entry_SYSENTER_compat
148 ENDPROC(xen_sysenter_target)
150 #else /* !CONFIG_IA32_EMULATION */
152 ENTRY(xen_syscall32_target)
153 ENTRY(xen_sysenter_target)
154 lea 16(%rsp), %rsp /* strip %rcx, %r11 */
158 ENDPROC(xen_syscall32_target)
159 ENDPROC(xen_sysenter_target)
161 #endif /* CONFIG_IA32_EMULATION */