From abb88cf47ff1c10962401e2760e2ef39d9a0eeed Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 9 Jan 2025 02:31:11 +0000 Subject: [PATCH] arch: tdx: use proper repr qualifications They should be packed and use C ABI. Signed-off-by: Wei Liu --- arch/src/x86_64/tdx/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/src/x86_64/tdx/mod.rs b/arch/src/x86_64/tdx/mod.rs index d4c58bfb0..aa74bea9f 100644 --- a/arch/src/x86_64/tdx/mod.rs +++ b/arch/src/x86_64/tdx/mod.rs @@ -35,7 +35,7 @@ const TABLE_FOOTER_GUID: &str = "96b582de-1fb2-45f7-baea-a366c55a082d"; const TDVF_METADATA_OFFSET_GUID: &str = "e47a6535-984a-4798-865e-4685a7bf8ec2"; // TDVF_DESCRIPTOR -#[repr(packed)] +#[repr(C, packed)] #[derive(Default)] pub struct TdvfDescriptor { signature: [u8; 4], @@ -45,7 +45,7 @@ pub struct TdvfDescriptor { } // TDVF_SECTION -#[repr(packed)] +#[repr(C, packed)] #[derive(Clone, Copy, Default, Debug)] pub struct TdvfSection { pub data_offset: u32, @@ -209,7 +209,7 @@ enum HobType { EndOfHobList = 0xffff, } -#[repr(C)] +#[repr(C, packed)] #[derive(Copy, Clone, Default, Debug)] struct HobHeader { r#type: HobType, @@ -217,7 +217,7 @@ struct HobHeader { reserved: u32, } -#[repr(C)] +#[repr(C, packed)] #[derive(Copy, Clone, Default, Debug)] struct HobHandoffInfoTable { header: HobHeader, @@ -230,7 +230,7 @@ struct HobHandoffInfoTable { efi_end_of_hob_list: u64, } -#[repr(C)] +#[repr(C, packed)] #[derive(Copy, Clone, Default, Debug)] struct EfiGuid { data1: u32, @@ -239,7 +239,7 @@ struct EfiGuid { data4: [u8; 8], } -#[repr(C)] +#[repr(C, packed)] #[derive(Copy, Clone, Default, Debug)] struct HobResourceDescriptor { header: HobHeader, @@ -250,7 +250,7 @@ struct HobResourceDescriptor { resource_length: u64, } -#[repr(C)] +#[repr(C, packed)] #[derive(Copy, Clone, Default, Debug)] struct HobGuidType { header: HobHeader, @@ -266,14 +266,14 @@ pub enum PayloadImageType { RawVmLinux, } -#[repr(C)] +#[repr(C, packed)] #[derive(Copy, Clone, Default, Debug)] pub struct PayloadInfo { pub image_type: PayloadImageType, pub entry_point: u64, } -#[repr(C)] +#[repr(C, packed)] #[derive(Copy, Clone, Default, Debug)] struct TdPayload { guid_type: HobGuidType,