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