/[pkg-src]/trunk/kernel26-xen/patches-2.6.25-r1/1116-2.6.25-xen-Hack-to-implement-return-to-userspace-without-SWAPGS.patch |
Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1116-2.6.25-xen-Hack-to-implement-return-to-userspace-without-SWAPGS.patch
Parent Directory | Revision Log
Revision 606 -
(show annotations)
(download)
Thu May 22 23:13:13 2008 UTC (16 years ago) by niro
File size: 2211 byte(s)
Thu May 22 23:13:13 2008 UTC (16 years ago) by niro
File size: 2211 byte(s)
-ver bump to 2.6.25-magellan-r1: - linux-2.6.25.4 - fbcondecor-0.9.4 - squashfs-3.3 - unionfs-2.3.3 - tuxonice-3.0-rc7 - linux-phc-0.3.0 - acpi-dstd-0.9a - reiser4 - xen-3.2.0 . ipw3945-1.2.2
1 | From 0ad8cf63312ab9eaf02efdd148eed9151894ef0f Mon Sep 17 00:00:00 2001 |
2 | From: Eduardo Habkost <ehabkost@redhat.com> |
3 | Date: Fri, 18 Jan 2008 17:12:43 -0200 |
4 | Subject: [PATCH] Hack to implement return to userspace without SWAPGS (CLEANME) |
5 | |
6 | Implementing SWAPGS as nop wouldn't be good, because code using it may |
7 | really expect a swapgs operation to be done. It is better to make each |
8 | operation that use swapgs to be a paravirt op. |
9 | |
10 | Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> |
11 | --- |
12 | arch/x86/kernel/entry_64.S | 15 ++++++++++++++- |
13 | arch/x86/xen/entry_64.S | 10 ++++++++++ |
14 | 2 files changed, 24 insertions(+), 1 deletions(-) |
15 | |
16 | diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S |
17 | index 9952c3f..1182250 100644 |
18 | --- a/arch/x86/kernel/entry_64.S |
19 | +++ b/arch/x86/kernel/entry_64.S |
20 | @@ -66,6 +66,17 @@ ENTRY(native_irq_enable_syscall_ret) |
21 | #endif /* CONFIG_PARAVIRT */ |
22 | |
23 | |
24 | +/*FIXME: implement this as a paravirt op */ |
25 | +#ifdef CONFIG_XEN |
26 | +#define retint_swapgs xen_retint_swapgs |
27 | +#define error_userspace error_sti |
28 | +#else |
29 | +#define retint_swapgs native_retint_swapgs |
30 | +#define error_userspace error_swapgs |
31 | +#endif |
32 | + |
33 | + |
34 | + |
35 | .macro TRACE_IRQS_IRETQ offset=ARGOFFSET |
36 | #ifdef CONFIG_TRACE_IRQFLAGS |
37 | bt $9,EFLAGS-\offset(%rsp) /* interrupts off? */ |
38 | @@ -564,8 +575,9 @@ retint_check: |
39 | andl %edi,%edx |
40 | CFI_REMEMBER_STATE |
41 | jnz retint_careful |
42 | + jmp retint_swapgs |
43 | |
44 | -retint_swapgs: /* return to user-space */ |
45 | +native_retint_swapgs: /* return to user-space */ |
46 | /* |
47 | * The iretq could re-enable interrupts: |
48 | */ |
49 | @@ -912,6 +924,7 @@ KPROBE_ENTRY(error_entry) |
50 | xorl %ebx,%ebx |
51 | testl $3,CS(%rsp) |
52 | je error_kernelspace |
53 | + jmp error_userspace |
54 | error_swapgs: |
55 | SWAPGS |
56 | error_sti: |
57 | diff --git a/arch/x86/xen/entry_64.S b/arch/x86/xen/entry_64.S |
58 | index 927108c..2a2a0a0 100644 |
59 | --- a/arch/x86/xen/entry_64.S |
60 | +++ b/arch/x86/xen/entry_64.S |
61 | @@ -41,3 +41,13 @@ ENTRY(do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) |
62 | jmp error_exit |
63 | CFI_ENDPROC |
64 | END(do_hypervisor_callback) |
65 | + |
66 | + |
67 | +ENTRY(xen_retint_swapgs) /* return to user-space */ |
68 | + /* |
69 | + * The iretq could re-enable interrupts: |
70 | + */ |
71 | + DISABLE_INTERRUPTS(CLBR_ANY) |
72 | + TRACE_IRQS_IRETQ |
73 | + jmp restore_args |
74 | +END(xen_retint_swapgs) |
75 | -- |
76 | 1.5.4.1 |
77 |