46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
Date: Sun, 13 Aug 2023 09:18:23 +0200
|
|
Subject: [PATCH] [PARTIAL] 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>
|
|
---
|
|
include/grub/types.h | 11 ++++++++++-
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/include/grub/types.h b/include/grub/types.h
|
|
index de6b0b3..1d554c8 100644
|
|
--- a/include/grub/types.h
|
|
+++ b/include/grub/types.h
|
|
@@ -361,7 +361,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 */
|