* include/grub/efi/api.h (grub_efi_memory_descriptor): Add packed

attribute as the structure isn't guaranteed to be properly aligned.
	(grub_efi_pci_device_path): Likewise.
	(grub_efi_pccard_device_path): Likewise.
	(grub_efi_memory_mapped_device_path): Likewise. Additionaly explicitly
	specify the size of `memory_type'.
	(grub_efi_vendor_device_path): Likewise.
	(grub_efi_controller_device_path): Likewise.
	(grub_efi_acpi_device_path): Likewise.
	(grub_efi_expanded_acpi_device_path): Likewise.
	(grub_efi_atapi_device_path): Likewise.
	(grub_efi_scsi_device_path): Likewise.
	(grub_efi_fibre_channel_device_path): Likewise.
	(grub_efi_1394_device_path): Likewise.
	(grub_efi_usb_device_path): Likewise.
	(grub_efi_usb_class_device_path): Likewise.
	(grub_efi_i2o_device_path): Likewise.
	(grub_efi_mac_address_device_path): Likewise.
	(grub_efi_ipv4_device_path): Likewise.
	(grub_efi_ipv6_device_path): Likewise.
	(grub_efi_infiniband_device_path): Likewise.
	(grub_efi_uart_device_path): Likewise.
	(grub_efi_vendor_messaging_device_path): Likewise.
	(grub_efi_hard_drive_device_path): Likewise.
	(grub_efi_cdrom_device_path): Likewise.
	(grub_efi_vendor_media_device_path): Likewise.
	(grub_efi_file_path_device_path): Likewise.
	(grub_efi_protocol_device_path): Likewise.
	(grub_efi_piwg_device_path): Likewise.
	(grub_efi_bios_device_path): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-14 11:13:14 +01:00
parent cb8f88ea82
commit e739d69885
2 changed files with 63 additions and 30 deletions

View file

@ -1,3 +1,36 @@
2011-12-14 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/efi/api.h (grub_efi_memory_descriptor): Add packed
attribute as the structure isn't guaranteed to be properly aligned.
(grub_efi_pci_device_path): Likewise.
(grub_efi_pccard_device_path): Likewise.
(grub_efi_memory_mapped_device_path): Likewise. Additionaly explicitly
specify the size of `memory_type'.
(grub_efi_vendor_device_path): Likewise.
(grub_efi_controller_device_path): Likewise.
(grub_efi_acpi_device_path): Likewise.
(grub_efi_expanded_acpi_device_path): Likewise.
(grub_efi_atapi_device_path): Likewise.
(grub_efi_scsi_device_path): Likewise.
(grub_efi_fibre_channel_device_path): Likewise.
(grub_efi_1394_device_path): Likewise.
(grub_efi_usb_device_path): Likewise.
(grub_efi_usb_class_device_path): Likewise.
(grub_efi_i2o_device_path): Likewise.
(grub_efi_mac_address_device_path): Likewise.
(grub_efi_ipv4_device_path): Likewise.
(grub_efi_ipv6_device_path): Likewise.
(grub_efi_infiniband_device_path): Likewise.
(grub_efi_uart_device_path): Likewise.
(grub_efi_vendor_messaging_device_path): Likewise.
(grub_efi_hard_drive_device_path): Likewise.
(grub_efi_cdrom_device_path): Likewise.
(grub_efi_vendor_media_device_path): Likewise.
(grub_efi_file_path_device_path): Likewise.
(grub_efi_protocol_device_path): Likewise.
(grub_efi_piwg_device_path): Likewise.
(grub_efi_bios_device_path): Likewise.
2011-12-14 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/charset.h (grub_utf16_to_utf8): Make src a const pointer.

View file

