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