2023-05-07 21:14:43 +00:00
|
|
|
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
|
2023-05-07 22:19:36 +00:00
|
|
|
#ifndef NOXOS_MBR_H
|
|
|
|
#define NOXOS_MBR_H
|
2023-05-07 21:14:43 +00:00
|
|
|
|
|
|
|
#include "utils/stdtypes.h"
|
|
|
|
#include "utils/string.h"
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
MBR_PARTITION_TYPE_UNUSED = 0x00,
|
|
|
|
MBR_PARTITION_TYPE_GPT = 0xEE,
|
|
|
|
MBR_PARTITION_TYPE_EXT2 = 0x83,
|
|
|
|
MBR_PARTITION_TYPE_FAT12 = 0x01,
|
|
|
|
MBR_PARTITION_TYPE_FAT16 = 0x04,
|
|
|
|
MBR_PARTITION_TYPE_FAT32_CHS = 0x0B,
|
|
|
|
MBR_PARTITION_TYPE_FAT32_LBA = 0x0C
|
|
|
|
} mbr_partition_types_E;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t boot_indicator;
|
|
|
|
uint8_t start_head;
|
|
|
|
uint16_t start_sector:6;
|
|
|
|
uint16_t start_cylinder:10;
|
|
|
|
uint8_t partition_type;
|
|
|
|
uint8_t end_head;
|
|
|
|
uint16_t end_sector:6;
|
|
|
|
uint16_t end_cylinder:10;
|
|
|
|
uint32_t start_lba;
|
|
|
|
uint32_t num_sectors;
|
|
|
|
}__attribute__((packed)) mbr_partition_header_T;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t bootstrap [446];
|
|
|
|
mbr_partition_header_T partitions [4];
|
|
|
|
uint8_t signature [2];
|
|
|
|
} mbr_header_T;
|
|
|
|
|
|
|
|
string_t mbr_partition_type_to_string(mbr_partition_types_E type);
|
|
|
|
|
2023-05-07 22:19:36 +00:00
|
|
|
#endif //NOXOS_MBR_H
|