41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOXOS_MBR_H
|
|
#define NOXOS_MBR_H
|
|
|
|
#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);
|
|
|
|
#endif //NOXOS_MBR_H
|