bootsect.h revision 1.1
1/* $NetBSD: bootsect.h,v 1.7 1995/07/24 06:36:23 leo Exp $ */ 2 3/* 4 * Written by Paul Popelka (paulp@uts.amdahl.com) 5 * 6 * You can do anything you want with this software, just don't say you wrote 7 * it, and don't remove this notice. 8 * 9 * This software is provided "as is". 10 * 11 * The author supplies this software to be publicly redistributed on the 12 * understanding that the author is not responsible for the correct 13 * functioning of this software in any circumstances and is not liable for 14 * any damages caused by this software. 15 * 16 * October 1992 17 */ 18 19/* 20 * Format of a boot sector. This is the first sector on a DOS floppy disk 21 * or the fist sector of a partition on a hard disk. But, it is not the 22 * first sector of a partitioned hard disk. 23 */ 24struct bootsector33 { 25 u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 26 int8_t bsOemName[8]; /* OEM name and version */ 27 int8_t bsBPB[19]; /* BIOS parameter block */ 28 int8_t bsDriveNumber; /* drive number (0x80) */ 29 int8_t bsBootCode[479]; /* pad so struct is 512b */ 30 u_int16_t bsBootSectSig; 31#define BOOTSIG 0xaa55 32}; 33 34struct bootsector50 { 35 u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 36 int8_t bsOemName[8]; /* OEM name and version */ 37 int8_t bsBPB[25]; /* BIOS parameter block */ 38 int8_t bsDriveNumber; /* drive number (0x80) */ 39 int8_t bsReserved1; /* reserved */ 40 int8_t bsBootSignature; /* ext. boot signature (0x29) */ 41#define EXBOOTSIG 0x29 42 int8_t bsVolumeID[4]; /* volume ID number */ 43 int8_t bsVolumeLabel[11]; /* volume label */ 44 int8_t bsFileSysType[8]; /* fs type (FAT12 or FAT16) */ 45 int8_t bsBootCode[448]; /* pad so structure is 512b */ 46 u_int16_t bsBootSectSig; 47#define BOOTSIG 0xaa55 48}; 49#ifdef atari 50/* 51 * The boot sector on a gemdos fs is a little bit different from the msdos fs 52 * format. Currently there is no need to declare a seperate structure, the 53 * bootsector33 struct will do. 54 */ 55#if 0 56struct bootsec_atari { 57 u_int8_t bsBranch[2]; /* branch inst if auto-boot */ 58 int8_t bsFiller[6]; /* anything or nothing */ 59 int8_t bsSerial[3]; /* serial no. for mediachange */ 60 int8_t bsBPB[19]; /* BIOS parameter block */ 61 int8_t bsBootCode[482]; /* pad so struct is 512b */ 62}; 63#endif 64#endif /* atari */ 65 66union bootsector { 67 struct bootsector33 bs33; 68 struct bootsector50 bs50; 69}; 70 71/* 72 * Shorthand for fields in the bpb. 73 */ 74#define bsBytesPerSec bsBPB.bpbBytesPerSec 75#define bsSectPerClust bsBPB.bpbSectPerClust 76#define bsResSectors bsBPB.bpbResSectors 77#define bsFATS bsBPB.bpbFATS 78#define bsRootDirEnts bsBPB.bpbRootDirEnts 79#define bsSectors bsBPB.bpbSectors 80#define bsMedia bsBPB.bpbMedia 81#define bsFATsecs bsBPB.bpbFATsecs 82#define bsSectPerTrack bsBPB.bpbSectPerTrack 83#define bsHeads bsBPB.bpbHeads 84#define bsHiddenSecs bsBPB.bpbHiddenSecs 85#define bsHugeSectors bsBPB.bpbHugeSectors 86