1952a6212SJordan K. Hubbard /* $Id: bootsect.h,v 1.5 1997/02/22 09:40:43 peter Exp $ */ 2952a6212SJordan K. Hubbard /* $NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $ */ 327a0bc89SDoug Rabson 427a0bc89SDoug Rabson /* 527a0bc89SDoug Rabson * Written by Paul Popelka (paulp@uts.amdahl.com) 627a0bc89SDoug Rabson * 727a0bc89SDoug Rabson * You can do anything you want with this software, just don't say you wrote 827a0bc89SDoug Rabson * it, and don't remove this notice. 927a0bc89SDoug Rabson * 1027a0bc89SDoug Rabson * This software is provided "as is". 1127a0bc89SDoug Rabson * 1227a0bc89SDoug Rabson * The author supplies this software to be publicly redistributed on the 1327a0bc89SDoug Rabson * understanding that the author is not responsible for the correct 1427a0bc89SDoug Rabson * functioning of this software in any circumstances and is not liable for 1527a0bc89SDoug Rabson * any damages caused by this software. 1627a0bc89SDoug Rabson * 1727a0bc89SDoug Rabson * October 1992 1827a0bc89SDoug Rabson */ 1927a0bc89SDoug Rabson 2027a0bc89SDoug Rabson /* 2127a0bc89SDoug Rabson * Format of a boot sector. This is the first sector on a DOS floppy disk 2227a0bc89SDoug Rabson * or the fist sector of a partition on a hard disk. But, it is not the 2327a0bc89SDoug Rabson * first sector of a partitioned hard disk. 2427a0bc89SDoug Rabson */ 2527a0bc89SDoug Rabson struct bootsector33 { 26952a6212SJordan K. Hubbard u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 27952a6212SJordan K. Hubbard int8_t bsOemName[8]; /* OEM name and version */ 28952a6212SJordan K. Hubbard int8_t bsBPB[19]; /* BIOS parameter block */ 29952a6212SJordan K. Hubbard int8_t bsDriveNumber; /* drive number (0x80) */ 30952a6212SJordan K. Hubbard int8_t bsBootCode[479]; /* pad so struct is 512b */ 31952a6212SJordan K. Hubbard u_int8_t bsBootSectSig0; 32952a6212SJordan K. Hubbard u_int8_t bsBootSectSig1; 33952a6212SJordan K. Hubbard #define BOOTSIG0 0x55 34952a6212SJordan K. Hubbard #define BOOTSIG1 0xaa 35952a6212SJordan K. Hubbard }; 36952a6212SJordan K. Hubbard 37952a6212SJordan K. Hubbard struct extboot { 38952a6212SJordan K. Hubbard int8_t exDriveNumber; /* drive number (0x80) */ 39952a6212SJordan K. Hubbard int8_t exReserved1; /* reserved */ 40952a6212SJordan K. Hubbard int8_t exBootSignature; /* ext. boot signature (0x29) */ 41952a6212SJordan K. Hubbard #define EXBOOTSIG 0x29 42952a6212SJordan K. Hubbard int8_t exVolumeID[4]; /* volume ID number */ 43952a6212SJordan K. Hubbard int8_t exVolumeLabel[11]; /* volume label */ 44952a6212SJordan K. Hubbard int8_t exFileSysType[8]; /* fs type (FAT12 or FAT16) */ 4527a0bc89SDoug Rabson }; 4627a0bc89SDoug Rabson 4727a0bc89SDoug Rabson struct bootsector50 { 48952a6212SJordan K. Hubbard u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 49952a6212SJordan K. Hubbard int8_t bsOemName[8]; /* OEM name and version */ 50952a6212SJordan K. Hubbard int8_t bsBPB[25]; /* BIOS parameter block */ 51952a6212SJordan K. Hubbard int8_t bsExt[26]; /* Bootsector Extension */ 52952a6212SJordan K. Hubbard int8_t bsBootCode[448]; /* pad so structure is 512b */ 53952a6212SJordan K. Hubbard u_int8_t bsBootSectSig0; 54952a6212SJordan K. Hubbard u_int8_t bsBootSectSig1; 55952a6212SJordan K. Hubbard #define BOOTSIG0 0x55 56952a6212SJordan K. Hubbard #define BOOTSIG1 0xaa 5727a0bc89SDoug Rabson }; 5827a0bc89SDoug Rabson 59952a6212SJordan K. Hubbard struct bootsector710 { 60952a6212SJordan K. Hubbard u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ 61952a6212SJordan K. Hubbard int8_t bsOEMName[8]; /* OEM name and version */ 62952a6212SJordan K. Hubbard int8_t bsPBP[53]; /* BIOS parameter block */ 63952a6212SJordan K. Hubbard int8_t bsExt[26]; /* Bootsector Extension */ 64952a6212SJordan K. Hubbard int8_t bsBootCode[418]; /* pad so structure is 512b */ 65952a6212SJordan K. Hubbard u_int8_t bsBootSectSig2; /* 2 & 3 are only defined for FAT32? */ 66952a6212SJordan K. Hubbard u_int8_t bsBootSectSig3; 67952a6212SJordan K. Hubbard u_int8_t bsBootSectSig0; 68952a6212SJordan K. Hubbard u_int8_t bsBootSectSig1; 69952a6212SJordan K. Hubbard #define BOOTSIG0 0x55 70952a6212SJordan K. Hubbard #define BOOTSIG1 0xaa 71952a6212SJordan K. Hubbard #define BOOTSIG2 0 72952a6212SJordan K. Hubbard #define BOOTSIG3 0 73952a6212SJordan K. Hubbard }; 74952a6212SJordan K. Hubbard #ifdef atari 75952a6212SJordan K. Hubbard /* 76952a6212SJordan K. Hubbard * The boot sector on a gemdos fs is a little bit different from the msdos fs 77952a6212SJordan K. Hubbard * format. Currently there is no need to declare a seperate structure, the 78952a6212SJordan K. Hubbard * bootsector33 struct will do. 79952a6212SJordan K. Hubbard */ 80952a6212SJordan K. Hubbard #if 0 81952a6212SJordan K. Hubbard struct bootsec_atari { 82952a6212SJordan K. Hubbard u_int8_t bsBranch[2]; /* branch inst if auto-boot */ 83952a6212SJordan K. Hubbard int8_t bsFiller[6]; /* anything or nothing */ 84952a6212SJordan K. Hubbard int8_t bsSerial[3]; /* serial no. for mediachange */ 85952a6212SJordan K. Hubbard int8_t bsBPB[19]; /* BIOS parameter block */ 86952a6212SJordan K. Hubbard int8_t bsBootCode[482]; /* pad so struct is 512b */ 87952a6212SJordan K. Hubbard }; 88952a6212SJordan K. Hubbard #endif 89952a6212SJordan K. Hubbard #endif /* atari */ 90952a6212SJordan K. Hubbard 9127a0bc89SDoug Rabson union bootsector { 9227a0bc89SDoug Rabson struct bootsector33 bs33; 9327a0bc89SDoug Rabson struct bootsector50 bs50; 94952a6212SJordan K. Hubbard struct bootsector710 bs710; 9527a0bc89SDoug Rabson }; 9627a0bc89SDoug Rabson 97952a6212SJordan K. Hubbard #if 0 9827a0bc89SDoug Rabson /* 9927a0bc89SDoug Rabson * Shorthand for fields in the bpb. 10027a0bc89SDoug Rabson */ 10127a0bc89SDoug Rabson #define bsBytesPerSec bsBPB.bpbBytesPerSec 10227a0bc89SDoug Rabson #define bsSectPerClust bsBPB.bpbSectPerClust 10327a0bc89SDoug Rabson #define bsResSectors bsBPB.bpbResSectors 10427a0bc89SDoug Rabson #define bsFATS bsBPB.bpbFATS 10527a0bc89SDoug Rabson #define bsRootDirEnts bsBPB.bpbRootDirEnts 10627a0bc89SDoug Rabson #define bsSectors bsBPB.bpbSectors 10727a0bc89SDoug Rabson #define bsMedia bsBPB.bpbMedia 10827a0bc89SDoug Rabson #define bsFATsecs bsBPB.bpbFATsecs 10927a0bc89SDoug Rabson #define bsSectPerTrack bsBPB.bpbSectPerTrack 11027a0bc89SDoug Rabson #define bsHeads bsBPB.bpbHeads 11127a0bc89SDoug Rabson #define bsHiddenSecs bsBPB.bpbHiddenSecs 11227a0bc89SDoug Rabson #define bsHugeSectors bsBPB.bpbHugeSectors 113952a6212SJordan K. Hubbard #endif 114