bootsect.h revision 1.2
1/* $OpenBSD: bootsect.h,v 1.2 1997/02/24 14:32:46 niklas Exp $ */ 2/* $NetBSD: bootsect.h,v 1.7 1995/07/24 06:36:23 leo 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 */ 25struct bootsector33 { 26 u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 27 int8_t bsOemName[8]; /* OEM name and version */ 28 int8_t bsBPB[19]; /* BIOS parameter block */ 29 int8_t bsDriveNumber; /* drive number (0x80) */ 30 int8_t bsBootCode[479]; /* pad so struct is 512b */ 31 u_int16_t bsBootSectSig; 32#define BOOTSIG 0xaa55 33}; 34 35struct bootsector50 { 36 u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 37 int8_t bsOemName[8]; /* OEM name and version */ 38 int8_t bsBPB[25]; /* BIOS parameter block */ 39 int8_t bsDriveNumber; /* drive number (0x80) */ 40 int8_t bsReserved1; /* reserved */ 41 int8_t bsBootSignature; /* ext. boot signature (0x29) */ 42#define EXBOOTSIG 0x29 43 int8_t bsVolumeID[4]; /* volume ID number */ 44 int8_t bsVolumeLabel[11]; /* volume label */ 45 int8_t bsFileSysType[8]; /* fs type (FAT12 or FAT16) */ 46 int8_t bsBootCode[448]; /* pad so structure is 512b */ 47 u_int16_t bsBootSectSig; 48#define BOOTSIG 0xaa55 49}; 50#ifdef atari 51/* 52 * The boot sector on a gemdos fs is a little bit different from the msdos fs 53 * format. Currently there is no need to declare a seperate structure, the 54 * bootsector33 struct will do. 55 */ 56#if 0 57struct bootsec_atari { 58 u_int8_t bsBranch[2]; /* branch inst if auto-boot */ 59 int8_t bsFiller[6]; /* anything or nothing */ 60 int8_t bsSerial[3]; /* serial no. for mediachange */ 61 int8_t bsBPB[19]; /* BIOS parameter block */ 62 int8_t bsBootCode[482]; /* pad so struct is 512b */ 63}; 64#endif 65#endif /* atari */ 66 67union bootsector { 68 struct bootsector33 bs33; 69 struct bootsector50 bs50; 70}; 71 72/* 73 * Shorthand for fields in the bpb. 74 */ 75#define bsBytesPerSec bsBPB.bpbBytesPerSec 76#define bsSectPerClust bsBPB.bpbSectPerClust 77#define bsResSectors bsBPB.bpbResSectors 78#define bsFATS bsBPB.bpbFATS 79#define bsRootDirEnts bsBPB.bpbRootDirEnts 80#define bsSectors bsBPB.bpbSectors 81#define bsMedia bsBPB.bpbMedia 82#define bsFATsecs bsBPB.bpbFATsecs 83#define bsSectPerTrack bsBPB.bpbSectPerTrack 84#define bsHeads bsBPB.bpbHeads 85#define bsHiddenSecs bsBPB.bpbHiddenSecs 86#define bsHugeSectors bsBPB.bpbHugeSectors 87