summaryrefslogtreecommitdiff
path: root/kernel/src/drivers/gpt.hpp
blob: 109ede641889eff7156e423cc547820acce6e820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include <cstdint>

struct __attribute__((packed)) gpt_lba1 {
    std::uint8_t signature[8];
    std::uint32_t revision;
    std::uint32_t size;
    std::uint32_t crc32;
    std::uint32_t reserved;
    std::uint64_t current_lba;
    std::uint64_t other_lba;
    std::uint64_t first_usable;
    std::uint64_t last_usable;
    std::uint8_t guid[16];
    std::uint64_t partition_lba;
    std::uint32_t count_partitions;
    std::uint32_t size_of_partition;
};

struct __attribute__((packed)) gpt_partition_entry {
    std::uint8_t guid[16];
    std::uint8_t unique_guid[16];
    std::uint64_t start_lba;
    std::uint64_t end_lba;
    std::uint64_t attributes;
    std::uint8_t name[72];
};

static_assert(sizeof(gpt_partition_entry) == (0x38 + 72));
static_assert(sizeof(gpt_lba1) == 0x58);

#define GPT_SIGNATURE "EFI PART"