aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/entry.S
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2006-12-06 20:14:07 -0500
committerAndi Kleen <andi@basil.nowhere.org>2006-12-06 20:14:07 -0500
commitd3561b7fa0fb0fc583bab0eeda32bec9e4c4056d (patch)
tree39d835965878622d052ef3b3c7b759d83b6bc327 /arch/i386/kernel/entry.S
parentdb91b882aabd0b3b55a87cbfb344f2798bb740b4 (diff)
[PATCH] paravirt: header and stubs for paravirtualisation
Create a paravirt.h header for all the critical operations which need to be replaced with hypervisor calls, and include that instead of defining native operations, when CONFIG_PARAVIRT. This patch does the dumbest possible replacement of paravirtualized instructions: calls through a "paravirt_ops" structure. Currently these are function implementations of native hardware: hypervisors will override the ops structure with their own variants. All the pv-ops functions are declared "fastcall" so that a specific register-based ABI is used, to make inlining assember easier. And: +From: Andy Whitcroft <apw@shadowen.org> The paravirt ops introduce a 'weak' attribute onto memory_setup(). Code ordering leads to the following warnings on x86: arch/i386/kernel/setup.c:651: warning: weak declaration of `memory_setup' after first use results in unspecified behavior Move memory_setup() to avoid this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Andi Kleen <ak@suse.de> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Zachary Amsden <zach@vmware.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Diffstat (limited to 'arch/i386/kernel/entry.S')
-rw-r--r--arch/i386/kernel/entry.S34
1 files changed, 27 insertions, 7 deletions
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 0220bc8cbb43..d274612e05cd 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -62,13 +62,6 @@ DF_MASK = 0x00000400
62NT_MASK = 0x00004000 62NT_MASK = 0x00004000
63VM_MASK = 0x00020000 63VM_MASK = 0x00020000
64 64
65/* These are replaces for paravirtualization */
66#define DISABLE_INTERRUPTS cli
67#define ENABLE_INTERRUPTS sti
68#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
69#define INTERRUPT_RETURN iret
70#define GET_CR0_INTO_EAX movl %cr0, %eax
71
72#ifdef CONFIG_PREEMPT 65#ifdef CONFIG_PREEMPT
73#define preempt_stop DISABLE_INTERRUPTS; TRACE_IRQS_OFF 66#define preempt_stop DISABLE_INTERRUPTS; TRACE_IRQS_OFF
74#else 67#else
@@ -416,6 +409,20 @@ ldt_ss:
416 jnz restore_nocheck 409 jnz restore_nocheck
417 testl $0x00400000, %eax # returning to 32bit stack? 410 testl $0x00400000, %eax # returning to 32bit stack?
418 jnz restore_nocheck # allright, normal return 411 jnz restore_nocheck # allright, normal return
412
413#ifdef CONFIG_PARAVIRT
414 /*
415 * The kernel can't run on a non-flat stack if paravirt mode
416 * is active. Rather than try to fixup the high bits of
417 * ESP, bypass this code entirely. This may break DOSemu
418 * and/or Wine support in a paravirt VM, although the option
419 * is still available to implement the setting of the high
420 * 16-bits in the INTERRUPT_RETURN paravirt-op.
421 */
422 cmpl $0, paravirt_ops+PARAVIRT_enabled
423 jne restore_nocheck
424#endif
425
419 /* If returning to userspace with 16bit stack, 426 /* If returning to userspace with 16bit stack,
420 * try to fix the higher word of ESP, as the CPU 427 * try to fix the higher word of ESP, as the CPU
421 * won't restore it. 428 * won't restore it.
@@ -833,6 +840,19 @@ nmi_espfix_stack:
833.previous 840.previous
834KPROBE_END(nmi) 841KPROBE_END(nmi)
835 842
843#ifdef CONFIG_PARAVIRT
844ENTRY(native_iret)
8451: iret
846.section __ex_table,"a"
847 .align 4
848 .long 1b,iret_exc
849.previous
850
851ENTRY(native_irq_enable_sysexit)
852 sti
853 sysexit
854#endif
855
836KPROBE_ENTRY(int3) 856KPROBE_ENTRY(int3)
837 RING0_INT_FRAME 857 RING0_INT_FRAME
838 pushl $-1 # mark this as an int 858 pushl $-1 # mark this as an int