1 /* $Id$ */ 2 /* $NetBSD: bootsect.h,v 1.4 1994/06/29 06:35:28 cgd Exp $ */ 3 4 /* 5 * Written by Paul Popelka (paulp@uts.amdahl.com) 6 * 7 * You can do anything you want with this software, just don't say you wrote 8 * it, and don't remove this notice. 9 * 10 * This software is provided "as is". 11 * 12 * The author supplies this software to be publicly redistributed on the 13 * understanding that the author is not responsible for the correct 14 * functioning of this software in any circumstances and is not liable for 15 * any damages caused by this software. 16 * 17 * October 1992 18 */ 19 20 /* 21 * Format of a boot sector. This is the first sector on a DOS floppy disk 22 * or the fist sector of a partition on a hard disk. But, it is not the 23 * first sector of a partitioned hard disk. 24 */ 25 struct bootsector33 { 26 u_char bsJump[3]; /* jump instruction E9xxxx or EBxx90 */ 27 char bsOemName[8]; /* OEM name and version */ 28 char bsBPB[19]; /* BIOS parameter block */ 29 char bsDriveNumber; /* drive number (0x80) */ 30 char bsBootCode[474]; /* pad so structure is 512 bytes long */ 31 u_short bsBootSectSig; 32 #define BOOTSIG 0xaa55 33 }; 34 35 struct bootsector50 { 36 u_char bsJump[3]; /* jump instruction E9xxxx or EBxx90 */ 37 char bsOemName[8]; /* OEM name and version */ 38 char bsBPB[25]; /* BIOS parameter block */ 39 char bsDriveNumber; /* drive number (0x80) */ 40 char bsReserved1; /* reserved */ 41 char bsBootSignature; /* extended boot signature (0x29) */ 42 #define EXBOOTSIG 0x29 43 char bsVolumeID[4]; /* volume ID number */ 44 char bsVolumeLabel[11]; /* volume label */ 45 char bsFileSysType[8]; /* file system type (FAT12 or FAT16) */ 46 char bsBootCode[448]; /* pad so structure is 512 bytes long */ 47 u_short bsBootSectSig; 48 #define BOOTSIG 0xaa55 49 }; 50 51 union bootsector { 52 struct bootsector33 bs33; 53 struct bootsector50 bs50; 54 }; 55 56 /* 57 * Shorthand for fields in the bpb. 58 */ 59 #define bsBytesPerSec bsBPB.bpbBytesPerSec 60 #define bsSectPerClust bsBPB.bpbSectPerClust 61 #define bsResSectors bsBPB.bpbResSectors 62 #define bsFATS bsBPB.bpbFATS 63 #define bsRootDirEnts bsBPB.bpbRootDirEnts 64 #define bsSectors bsBPB.bpbSectors 65 #define bsMedia bsBPB.bpbMedia 66 #define bsFATsecs bsBPB.bpbFATsecs 67 #define bsSectPerTrack bsBPB.bpbSectPerTrack 68 #define bsHeads bsBPB.bpbHeads 69 #define bsHiddenSecs bsBPB.bpbHiddenSecs 70 #define bsHugeSectors bsBPB.bpbHugeSectors 71