1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Xen-specific pieces of head.S, intended to be included in the right
7 #include <linux/elfnote.h>
8 #include <linux/init.h>
13 #include <asm/page_types.h>
14 #include <asm/percpu.h>
15 #include <asm/unwind_hints.h>
17 #include <xen/interface/elfnote.h>
18 #include <xen/interface/features.h>
19 #include <xen/interface/xen.h>
20 #include <xen/interface/xen-mca.h>
21 #include <asm/xen/interface.h>
25 SYM_CODE_START(startup_xen)
31 mov $__bss_start, %_ASM_DI
32 mov $__bss_stop, %_ASM_CX
33 sub %_ASM_DI, %_ASM_CX
34 shr $__ASM_SEL(2, 3), %_ASM_CX
37 mov %_ASM_SI, xen_start_info
38 mov $init_thread_union+THREAD_SIZE, %_ASM_SP
43 * The base of %gs always points to fixed_percpu_data. If the
44 * stack protector canary is enabled, it is located at %gs:40.
45 * Note that, on SMP, the boot cpu uses init data section until
46 * the per cpu areas are set up.
48 movl $MSR_GS_BASE,%ecx
49 movq $INIT_PER_CPU_VAR(fixed_percpu_data),%rax
55 SYM_CODE_END(startup_xen)
61 SYM_CODE_START(hypercall_page)
62 .rept (PAGE_SIZE / 32)
67 #define HYPERCALL(n) \
68 .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \
69 .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32
70 #include <asm/xen-hypercalls.h>
72 SYM_CODE_END(hypercall_page)
75 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
76 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
77 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
79 ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR __PAGE_OFFSET)
81 ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR __START_KERNEL_map)
82 /* Map the p2m table to a 512GB-aligned user address. */
83 ELFNOTE(Xen, XEN_ELFNOTE_INIT_P2M, .quad (PUD_SIZE * PTRS_PER_PUD))
86 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR startup_xen)
88 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
89 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,
90 .ascii "!writable_page_tables|pae_pgdir_above_4gb")
91 ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES,
92 .long (1 << XENFEAT_writable_page_tables) | \
93 (1 << XENFEAT_dom0) | \
94 (1 << XENFEAT_linux_rsdp_unrestricted))
95 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
96 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
97 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,
98 .quad _PAGE_PRESENT; .quad _PAGE_PRESENT)
99 ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
100 ELFNOTE(Xen, XEN_ELFNOTE_MOD_START_PFN, .long 1)
101 ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, _ASM_PTR __HYPERVISOR_VIRT_START)
102 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0)
104 #endif /*CONFIG_XEN */