@ -371,7 +371,7 @@ struct grub_efi_memory_descriptor
grub_efi_virtual_address_t virtual_start;
grub_efi_uint64_t num_pages;
grub_efi_uint64_t attribute;
};
} __attribute__ ((packed));
typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t;
/* Device Path definitions. */
@ -416,7 +416,7 @@ struct grub_efi_pci_device_path
grub_efi_device_path_t header;
grub_efi_uint8_t function;
grub_efi_uint8_t device;
};
} __attribute__ ((packed));
typedef struct grub_efi_pci_device_path grub_efi_pci_device_path_t;
#define GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE 2
@ -425,7 +425,7 @@ struct grub_efi_pccard_device_path
{
grub_efi_device_path_t header;
grub_efi_uint8_t function;
};
} __attribute__ ((packed));
typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
#define GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE 3
@ -433,10 +433,10 @@ typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
struct grub_efi_memory_mapped_device_path
{
grub_efi_device_path_t header;
grub_efi_memory_type_t memory_type;
grub_efi_uint32_t memory_type;
grub_efi_physical_address_t start_address;
grub_efi_physical_address_t end_address;
};
} __attribute__ ((packed));
typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_path_t;
#define GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE 4
@ -446,7 +446,7 @@ struct grub_efi_vendor_device_path
grub_efi_device_path_t header;
grub_efi_guid_t vendor_guid;
grub_efi_uint8_t vendor_defined_data[0];
};
} __attribute__ ((packed));
typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
#define GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE 5
@ -455,7 +455,7 @@ struct grub_efi_controller_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t controller_number;
};
} __attribute__ ((packed));
typedef struct grub_efi_controller_device_path grub_efi_controller_device_path_t;
/* ACPI Device Path. */
@ -468,7 +468,7 @@ struct grub_efi_acpi_device_path
grub_efi_device_path_t header;
grub_efi_uint32_t hid;
grub_efi_uint32_t uid;
};
} __attribute__ ((packed));
typedef struct grub_efi_acpi_device_path grub_efi_acpi_device_path_t;
#define GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE 2
@ -479,8 +479,8 @@ struct grub_efi_expanded_acpi_device_path
grub_efi_uint32_t hid;
grub_efi_uint32_t uid;
grub_efi_uint32_t cid;
char hidstr[1];
};
char hidstr[0];
} __attribute__ ((packed));
typedef struct grub_efi_expanded_acpi_device_path grub_efi_expanded_acpi_device_path_t;
#define GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
@ -503,7 +503,7 @@ struct grub_efi_atapi_device_path
grub_efi_uint8_t primary_secondary;
grub_efi_uint8_t slave_master;
grub_efi_uint16_t lun;
};
} __attribute__ ((packed));
typedef struct grub_efi_atapi_device_path grub_efi_atapi_device_path_t;
#define GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE 2
@ -513,7 +513,7 @@ struct grub_efi_scsi_device_path
grub_efi_device_path_t header;
grub_efi_uint16_t pun;
grub_efi_uint16_t lun;
};
} __attribute__ ((packed));
typedef struct grub_efi_scsi_device_path grub_efi_scsi_device_path_t;
#define GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE 3
@ -524,7 +524,7 @@ struct grub_efi_fibre_channel_device_path
grub_efi_uint32_t reserved;
grub_efi_uint64_t wwn;
grub_efi_uint64_t lun;
};
} __attribute__ ((packed));
typedef struct grub_efi_fibre_channel_device_path grub_efi_fibre_channel_device_path_t;
#define GRUB_EFI_1394_DEVICE_PATH_SUBTYPE 4
@ -534,7 +534,7 @@ struct grub_efi_1394_device_path
grub_efi_device_path_t header;
grub_efi_uint32_t reserved;
grub_efi_uint64_t guid;
};
} __attribute__ ((packed));
typedef struct grub_efi_1394_device_path grub_efi_1394_device_path_t;
#define GRUB_EFI_USB_DEVICE_PATH_SUBTYPE 5
@ -544,7 +544,7 @@ struct grub_efi_usb_device_path
grub_efi_device_path_t header;
grub_efi_uint8_t parent_port_number;
grub_efi_uint8_t interface;
};
} __attribute__ ((packed));
typedef struct grub_efi_usb_device_path grub_efi_usb_device_path_t;
#define GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE 15
@ -557,7 +557,7 @@ struct grub_efi_usb_class_device_path
grub_efi_uint8_t device_class;
grub_efi_uint8_t device_subclass;
grub_efi_uint8_t device_protocol;
};
} __attribute__ ((packed));
typedef struct grub_efi_usb_class_device_path grub_efi_usb_class_device_path_t;
#define GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE 6
@ -566,7 +566,7 @@ struct grub_efi_i2o_device_path
{
grub_efi_device_path_t header;
grub_efi_uint32_t tid;
};
} __attribute__ ((packed));
typedef struct grub_efi_i2o_device_path grub_efi_i2o_device_path_t;
#define GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE 11
@ -576,7 +576,7 @@ struct grub_efi_mac_address_device_path
grub_efi_device_path_t header;
grub_efi_mac_address_t mac_address;
grub_efi_uint8_t if_type;
};
} __attribute__ ((packed));
typedef struct grub_efi_mac_address_device_path grub_efi_mac_address_device_path_t;
#define GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE 12
@ -590,7 +590,7 @@ struct grub_efi_ipv4_device_path
grub_efi_uint16_t remote_port;
grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address;
};
} __attribute__ ((packed));
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
#define GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE 13
@ -604,7 +604,7 @@ struct grub_efi_ipv6_device_path
grub_efi_uint16_t remote_port;
grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address;
};
} __attribute__ ((packed));
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
#define GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE 9
@ -617,7 +617,7 @@ struct grub_efi_infiniband_device_path
grub_efi_uint64_t remote_id;
grub_efi_uint64_t target_port_id;
grub_efi_uint64_t device_id;
};
} __attribute__ ((packed));
typedef struct grub_efi_infiniband_device_path grub_efi_infiniband_device_path_t;
#define GRUB_EFI_UART_DEVICE_PATH_SUBTYPE 14
@ -630,7 +630,7 @@ struct grub_efi_uart_device_path
grub_efi_uint8_t data_bits;
grub_efi_uint8_t parity;
grub_efi_uint8_t stop_bits;
};
} __attribute__ ((packed));
typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
@ -640,7 +640,7 @@ struct grub_efi_vendor_messaging_device_path
grub_efi_device_path_t header;
grub_efi_guid_t vendor_guid;
grub_efi_uint8_t vendor_defined_data[0];
};
} __attribute__ ((packed));
typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
/* Media Device Path. */
@ -657,7 +657,7 @@ struct grub_efi_hard_drive_device_path
grub_efi_uint8_t partition_signature[8];
grub_efi_uint8_t mbr_type;
grub_efi_uint8_t signature_type;
};
} __attribute__ ((packed));
typedef struct grub_efi_hard_drive_device_path grub_efi_hard_drive_device_path_t;
#define GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE 2
@ -668,7 +668,7 @@ struct grub_efi_cdrom_device_path
grub_efi_uint32_t boot_entry;
grub_efi_lba_t partition_start;
grub_efi_lba_t partition_size;
};
} __attribute__ ((packed));
typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t;
#define GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE 3
@ -678,7 +678,7 @@ struct grub_efi_vendor_media_device_path
grub_efi_device_path_t header;
grub_efi_guid_t vendor_guid;
grub_efi_uint8_t vendor_defined_data[0];
};
} __attribute__ ((packed));
typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t;
#define GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE 4
@ -687,7 +687,7 @@ struct grub_efi_file_path_device_path
{
grub_efi_device_path_t header;
grub_efi_char16_t path_name[0];
};
} __attribute__ ((packed));
typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t;
#define GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE 5
@ -696,7 +696,7 @@ struct grub_efi_protocol_device_path
{
grub_efi_device_path_t header;
grub_efi_guid_t guid;
};
} __attribute__ ((packed));
typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
#define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6
@ -705,7 +705,7 @@ struct grub_efi_piwg_device_path
{
grub_efi_device_path_t header;
grub_efi_guid_t guid __attribute__ ((packed));
};
} __attribute__ ((packed));
typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
@ -720,7 +720,7 @@ struct grub_efi_bios_device_path
grub_efi_uint16_t device_type;
grub_efi_uint16_t status_flags;
char description[0];
};
} __attribute__ ((packed));
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
struct grub_efi_open_protocol_information_entry