mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-27 17:49:23 +00:00
types: Split aligned and packed guids
On ia64 alignment requirements are strict. When we pass a pointer to UUID it needs to be at least 4-byte aligned or EFI will crash. On the other hand in device path there is no padding for UUID, so we need 2 types in one formor another. Make 4-byte aligned and unaligned types The code is structured in a way to accept unaligned inputs in most cases and supply 4-byte aligned outputs. Efiemu case is a bit ugly because there inputs and outputs are reversed and so we need careful casts to account for this inversion. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
5fc985bfdd
commit
7de6fe9635
9 files changed
+54
-24
No files matched your search
@@ -730,7 +730,7 @@ typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_
|
||||
struct grub_efi_vendor_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_guid_t vendor_guid;
|
||||
grub_packed_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
|
||||
@@ -974,7 +974,7 @@ typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t;
|
||||
struct grub_efi_vendor_media_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_guid_t vendor_guid;
|
||||
grub_packed_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t;
|
||||
@@ -993,7 +993,7 @@ typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t;
|
||||
struct grub_efi_protocol_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_guid_t guid;
|
||||
grub_packed_guid_t guid;
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
|
||||
|
||||
@@ -1002,7 +1002,7 @@ typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
|
||||
struct grub_efi_piwg_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_guid_t guid;
|
||||
grub_packed_guid_t guid;
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
|
||||
|
||||
@@ -1287,7 +1287,7 @@ struct grub_efi_boot_services
|
||||
|
||||
grub_efi_status_t
|
||||
(__grub_efi_api *protocols_per_handle) (grub_efi_handle_t handle,
|
||||
grub_guid_t ***protocol_buffer,
|
||||
grub_packed_guid_t ***protocol_buffer,
|
||||
grub_efi_uintn_t *protocol_buffer_count);
|
||||
|
||||
grub_efi_status_t
|
||||
@@ -1386,7 +1386,7 @@ typedef struct grub_efi_runtime_services grub_efi_runtime_services_t;
|
||||
|
||||
struct grub_efi_configuration_table
|
||||
{
|
||||
grub_guid_t vendor_guid;
|
||||
grub_packed_guid_t vendor_guid;
|
||||
void *vendor_table;
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efi_configuration_table grub_efi_configuration_table_t;
|
||||
|
||||
@@ -183,13 +183,13 @@ struct grub_efiemu_configuration_table
|
||||
};
|
||||
struct grub_efiemu_configuration_table32
|
||||
{
|
||||
grub_guid_t vendor_guid;
|
||||
grub_packed_guid_t vendor_guid;
|
||||
grub_efi_uint32_t vendor_table;
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efiemu_configuration_table32 grub_efiemu_configuration_table32_t;
|
||||
struct grub_efiemu_configuration_table64
|
||||
{
|
||||
grub_guid_t vendor_guid;
|
||||
grub_packed_guid_t vendor_guid;
|
||||
grub_efi_uint64_t vendor_table;
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_efiemu_configuration_table64 grub_efiemu_configuration_table64_t;
|
||||
|
||||
@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
|
||||
|
||||
struct efi_variable
|
||||
{
|
||||
grub_guid_t guid;
|
||||
grub_packed_guid_t guid;
|
||||
grub_uint32_t namelen;
|
||||
grub_uint32_t size;
|
||||
grub_efi_uint32_t attributes;
|
||||
|
||||
+10
-1
@@ -376,7 +376,16 @@ struct grub_guid
|
||||
grub_uint16_t data2;
|
||||
grub_uint16_t data3;
|
||||
grub_uint8_t data4[8];
|
||||
} GRUB_PACKED;
|
||||
} __attribute__ ((aligned(4)));
|
||||
typedef struct grub_guid grub_guid_t;
|
||||
|
||||
struct grub_packed_guid
|
||||
{
|
||||
grub_uint32_t data1;
|
||||
grub_uint16_t data2;
|
||||
grub_uint16_t data3;
|
||||
grub_uint8_t data4[8];
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_packed_guid grub_packed_guid_t;
|
||||
|
||||
#endif /* ! GRUB_TYPES_HEADER */
|
||||
Reference in new issue
Block a user