1 1.7 andvar /* $NetBSD: bootsect.h,v 1.7 2021/08/09 21:38:05 andvar Exp $ */ 2 1.1 jdolecek 3 1.1 jdolecek /* 4 1.1 jdolecek * Written by Paul Popelka (paulp (at) uts.amdahl.com) 5 1.1 jdolecek * 6 1.1 jdolecek * You can do anything you want with this software, just don't say you wrote 7 1.1 jdolecek * it, and don't remove this notice. 8 1.1 jdolecek * 9 1.1 jdolecek * This software is provided "as is". 10 1.1 jdolecek * 11 1.1 jdolecek * The author supplies this software to be publicly redistributed on the 12 1.1 jdolecek * understanding that the author is not responsible for the correct 13 1.1 jdolecek * functioning of this software in any circumstances and is not liable for 14 1.1 jdolecek * any damages caused by this software. 15 1.1 jdolecek * 16 1.1 jdolecek * October 1992 17 1.1 jdolecek */ 18 1.3 christos #ifndef _MSDOSFS_BOOTSECT_H_ 19 1.3 christos #define _MSDOSFS_BOOTSECT_H_ 20 1.1 jdolecek 21 1.1 jdolecek /* 22 1.1 jdolecek * Format of a boot sector. This is the first sector on a DOS floppy disk 23 1.7 andvar * or the first sector of a partition on a hard disk. But, it is not the 24 1.1 jdolecek * first sector of a partitioned hard disk. 25 1.1 jdolecek */ 26 1.1 jdolecek struct bootsector33 { 27 1.6 dholland uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 28 1.1 jdolecek int8_t bsOemName[8]; /* OEM name and version */ 29 1.1 jdolecek int8_t bsBPB[19]; /* BIOS parameter block */ 30 1.1 jdolecek int8_t bsDriveNumber; /* drive number (0x80) */ 31 1.1 jdolecek int8_t bsBootCode[479]; /* pad so struct is 512b */ 32 1.6 dholland uint8_t bsBootSectSig0; 33 1.6 dholland uint8_t bsBootSectSig1; 34 1.1 jdolecek #define BOOTSIG0 0x55 35 1.1 jdolecek #define BOOTSIG1 0xaa 36 1.1 jdolecek }; 37 1.1 jdolecek 38 1.1 jdolecek struct extboot { 39 1.1 jdolecek int8_t exDriveNumber; /* drive number (0x80) */ 40 1.1 jdolecek int8_t exReserved1; /* reserved */ 41 1.1 jdolecek int8_t exBootSignature; /* ext. boot signature (0x29) */ 42 1.1 jdolecek #define EXBOOTSIG 0x29 43 1.1 jdolecek int8_t exVolumeID[4]; /* volume ID number */ 44 1.1 jdolecek int8_t exVolumeLabel[11]; /* volume label */ 45 1.1 jdolecek int8_t exFileSysType[8]; /* fs type (FAT12 or FAT16) */ 46 1.1 jdolecek }; 47 1.1 jdolecek 48 1.1 jdolecek struct bootsector50 { 49 1.6 dholland uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 50 1.1 jdolecek int8_t bsOemName[8]; /* OEM name and version */ 51 1.1 jdolecek int8_t bsBPB[25]; /* BIOS parameter block */ 52 1.1 jdolecek int8_t bsExt[26]; /* Bootsector Extension */ 53 1.1 jdolecek int8_t bsBootCode[448]; /* pad so structure is 512b */ 54 1.6 dholland uint8_t bsBootSectSig0; 55 1.6 dholland uint8_t bsBootSectSig1; 56 1.1 jdolecek #define BOOTSIG0 0x55 57 1.1 jdolecek #define BOOTSIG1 0xaa 58 1.1 jdolecek }; 59 1.1 jdolecek 60 1.1 jdolecek struct bootsector710 { 61 1.6 dholland uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 62 1.1 jdolecek int8_t bsOEMName[8]; /* OEM name and version */ 63 1.2 lukem int8_t bsBPB[53]; /* BIOS parameter block */ 64 1.1 jdolecek int8_t bsExt[26]; /* Bootsector Extension */ 65 1.4 gdt int8_t bsBootCode[420]; /* pad so structure is 512b */ 66 1.6 dholland uint8_t bsBootSectSig0; 67 1.6 dholland uint8_t bsBootSectSig1; 68 1.1 jdolecek #define BOOTSIG0 0x55 69 1.1 jdolecek #define BOOTSIG1 0xaa 70 1.1 jdolecek }; 71 1.1 jdolecek #ifdef atari 72 1.1 jdolecek /* 73 1.5 jakllsch * The boot sector on a GEMDOS FS is a little bit different from the MSDOS FS 74 1.1 jdolecek * format. Currently there is no need to declare a separate structure, the 75 1.1 jdolecek * bootsector33 struct will do. 76 1.1 jdolecek */ 77 1.1 jdolecek #if 0 78 1.1 jdolecek struct bootsec_atari { 79 1.6 dholland uint8_t bsBranch[2]; /* branch inst if auto-boot */ 80 1.1 jdolecek int8_t bsFiller[6]; /* anything or nothing */ 81 1.1 jdolecek int8_t bsSerial[3]; /* serial no. for mediachange */ 82 1.1 jdolecek int8_t bsBPB[19]; /* BIOS parameter block */ 83 1.1 jdolecek int8_t bsBootCode[482]; /* pad so struct is 512b */ 84 1.1 jdolecek }; 85 1.1 jdolecek #endif 86 1.1 jdolecek #endif /* atari */ 87 1.1 jdolecek 88 1.1 jdolecek union bootsector { 89 1.1 jdolecek struct bootsector33 bs33; 90 1.1 jdolecek struct bootsector50 bs50; 91 1.1 jdolecek struct bootsector710 bs710; 92 1.1 jdolecek }; 93 1.1 jdolecek 94 1.1 jdolecek #if 0 95 1.1 jdolecek /* 96 1.1 jdolecek * Shorthand for fields in the bpb. 97 1.1 jdolecek */ 98 1.1 jdolecek #define bsBytesPerSec bsBPB.bpbBytesPerSec 99 1.1 jdolecek #define bsSectPerClust bsBPB.bpbSectPerClust 100 1.1 jdolecek #define bsResSectors bsBPB.bpbResSectors 101 1.1 jdolecek #define bsFATS bsBPB.bpbFATS 102 1.1 jdolecek #define bsRootDirEnts bsBPB.bpbRootDirEnts 103 1.1 jdolecek #define bsSectors bsBPB.bpbSectors 104 1.1 jdolecek #define bsMedia bsBPB.bpbMedia 105 1.1 jdolecek #define bsFATsecs bsBPB.bpbFATsecs 106 1.1 jdolecek #define bsSectPerTrack bsBPB.bpbSectPerTrack 107 1.1 jdolecek #define bsHeads bsBPB.bpbHeads 108 1.1 jdolecek #define bsHiddenSecs bsBPB.bpbHiddenSecs 109 1.1 jdolecek #define bsHugeSectors bsBPB.bpbHugeSectors 110 1.1 jdolecek #endif 111 1.3 christos 112 1.3 christos #endif /* _MSDOSFS_BOOTSECT_H_ */ 113