Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 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> |
Sam Ravnborg | 08b6d29 | 2008-01-30 13:33:25 +0100 | [diff] [blame] | 7 | #include <linux/init.h> |
Jeremy Fitzhardinge | 7077c33 | 2008-07-08 15:06:35 -0700 | [diff] [blame] | 8 | |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 9 | #include <asm/boot.h> |
Jeremy Fitzhardinge | 7077c33 | 2008-07-08 15:06:35 -0700 | [diff] [blame] | 10 | #include <asm/asm.h> |
Jeremy Fitzhardinge | 0341c14 | 2009-02-13 11:14:01 -0800 | [diff] [blame] | 11 | #include <asm/page_types.h> |
Jeremy Fitzhardinge | 7077c33 | 2008-07-08 15:06:35 -0700 | [diff] [blame] | 12 | |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 13 | #include <xen/interface/elfnote.h> |
Mukesh Rathor | 4e903a2 | 2013-12-31 11:16:25 -0500 | [diff] [blame] | 14 | #include <xen/interface/features.h> |
Juergen Gross | 526abea | 2015-01-21 08:49:25 +0100 | [diff] [blame] | 15 | #include <xen/interface/xen.h> |
| 16 | #include <xen/interface/xen-mca.h> |
Jeremy Fitzhardinge | 7e0edc1 | 2008-05-31 01:33:04 +0100 | [diff] [blame] | 17 | #include <asm/xen/interface.h> |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 18 | |
Vitaly Kuznetsov | c504b2f | 2017-03-14 18:35:51 +0100 | [diff] [blame] | 19 | #ifdef CONFIG_XEN_PV |
Sam Ravnborg | 08b6d29 | 2008-01-30 13:33:25 +0100 | [diff] [blame] | 20 | __INIT |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 21 | ENTRY(startup_xen) |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 22 | cld |
Boris Ostrovsky | 04b6b4a | 2016-02-26 14:02:36 -0500 | [diff] [blame] | 23 | |
| 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) |
| 31 | |
Boris Ostrovsky | 4478c40 | 2016-02-26 14:02:37 -0500 | [diff] [blame] | 32 | mov %_ASM_SI, xen_start_info |
| 33 | mov $init_thread_union+THREAD_SIZE, %_ASM_SP |
| 34 | |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 35 | jmp xen_start_kernel |
Sam Ravnborg | 08b6d29 | 2008-01-30 13:33:25 +0100 | [diff] [blame] | 36 | |
| 37 | __FINIT |
Vitaly Kuznetsov | c504b2f | 2017-03-14 18:35:51 +0100 | [diff] [blame] | 38 | #endif |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 39 | |
Jeremy Fitzhardinge | a987b16 | 2008-06-16 15:01:56 -0700 | [diff] [blame] | 40 | .pushsection .text |
Konrad Rzeszutek Wilk | 7d0642b | 2012-07-11 15:03:18 -0400 | [diff] [blame] | 41 | .balign PAGE_SIZE |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 42 | ENTRY(hypercall_page) |
Juergen Gross | 526abea | 2015-01-21 08:49:25 +0100 | [diff] [blame] | 43 | .skip PAGE_SIZE |
Konrad Rzeszutek Wilk | 7d0642b | 2012-07-11 15:03:18 -0400 | [diff] [blame] | 44 | |
Juergen Gross | 526abea | 2015-01-21 08:49:25 +0100 | [diff] [blame] | 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 |
| 50 | |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 51 | .popsection |
| 52 | |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 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") |
Jeremy Fitzhardinge | 8c5e5ac | 2008-07-08 15:06:44 -0700 | [diff] [blame] | 56 | #ifdef CONFIG_X86_32 |
Jeremy Fitzhardinge | 7077c33 | 2008-07-08 15:06:35 -0700 | [diff] [blame] | 57 | ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR __PAGE_OFFSET) |
Jeremy Fitzhardinge | 8c5e5ac | 2008-07-08 15:06:44 -0700 | [diff] [blame] | 58 | #else |
| 59 | ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR __START_KERNEL_map) |
Juergen Gross | 8f5b0c6 | 2015-07-17 06:51:25 +0200 | [diff] [blame] | 60 | /* Map the p2m table to a 512GB-aligned user address. */ |
| 61 | ELFNOTE(Xen, XEN_ELFNOTE_INIT_P2M, .quad PGDIR_SIZE) |
Jeremy Fitzhardinge | 8c5e5ac | 2008-07-08 15:06:44 -0700 | [diff] [blame] | 62 | #endif |
Vitaly Kuznetsov | c504b2f | 2017-03-14 18:35:51 +0100 | [diff] [blame] | 63 | #ifdef CONFIG_XEN_PV |
Jeremy Fitzhardinge | 7077c33 | 2008-07-08 15:06:35 -0700 | [diff] [blame] | 64 | ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR startup_xen) |
Vitaly Kuznetsov | c504b2f | 2017-03-14 18:35:51 +0100 | [diff] [blame] | 65 | #endif |
Jeremy Fitzhardinge | 7077c33 | 2008-07-08 15:06:35 -0700 | [diff] [blame] | 66 | ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page) |
Boris Ostrovsky | 063334f | 2017-02-03 16:57:22 -0500 | [diff] [blame] | 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)) |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 71 | ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 72 | ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") |
Jeremy Fitzhardinge | 7e0edc1 | 2008-05-31 01:33:04 +0100 | [diff] [blame] | 73 | ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, |
| 74 | .quad _PAGE_PRESENT; .quad _PAGE_PRESENT) |
| 75 | ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1) |
Juergen Gross | d1e9abd | 2014-09-17 06:12:36 +0200 | [diff] [blame] | 76 | ELFNOTE(Xen, XEN_ELFNOTE_MOD_START_PFN, .long 1) |
Jeremy Fitzhardinge | 7077c33 | 2008-07-08 15:06:35 -0700 | [diff] [blame] | 77 | ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, _ASM_PTR __HYPERVISOR_VIRT_START) |
Jeremy Fitzhardinge | 8c5e5ac | 2008-07-08 15:06:44 -0700 | [diff] [blame] | 78 | ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0) |
Jeremy Fitzhardinge | 5ead97c | 2007-07-17 18:37:04 -0700 | [diff] [blame] | 79 | |
| 80 | #endif /*CONFIG_XEN */ |