48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOXOS_GPT_H
|
|
#define NOXOS_GPT_H
|
|
|
|
#include "utils/stdtypes.h"
|
|
|
|
#define GPT_PARTITION_TYPE_GUID_MATCH(g, t) ((g[0] == g_gpt_partition_type_guides[t][0]) && (g[1] == g_gpt_partition_type_guides[t][1]))
|
|
|
|
typedef enum {
|
|
GPT_PARTITION_GUID_UNUSED,
|
|
GPT_PARTITION_GUID_BASIC_DATA,
|
|
GPT_PARTITION_GUID_EFI_SYSTEM,
|
|
|
|
GPT_PARTITION_GUID_ENUM_END
|
|
} gpt_partition_type_guids_E;
|
|
|
|
typedef struct {
|
|
uint8_t signature [8];
|
|
uint32_t revision;
|
|
uint32_t header_size;
|
|
uint32_t checksum_crc32;
|
|
uint32_t reserved;
|
|
uint64_t current_lba;
|
|
uint64_t backup_lba;
|
|
uint64_t first_usable_lba;
|
|
uint64_t last_usable_lba;
|
|
uint64_t disk_guid [2];
|
|
uint64_t starting_lba;
|
|
uint32_t num_partitions;
|
|
uint32_t partition_entry_size;
|
|
uint32_t partition_entry_crc32;
|
|
uint8_t reserved2 [0x1A4];
|
|
}__attribute__((packed)) gpt_table_header_T;
|
|
|
|
typedef struct {
|
|
uint64_t partition_type_guid [2];
|
|
uint64_t partition_guid [2];
|
|
uint64_t starting_lba;
|
|
uint64_t ending_lba;
|
|
uint64_t attributes;
|
|
uint8_t name [72];
|
|
}__attribute__((packed)) gpt_partition_entry_T;
|
|
|
|
extern uint64_t g_gpt_partition_type_guides[GPT_PARTITION_GUID_ENUM_END][2];
|
|
|
|
#endif //NOXOS_GPT_H
|