1952a6212SJordan K. Hubbard /* $NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $ */ 227a0bc89SDoug Rabson 3d167cf6fSWarner Losh /*- 427a0bc89SDoug Rabson * Written by Paul Popelka (paulp@uts.amdahl.com) 527a0bc89SDoug Rabson * 627a0bc89SDoug Rabson * You can do anything you want with this software, just don't say you wrote 727a0bc89SDoug Rabson * it, and don't remove this notice. 827a0bc89SDoug Rabson * 927a0bc89SDoug Rabson * This software is provided "as is". 1027a0bc89SDoug Rabson * 1127a0bc89SDoug Rabson * The author supplies this software to be publicly redistributed on the 1227a0bc89SDoug Rabson * understanding that the author is not responsible for the correct 1327a0bc89SDoug Rabson * functioning of this software in any circumstances and is not liable for 1427a0bc89SDoug Rabson * any damages caused by this software. 1527a0bc89SDoug Rabson * 1627a0bc89SDoug Rabson * October 1992 1727a0bc89SDoug Rabson */ 1848d1bcf8SKonstantin Belousov #ifndef _FS_MSDOSFS_BOOTSECT_H_ 1948d1bcf8SKonstantin Belousov #define _FS_MSDOSFS_BOOTSECT_H_ 2027a0bc89SDoug Rabson 2127a0bc89SDoug Rabson /* 2227a0bc89SDoug Rabson * Format of a boot sector. This is the first sector on a DOS floppy disk 2327a0bc89SDoug Rabson * or the fist sector of a partition on a hard disk. But, it is not the 2427a0bc89SDoug Rabson * first sector of a partitioned hard disk. 2527a0bc89SDoug Rabson */ 2627a0bc89SDoug Rabson struct bootsector33 { 27*23c53312SEd Maste uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 28952a6212SJordan K. Hubbard int8_t bsOemName[8]; /* OEM name and version */ 29952a6212SJordan K. Hubbard int8_t bsBPB[19]; /* BIOS parameter block */ 30952a6212SJordan K. Hubbard int8_t bsDriveNumber; /* drive number (0x80) */ 31952a6212SJordan K. Hubbard int8_t bsBootCode[479]; /* pad so struct is 512b */ 32*23c53312SEd Maste uint8_t bsBootSectSig0; 33*23c53312SEd Maste uint8_t bsBootSectSig1; 34952a6212SJordan K. Hubbard #define BOOTSIG0 0x55 35952a6212SJordan K. Hubbard #define BOOTSIG1 0xaa 36952a6212SJordan K. Hubbard }; 37952a6212SJordan K. Hubbard 38952a6212SJordan K. Hubbard struct extboot { 39952a6212SJordan K. Hubbard int8_t exDriveNumber; /* drive number (0x80) */ 40952a6212SJordan K. Hubbard int8_t exReserved1; /* reserved */ 41952a6212SJordan K. Hubbard int8_t exBootSignature; /* ext. boot signature (0x29) */ 42952a6212SJordan K. Hubbard #define EXBOOTSIG 0x29 43952a6212SJordan K. Hubbard int8_t exVolumeID[4]; /* volume ID number */ 44952a6212SJordan K. Hubbard int8_t exVolumeLabel[11]; /* volume label */ 45952a6212SJordan K. Hubbard int8_t exFileSysType[8]; /* fs type (FAT12 or FAT16) */ 4627a0bc89SDoug Rabson }; 4727a0bc89SDoug Rabson 4827a0bc89SDoug Rabson struct bootsector50 { 49*23c53312SEd Maste uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 50952a6212SJordan K. Hubbard int8_t bsOemName[8]; /* OEM name and version */ 51952a6212SJordan K. Hubbard int8_t bsBPB[25]; /* BIOS parameter block */ 52952a6212SJordan K. Hubbard int8_t bsExt[26]; /* Bootsector Extension */ 53952a6212SJordan K. Hubbard int8_t bsBootCode[448]; /* pad so structure is 512b */ 54*23c53312SEd Maste uint8_t bsBootSectSig0; 55*23c53312SEd Maste uint8_t bsBootSectSig1; 56952a6212SJordan K. Hubbard #define BOOTSIG0 0x55 57952a6212SJordan K. Hubbard #define BOOTSIG1 0xaa 5827a0bc89SDoug Rabson }; 5927a0bc89SDoug Rabson 60952a6212SJordan K. Hubbard struct bootsector710 { 61*23c53312SEd Maste uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 62952a6212SJordan K. Hubbard int8_t bsOEMName[8]; /* OEM name and version */ 638a88248dSJohn Baldwin int8_t bsBPB[53]; /* BIOS parameter block */ 64952a6212SJordan K. Hubbard int8_t bsExt[26]; /* Bootsector Extension */ 6520c5ba36SPeter Edwards int8_t bsBootCode[420]; /* pad so structure is 512b */ 66*23c53312SEd Maste uint8_t bsBootSectSig0; 67*23c53312SEd Maste uint8_t bsBootSectSig1; 68952a6212SJordan K. Hubbard #define BOOTSIG0 0x55 69952a6212SJordan K. Hubbard #define BOOTSIG1 0xaa 70952a6212SJordan K. Hubbard }; 71952a6212SJordan K. Hubbard 7227a0bc89SDoug Rabson union bootsector { 7327a0bc89SDoug Rabson struct bootsector33 bs33; 7427a0bc89SDoug Rabson struct bootsector50 bs50; 75952a6212SJordan K. Hubbard struct bootsector710 bs710; 7627a0bc89SDoug Rabson }; 7727a0bc89SDoug Rabson 78952a6212SJordan K. Hubbard #if 0 7927a0bc89SDoug Rabson /* 8027a0bc89SDoug Rabson * Shorthand for fields in the bpb. 8127a0bc89SDoug Rabson */ 8227a0bc89SDoug Rabson #define bsBytesPerSec bsBPB.bpbBytesPerSec 8327a0bc89SDoug Rabson #define bsSectPerClust bsBPB.bpbSectPerClust 8427a0bc89SDoug Rabson #define bsResSectors bsBPB.bpbResSectors 8527a0bc89SDoug Rabson #define bsFATS bsBPB.bpbFATS 8627a0bc89SDoug Rabson #define bsRootDirEnts bsBPB.bpbRootDirEnts 8727a0bc89SDoug Rabson #define bsSectors bsBPB.bpbSectors 8827a0bc89SDoug Rabson #define bsMedia bsBPB.bpbMedia 8927a0bc89SDoug Rabson #define bsFATsecs bsBPB.bpbFATsecs 9027a0bc89SDoug Rabson #define bsSectPerTrack bsBPB.bpbSectPerTrack 9127a0bc89SDoug Rabson #define bsHeads bsBPB.bpbHeads 9227a0bc89SDoug Rabson #define bsHiddenSecs bsBPB.bpbHiddenSecs 9327a0bc89SDoug Rabson #define bsHugeSectors bsBPB.bpbHugeSectors 94952a6212SJordan K. Hubbard #endif 9548d1bcf8SKonstantin Belousov 9648d1bcf8SKonstantin Belousov #endif /* !_FS_MSDOSFS_BOOTSECT_H_ */ 97