aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/lguest/i386_head.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/lguest/i386_head.S')
-rw-r--r--arch/x86/lguest/i386_head.S35
1 files changed, 20 insertions, 15 deletions
diff --git a/arch/x86/lguest/i386_head.S b/arch/x86/lguest/i386_head.S
index 4f420c2f2d55..6ddfe4fc23c3 100644
--- a/arch/x86/lguest/i386_head.S
+++ b/arch/x86/lguest/i386_head.S
@@ -6,18 +6,22 @@
6#include <asm/processor-flags.h> 6#include <asm/processor-flags.h>
7 7
8/*G:020 8/*G:020
9 * Our story starts with the kernel booting into startup_32 in 9
10 * arch/x86/kernel/head_32.S. It expects a boot header, which is created by 10 * Our story starts with the bzImage: booting starts at startup_32 in
11 * the bootloader (the Launcher in our case). 11 * arch/x86/boot/compressed/head_32.S. This merely uncompresses the real
12 * kernel in place and then jumps into it: startup_32 in
13 * arch/x86/kernel/head_32.S. Both routines expects a boot header in the %esi
14 * register, which is created by the bootloader (the Launcher in our case).
12 * 15 *
13 * The startup_32 function does very little: it clears the uninitialized global 16 * The startup_32 function does very little: it clears the uninitialized global
14 * C variables which we expect to be zero (ie. BSS) and then copies the boot 17 * C variables which we expect to be zero (ie. BSS) and then copies the boot
15 * header and kernel command line somewhere safe. Finally it checks the 18 * header and kernel command line somewhere safe, and populates some initial
16 * 'hardware_subarch' field. This was introduced in 2.6.24 for lguest and Xen: 19 * page tables. Finally it checks the 'hardware_subarch' field. This was
17 * if it's set to '1' (lguest's assigned number), then it calls us here. 20 * introduced in 2.6.24 for lguest and Xen: if it's set to '1' (lguest's
21 * assigned number), then it calls us here.
18 * 22 *
19 * WARNING: be very careful here! We're running at addresses equal to physical 23 * WARNING: be very careful here! We're running at addresses equal to physical
20 * addesses (around 0), not above PAGE_OFFSET as most code expectes 24 * addresses (around 0), not above PAGE_OFFSET as most code expects
21 * (eg. 0xC0000000). Jumps are relative, so they're OK, but we can't touch any 25 * (eg. 0xC0000000). Jumps are relative, so they're OK, but we can't touch any
22 * data without remembering to subtract __PAGE_OFFSET! 26 * data without remembering to subtract __PAGE_OFFSET!
23 * 27 *
@@ -27,13 +31,18 @@
27.section .init.text, "ax", @progbits 31.section .init.text, "ax", @progbits
28ENTRY(lguest_entry) 32ENTRY(lguest_entry)
29 /* 33 /*
30 * We make the "initialization" hypercall now to tell the Host about 34 * We make the "initialization" hypercall now to tell the Host where
31 * us, and also find out where it put our page tables. 35 * our lguest_data struct is.
32 */ 36 */
33 movl $LHCALL_LGUEST_INIT, %eax 37 movl $LHCALL_LGUEST_INIT, %eax
34 movl $lguest_data - __PAGE_OFFSET, %ebx 38 movl $lguest_data - __PAGE_OFFSET, %ebx
35 int $LGUEST_TRAP_ENTRY 39 int $LGUEST_TRAP_ENTRY
36 40
41 /* Now turn our pagetables on; setup by arch/x86/kernel/head_32.S. */
42 movl $LHCALL_NEW_PGTABLE, %eax
43 movl $(initial_page_table - __PAGE_OFFSET), %ebx
44 int $LGUEST_TRAP_ENTRY
45
37 /* Set up the initial stack so we can run C code. */ 46 /* Set up the initial stack so we can run C code. */
38 movl $(init_thread_union+THREAD_SIZE),%esp 47 movl $(init_thread_union+THREAD_SIZE),%esp
39 48
@@ -96,12 +105,8 @@ send_interrupts:
96 */ 105 */
97 pushl %eax 106 pushl %eax
98 movl $LHCALL_SEND_INTERRUPTS, %eax 107 movl $LHCALL_SEND_INTERRUPTS, %eax
99 /* 108 /* This is the actual hypercall trap. */
100 * This is a vmcall instruction (same thing that KVM uses). Older 109 int $LGUEST_TRAP_ENTRY
101 * assembler versions might not know the "vmcall" instruction, so we
102 * create one manually here.
103 */
104 .byte 0x0f,0x01,0xc1 /* KVM_HYPERCALL */
105 /* Put eax back the way we found it. */ 110 /* Put eax back the way we found it. */
106 popl %eax 111 popl %eax
107 ret 112 ret