6
6
#include <asm/processor-flags.h>
9
* Our story starts with the kernel booting into startup_32 in
10
* arch/x86/kernel/head_32.S. It expects a boot header, which is created by
11
* the bootloader (the Launcher in our case).
10
* Our story starts with the bzImage: booting starts at startup_32 in
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).
13
16
* The startup_32 function does very little: it clears the uninitialized global
14
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
16
* 'hardware_subarch' field. This was introduced in 2.6.24 for lguest and Xen:
17
* if it's set to '1' (lguest's assigned number), then it calls us here.
18
* header and kernel command line somewhere safe, and populates some initial
19
* page tables. Finally it checks the 'hardware_subarch' field. This was
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.
19
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
25
* (eg. 0xC0000000). Jumps are relative, so they're OK, but we can't touch any
22
26
* data without remembering to subtract __PAGE_OFFSET!
27
31
.section .init.text, "ax", @progbits
28
32
ENTRY(lguest_entry)
30
* We make the "initialization" hypercall now to tell the Host about
31
* us, and also find out where it put our page tables.
34
* We make the "initialization" hypercall now to tell the Host where
35
* our lguest_data struct is.
33
37
movl $LHCALL_LGUEST_INIT, %eax
34
38
movl $lguest_data - __PAGE_OFFSET, %ebx
35
39
int $LGUEST_TRAP_ENTRY
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
37
46
/* Set up the initial stack so we can run C code. */
38
47
movl $(init_thread_union+THREAD_SIZE),%esp
98
107
movl $LHCALL_SEND_INTERRUPTS, %eax
100
* This is a vmcall instruction (same thing that KVM uses). Older
101
* assembler versions might not know the "vmcall" instruction, so we
102
* create one manually here.
104
.byte 0x0f,0x01,0xc1 /* KVM_HYPERCALL */
108
/* This is the actual hypercall trap. */
109
int $LGUEST_TRAP_ENTRY
105
110
/* Put eax back the way we found it. */