1 #ifndef __STREAM_FORMAT__H 2 #define __STREAM_FORMAT__H 3 4 /* 5 * C structures for the Migration v2 stream format. 6 * See docs/specs/libxc-migration-stream.pandoc 7 */ 8 9 #include <inttypes.h> 10 11 /* 12 * Image Header 13 */ 14 struct xc_sr_ihdr 15 { 16 uint64_t marker; 17 uint32_t id; 18 uint32_t version; 19 uint16_t options; 20 uint16_t _res1; 21 uint32_t _res2; 22 }; 23 24 #define IHDR_MARKER 0xffffffffffffffffULL 25 #define IHDR_ID 0x58454E46U 26 27 #define _IHDR_OPT_ENDIAN 0 28 #define IHDR_OPT_LITTLE_ENDIAN (0 << _IHDR_OPT_ENDIAN) 29 #define IHDR_OPT_BIG_ENDIAN (1 << _IHDR_OPT_ENDIAN) 30 31 /* 32 * Domain Header 33 */ 34 struct xc_sr_dhdr 35 { 36 uint32_t type; 37 uint16_t page_shift; 38 uint16_t _res1; 39 uint32_t xen_major; 40 uint32_t xen_minor; 41 }; 42 43 #define DHDR_TYPE_X86_PV 0x00000001U 44 #define DHDR_TYPE_X86_HVM 0x00000002U 45 46 /* 47 * Record Header 48 */ 49 struct xc_sr_rhdr 50 { 51 uint32_t type; 52 uint32_t length; 53 }; 54 55 /* All records must be aligned up to an 8 octet boundary */ 56 #define REC_ALIGN_ORDER (3U) 57 /* Somewhat arbitrary - 128MB */ 58 #define REC_LENGTH_MAX (128U << 20) 59 60 #define REC_TYPE_END 0x00000000U 61 #define REC_TYPE_PAGE_DATA 0x00000001U 62 #define REC_TYPE_X86_PV_INFO 0x00000002U 63 #define REC_TYPE_X86_PV_P2M_FRAMES 0x00000003U 64 #define REC_TYPE_X86_PV_VCPU_BASIC 0x00000004U 65 #define REC_TYPE_X86_PV_VCPU_EXTENDED 0x00000005U 66 #define REC_TYPE_X86_PV_VCPU_XSAVE 0x00000006U 67 #define REC_TYPE_SHARED_INFO 0x00000007U 68 #define REC_TYPE_X86_TSC_INFO 0x00000008U 69 #define REC_TYPE_HVM_CONTEXT 0x00000009U 70 #define REC_TYPE_HVM_PARAMS 0x0000000aU 71 #define REC_TYPE_TOOLSTACK 0x0000000bU 72 #define REC_TYPE_X86_PV_VCPU_MSRS 0x0000000cU 73 #define REC_TYPE_VERIFY 0x0000000dU 74 #define REC_TYPE_CHECKPOINT 0x0000000eU 75 #define REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST 0x0000000fU 76 #define REC_TYPE_STATIC_DATA_END 0x00000010U 77 #define REC_TYPE_X86_CPUID_POLICY 0x00000011U 78 #define REC_TYPE_X86_MSR_POLICY 0x00000012U 79 80 #define REC_TYPE_OPTIONAL 0x80000000U 81 82 /* PAGE_DATA */ 83 struct xc_sr_rec_page_data_header 84 { 85 uint32_t count; 86 uint32_t _res1; 87 uint64_t pfn[0]; 88 }; 89 90 #define PAGE_DATA_PFN_MASK 0x000fffffffffffffULL 91 #define PAGE_DATA_TYPE_MASK 0xf000000000000000ULL 92 93 /* X86_PV_INFO */ 94 struct xc_sr_rec_x86_pv_info 95 { 96 uint8_t guest_width; 97 uint8_t pt_levels; 98 uint8_t _res[6]; 99 }; 100 101 /* X86_PV_P2M_FRAMES */ 102 struct xc_sr_rec_x86_pv_p2m_frames 103 { 104 uint32_t start_pfn; 105 uint32_t end_pfn; 106 uint64_t p2m_pfns[0]; 107 }; 108 109 /* X86_PV_VCPU_{BASIC,EXTENDED,XSAVE,MSRS} */ 110 struct xc_sr_rec_x86_pv_vcpu_hdr 111 { 112 uint32_t vcpu_id; 113 uint32_t _res1; 114 uint8_t context[0]; 115 }; 116 117 /* X86_TSC_INFO */ 118 struct xc_sr_rec_x86_tsc_info 119 { 120 uint32_t mode; 121 uint32_t khz; 122 uint64_t nsec; 123 uint32_t incarnation; 124 uint32_t _res1; 125 }; 126 127 /* HVM_PARAMS */ 128 struct xc_sr_rec_hvm_params_entry 129 { 130 uint64_t index; 131 uint64_t value; 132 }; 133 134 struct xc_sr_rec_hvm_params 135 { 136 uint32_t count; 137 uint32_t _res1; 138 struct xc_sr_rec_hvm_params_entry param[0]; 139 }; 140 141 #endif 142 /* 143 * Local variables: 144 * mode: C 145 * c-file-style: "BSD" 146 * c-basic-offset: 4 147 * tab-width: 4 148 * indent-tabs-mode: nil 149 * End: 150 */ 151