hv: coding style: use the defined data type __packed

1) Use __attribute__((packed)) instead of #pragma pack(1)
2) Use the defined data type __packed instead of __attribute__((packed))

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1 2018-12-28 23:27:54 +08:00 committed by wenlingz
parent 40f6a9fdff
commit 6f0edfc38d
7 changed files with 15 additions and 19 deletions

View File

@ -235,7 +235,7 @@ extern uint64_t secondary_cpu_stack[1];
struct descriptor_table { struct descriptor_table {
uint16_t limit; uint16_t limit;
uint64_t base; uint64_t base;
} __attribute__((packed)); } __packed;
/* CPU states defined */ /* CPU states defined */
enum pcpu_boot_state { enum pcpu_boot_state {

View File

@ -12,7 +12,7 @@ struct efi_context {
struct acrn_vcpu_regs vcpu_regs; struct acrn_vcpu_regs vcpu_regs;
void *rsdp; void *rsdp;
void *ap_trampoline_buf; void *ap_trampoline_buf;
}__attribute__((packed)); } __packed;
void *get_rsdp_from_uefi(void); void *get_rsdp_from_uefi(void);
void *get_ap_trampoline_buf(void); void *get_ap_trampoline_buf(void);

View File

@ -172,8 +172,6 @@ void invept(const struct acrn_vcpu *vcpu);
uint64_t *lookup_address(uint64_t *pml4_page, uint64_t addr, uint64_t *lookup_address(uint64_t *pml4_page, uint64_t addr,
uint64_t *pg_size, const struct memory_ops *mem_ops); uint64_t *pg_size, const struct memory_ops *mem_ops);
#pragma pack(1)
/** Defines a single entry in an E820 memory map. */ /** Defines a single entry in an E820 memory map. */
struct e820_entry { struct e820_entry {
/** The base address of the memory range. */ /** The base address of the memory range. */
@ -182,9 +180,7 @@ struct e820_entry {
uint64_t length; uint64_t length;
/** The type of memory region. */ /** The type of memory region. */
uint32_t type; uint32_t type;
}; } __packed;
#pragma pack()
/* E820 memory types */ /* E820 memory types */
#define E820_TYPE_RAM 1U /* EFI 1, 2, 3, 4, 5, 6, 7 */ #define E820_TYPE_RAM 1U /* EFI 1, 2, 3, 4, 5, 6, 7 */

View File

@ -55,7 +55,7 @@ struct per_cpu_region {
#endif #endif
} __aligned(PAGE_SIZE); /* per_cpu_region size aligned with PAGE_SIZE */ } __aligned(PAGE_SIZE); /* per_cpu_region size aligned with PAGE_SIZE */
extern struct per_cpu_region per_cpu_data[]; extern struct per_cpu_region per_cpu_data[CONFIG_MAX_PCPU_NUM];
/* /*
* get percpu data for pcpu_id. * get percpu data for pcpu_id.
*/ */

View File

@ -394,7 +394,7 @@ struct acrn_descriptor_ptr {
uint16_t limit; uint16_t limit;
uint64_t base; uint64_t base;
uint16_t reserved[3]; /* align struct size to 64bit */ uint16_t reserved[3]; /* align struct size to 64bit */
} __attribute__((packed)); } __packed;
/** /**
* @brief registers info for vcpu. * @brief registers info for vcpu.

View File

@ -80,7 +80,7 @@ struct mpfps {
uint8_t mpfb3; uint8_t mpfb3;
uint8_t mpfb4; uint8_t mpfb4;
uint8_t mpfb5; uint8_t mpfb5;
} __attribute__((packed)); } __packed;
/* MP Configuration Table Header */ /* MP Configuration Table Header */
struct mpcth { struct mpcth {
@ -97,7 +97,7 @@ struct mpcth {
uint16_t extended_table_length; uint16_t extended_table_length;
uint8_t extended_table_checksum; uint8_t extended_table_checksum;
uint8_t reserved; uint8_t reserved;
} __attribute__((packed)); } __packed;
struct proc_entry { struct proc_entry {
uint8_t type; uint8_t type;
@ -108,13 +108,13 @@ struct proc_entry {
uint32_t feature_flags; uint32_t feature_flags;
uint32_t reserved1; uint32_t reserved1;
uint32_t reserved2; uint32_t reserved2;
} __attribute__((packed)); } __packed;
struct bus_entry { struct bus_entry {
uint8_t type; uint8_t type;
uint8_t bus_id; uint8_t bus_id;
uint8_t bus_type[6]; uint8_t bus_type[6];
} __attribute__((packed)); } __packed;
struct int_entry { struct int_entry {
uint8_t type; uint8_t type;
@ -124,7 +124,7 @@ struct int_entry {
uint8_t src_bus_irq; uint8_t src_bus_irq;
uint8_t dst_apic_id; uint8_t dst_apic_id;
uint8_t dst_apic_int; uint8_t dst_apic_int;
} __attribute__((packed)); } __packed;
struct mptable_info { struct mptable_info {
struct mpfps mpfp; struct mpfps mpfp;

View File

@ -80,7 +80,7 @@ struct mpfps {
uint8_t mpfb3; uint8_t mpfb3;
uint8_t mpfb4; uint8_t mpfb4;
uint8_t mpfb5; uint8_t mpfb5;
} __attribute__((packed)); } __packed;
/* MP Configuration Table Header */ /* MP Configuration Table Header */
struct mpcth { struct mpcth {
@ -97,7 +97,7 @@ struct mpcth {
uint16_t extended_table_length; uint16_t extended_table_length;
uint8_t extended_table_checksum; uint8_t extended_table_checksum;
uint8_t reserved; uint8_t reserved;
} __attribute__((packed)); } __packed;
struct proc_entry { struct proc_entry {
uint8_t type; uint8_t type;
@ -108,13 +108,13 @@ struct proc_entry {
uint32_t feature_flags; uint32_t feature_flags;
uint32_t reserved1; uint32_t reserved1;
uint32_t reserved2; uint32_t reserved2;
} __attribute__((packed)); } __packed;
struct bus_entry { struct bus_entry {
uint8_t type; uint8_t type;
uint8_t bus_id; uint8_t bus_id;
uint8_t bus_type[6]; uint8_t bus_type[6];
} __attribute__((packed)); } __packed;
struct int_entry { struct int_entry {
uint8_t type; uint8_t type;
@ -124,7 +124,7 @@ struct int_entry {
uint8_t src_bus_irq; uint8_t src_bus_irq;
uint8_t dst_apic_id; uint8_t dst_apic_id;
uint8_t dst_apic_int; uint8_t dst_apic_int;
} __attribute__((packed)); } __packed;
struct mptable_info { struct mptable_info {
struct mpfps mpfp; struct mpfps mpfp;