40,6 → 40,77 |
|
#define dprintf(...) printf(__VA_ARGS__) |
|
typedef struct { |
uint8_t ji[3]; /**< Jump instruction. */ |
uint8_t oem_name[8]; |
/* BIOS Parameter Block */ |
uint16_t bps; /**< Bytes per sector. */ |
uint8_t spc; /**< Sectors per cluster. */ |
uint16_t rsc; /**< Reserved sector count. */ |
uint8_t fatcnt; /**< Number of FATs. */ |
uint16_t root_ent_max; /**< Maximum number of root directory |
entries. */ |
uint16_t totsec; /**< Total sectors. */ |
uint8_t mdesc; /**< Media descriptor. */ |
uint16_t sec_per_fat; /**< Sectors per FAT12/FAT16. */ |
uint16_t sec_per_track; /**< Sectors per track. */ |
uint16_t headcnt; /**< Number of heads. */ |
uint32_t hidden_sec; /**< Hidden sectors. */ |
uint32_t total_sec; /**< Total sectors. */ |
|
union { |
struct { |
/* FAT12/FAT16 only: Extended BIOS Parameter Block */ |
/** Physical drive number. */ |
uint8_t pdn; |
uint8_t reserved; |
/** Extended boot signature. */ |
uint8_t ebs; |
/** Serial number. */ |
uint32_t id; |
/** Volume label. */ |
uint8_t label[11]; |
/** FAT type. */ |
uint8_t type[8]; |
/** Boot code. */ |
uint8_t boot_code[448]; |
/** Boot sector signature. */ |
uint16_t signature; |
} __attribute__ ((packed)); |
struct { |
/* FAT32 only */ |
/** Sectors per FAT. */ |
uint32_t sectors_per_fat; |
/** FAT flags. */ |
uint16_t flags; |
/** Version. */ |
uint16_t version; |
/** Cluster number of root directory. */ |
uint32_t root_cluster; |
/** Sector number of file system information sector. */ |
uint16_t fsinfo_sec; |
/** Sector number of boot sector copy. */ |
uint16_t bscopy_sec; |
uint8_t reserved1[12]; |
/** Physical drive number. */ |
uint8_t pdn; |
uint8_t reserved2; |
/** Extended boot signature. */ |
uint8_t ebs; |
/** Serial number. */ |
uint32_t id; |
/** Volume label. */ |
uint8_t label; |
/** FAT type. */ |
uint8_t type[8]; |
/** Boot code. */ |
uint8_t boot_code[420]; |
/** Signature. */ |
uint16_t signature; |
} __attribute__ ((packed)); |
}; |
} fat_bs_t __attribute__ ((packed)); |
|
extern uint8_t *plb_ro; |
|
extern int block_read(int, unsigned long, void *); |