summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/FirmwareKit/GPT.h
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-01-24 10:38:36 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-01-24 10:38:36 +0100
commit7b4bd3577a31d0f0adc7371840642791ae1567f4 (patch)
tree1a8afc973aaa739d0d763315cad2fd376d1cea9c /dev/Kernel/FirmwareKit/GPT.h
ADD: Open version, with important changes kept out.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/FirmwareKit/GPT.h')
-rw-r--r--dev/Kernel/FirmwareKit/GPT.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/dev/Kernel/FirmwareKit/GPT.h b/dev/Kernel/FirmwareKit/GPT.h
new file mode 100644
index 00000000..590b63ef
--- /dev/null
+++ b/dev/Kernel/FirmwareKit/GPT.h
@@ -0,0 +1,57 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <NewKit/Defines.h>
+#include <FirmwareKit/EFI/EFI.h>
+
+#define kSectorSizeGPT 512
+
+namespace Kernel
+{
+ struct GPT_GUID;
+ struct GPT_PARTITION_TABLE;
+ struct GPT_PARTITION_ENTRY;
+
+ /// @brief GPT GUID structure.
+ typedef struct GPT_GUID
+ {
+ Kernel::UInt32 Data1;
+ Kernel::UInt16 Data2;
+ Kernel::UInt16 Data3;
+ Kernel::UInt8 Data4[8];
+ } GPT_GUID;
+
+ struct PACKED GPT_PARTITION_TABLE final
+ {
+ Char PartitionName[8];
+ UInt32 Revision;
+ UInt32 HeaderSize;
+ UInt32 ChecksumCRC32;
+ UInt32 Reserved1;
+ UInt64 LBAHeader;
+ UInt64 LBAAltHeader;
+ UInt64 FirstGPTEntry;
+ UInt64 LastGPTEntry;
+ GPT_GUID Guid;
+ UInt64 StartingLBA;
+ UInt32 NumPartitionEntries;
+ UInt32 SizeOfEntries;
+ UInt32 CRC32PartEntry;
+ UInt8 Reserved2[kSectorSizeGPT];
+ };
+
+ struct PACKED GPT_PARTITION_ENTRY
+ {
+ GPT_GUID PartitionTypeGUID;
+ GPT_GUID UniquePartitionGUID;
+ UInt64 StartLBA;
+ UInt64 EndLBA;
+ UInt64 Attributes;
+ UInt8 Name[72];
+ };
+} // namespace Kernel