Linux 4.13.16
[linux/fpc-iii.git] / arch / x86 / xen / xen-head.S
blob72a8e6adebe6c09da07303bafac194236f2df7c6
1 /* Xen-specific pieces of head.S, intended to be included in the right
2         place in head.S */
4 #ifdef CONFIG_XEN
6 #include <linux/elfnote.h>
7 #include <linux/init.h>
9 #include <asm/boot.h>
10 #include <asm/asm.h>
11 #include <asm/page_types.h>
13 #include <xen/interface/elfnote.h>
14 #include <xen/interface/features.h>
15 #include <xen/interface/xen.h>
16 #include <xen/interface/xen-mca.h>
17 #include <asm/xen/interface.h>
19 #ifdef CONFIG_XEN_PV
20         __INIT
21 ENTRY(startup_xen)
22         cld
24         /* Clear .bss */
25         xor %eax,%eax
26         mov $__bss_start, %_ASM_DI
27         mov $__bss_stop, %_ASM_CX
28         sub %_ASM_DI, %_ASM_CX
29         shr $__ASM_SEL(2, 3), %_ASM_CX
30         rep __ASM_SIZE(stos)
32         mov %_ASM_SI, xen_start_info
33         mov $init_thread_union+THREAD_SIZE, %_ASM_SP
35         jmp xen_start_kernel
37         __FINIT
38 #endif
40 .pushsection .text
41         .balign PAGE_SIZE
42 ENTRY(hypercall_page)
43         .skip PAGE_SIZE
45 #define HYPERCALL(n) \
46         .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \
47         .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32
48 #include <asm/xen-hypercalls.h>
49 #undef HYPERCALL
51 .popsection
53         ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz "linux")
54         ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz "2.6")
55         ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz "xen-3.0")
56 #ifdef CONFIG_X86_32
57         ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      _ASM_PTR __PAGE_OFFSET)
58 #else
59         ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      _ASM_PTR __START_KERNEL_map)
60         /* Map the p2m table to a 512GB-aligned user address. */
61         ELFNOTE(Xen, XEN_ELFNOTE_INIT_P2M,       .quad PGDIR_SIZE)
62 #endif
63 #ifdef CONFIG_XEN_PV
64         ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          _ASM_PTR startup_xen)
65 #endif
66         ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
67         ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,
68                 .ascii "!writable_page_tables|pae_pgdir_above_4gb")
69         ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES,
70                 .long (1 << XENFEAT_writable_page_tables) | (1 << XENFEAT_dom0))
71         ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz "yes")
72         ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz "generic")
73         ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,
74                 .quad _PAGE_PRESENT; .quad _PAGE_PRESENT)
75         ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
76         ELFNOTE(Xen, XEN_ELFNOTE_MOD_START_PFN,  .long 1)
77         ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   _ASM_PTR __HYPERVISOR_VIRT_START)
78         ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   _ASM_PTR 0)
80 #endif /*CONFIG_XEN */