/* $NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $ */12/*-3* Written by Paul Popelka ([email protected])4*5* You can do anything you want with this software, just don't say you wrote6* it, and don't remove this notice.7*8* This software is provided "as is".9*10* The author supplies this software to be publicly redistributed on the11* understanding that the author is not responsible for the correct12* functioning of this software in any circumstances and is not liable for13* any damages caused by this software.14*15* October 199216*/17#ifndef _FS_MSDOSFS_BOOTSECT_H_18#define _FS_MSDOSFS_BOOTSECT_H_1920/*21* Format of a boot sector. This is the first sector on a DOS floppy disk22* or the first sector of a partition on a hard disk. But, it is not the23* first sector of a partitioned hard disk.24*/25struct bootsector33 {26uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */27int8_t bsOemName[8]; /* OEM name and version */28int8_t bsBPB[19]; /* BIOS parameter block */29int8_t bsDriveNumber; /* drive number (0x80) */30int8_t bsBootCode[479]; /* pad so struct is 512b */31uint8_t bsBootSectSig0;32uint8_t bsBootSectSig1;33#define BOOTSIG0 0x5534#define BOOTSIG1 0xaa35};3637struct extboot {38int8_t exDriveNumber; /* drive number (0x80) */39int8_t exReserved1; /* reserved */40int8_t exBootSignature; /* ext. boot signature (0x29) */41#define EXBOOTSIG 0x2942int8_t exVolumeID[4]; /* volume ID number */43int8_t exVolumeLabel[11]; /* volume label */44int8_t exFileSysType[8]; /* fs type (FAT12 or FAT16) */45};4647struct bootsector50 {48uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */49int8_t bsOemName[8]; /* OEM name and version */50int8_t bsBPB[25]; /* BIOS parameter block */51int8_t bsExt[26]; /* Bootsector Extension */52int8_t bsBootCode[448]; /* pad so structure is 512b */53uint8_t bsBootSectSig0;54uint8_t bsBootSectSig1;55#define BOOTSIG0 0x5556#define BOOTSIG1 0xaa57};5859struct bootsector710 {60uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */61int8_t bsOEMName[8]; /* OEM name and version */62int8_t bsBPB[53]; /* BIOS parameter block */63int8_t bsExt[26]; /* Bootsector Extension */64int8_t bsBootCode[420]; /* pad so structure is 512b */65uint8_t bsBootSectSig0;66uint8_t bsBootSectSig1;67#define BOOTSIG0 0x5568#define BOOTSIG1 0xaa69};7071union bootsector {72struct bootsector33 bs33;73struct bootsector50 bs50;74struct bootsector710 bs710;75};7677#if 078/*79* Shorthand for fields in the bpb.80*/81#define bsBytesPerSec bsBPB.bpbBytesPerSec82#define bsSectPerClust bsBPB.bpbSectPerClust83#define bsResSectors bsBPB.bpbResSectors84#define bsFATS bsBPB.bpbFATS85#define bsRootDirEnts bsBPB.bpbRootDirEnts86#define bsSectors bsBPB.bpbSectors87#define bsMedia bsBPB.bpbMedia88#define bsFATsecs bsBPB.bpbFATsecs89#define bsSectPerTrack bsBPB.bpbSectPerTrack90#define bsHeads bsBPB.bpbHeads91#define bsHiddenSecs bsBPB.bpbHiddenSecs92#define bsHugeSectors bsBPB.bpbHugeSectors93#endif9495#endif /* !_FS_MSDOSFS_BOOTSECT_H_ */969798