1 /* $NetBSD: bootsect.h,v 1.2 2003/10/06 02:21:47 lukem 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 */
24 struct 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_int8_t bsBootSectSig0;
31 u_int8_t bsBootSectSig1;
32 #define BOOTSIG0 0x55
33 #define BOOTSIG1 0xaa
34 };
35
36 struct extboot {
37 int8_t exDriveNumber; /* drive number (0x80) */
38 int8_t exReserved1; /* reserved */
39 int8_t exBootSignature; /* ext. boot signature (0x29) */
40 #define EXBOOTSIG 0x29
41 int8_t exVolumeID[4]; /* volume ID number */
42 int8_t exVolumeLabel[11]; /* volume label */
43 int8_t exFileSysType[8]; /* fs type (FAT12 or FAT16) */
44 };
45
46 struct bootsector50 {
47 u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
48 int8_t bsOemName[8]; /* OEM name and version */
49 int8_t bsBPB[25]; /* BIOS parameter block */
50 int8_t bsExt[26]; /* Bootsector Extension */
51 int8_t bsBootCode[448]; /* pad so structure is 512b */
52 u_int8_t bsBootSectSig0;
53 u_int8_t bsBootSectSig1;
54 #define BOOTSIG0 0x55
55 #define BOOTSIG1 0xaa
56 };
57
58 struct bootsector710 {
59 u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
60 int8_t bsOEMName[8]; /* OEM name and version */
61 int8_t bsBPB[53]; /* BIOS parameter block */
62 int8_t bsExt[26]; /* Bootsector Extension */
63 int8_t bsBootCode[418]; /* pad so structure is 512b */
64 u_int8_t bsBootSectSig2; /* 2 & 3 are only defined for FAT32? */
65 u_int8_t bsBootSectSig3;
66 u_int8_t bsBootSectSig0;
67 u_int8_t bsBootSectSig1;
68 #define BOOTSIG0 0x55
69 #define BOOTSIG1 0xaa
70 #define BOOTSIG2 0
71 #define BOOTSIG3 0
72 };
73 #ifdef atari
74 /*
75 * The boot sector on a gemdos fs is a little bit different from the msdos fs
76 * format. Currently there is no need to declare a separate structure, the
77 * bootsector33 struct will do.
78 */
79 #if 0
80 struct bootsec_atari {
81 u_int8_t bsBranch[2]; /* branch inst if auto-boot */
82 int8_t bsFiller[6]; /* anything or nothing */
83 int8_t bsSerial[3]; /* serial no. for mediachange */
84 int8_t bsBPB[19]; /* BIOS parameter block */
85 int8_t bsBootCode[482]; /* pad so struct is 512b */
86 };
87 #endif
88 #endif /* atari */
89
90 union bootsector {
91 struct bootsector33 bs33;
92 struct bootsector50 bs50;
93 struct bootsector710 bs710;
94 };
95
96 #if 0
97 /*
98 * Shorthand for fields in the bpb.
99 */
100 #define bsBytesPerSec bsBPB.bpbBytesPerSec
101 #define bsSectPerClust bsBPB.bpbSectPerClust
102 #define bsResSectors bsBPB.bpbResSectors
103 #define bsFATS bsBPB.bpbFATS
104 #define bsRootDirEnts bsBPB.bpbRootDirEnts
105 #define bsSectors bsBPB.bpbSectors
106 #define bsMedia bsBPB.bpbMedia
107 #define bsFATsecs bsBPB.bpbFATsecs
108 #define bsSectPerTrack bsBPB.bpbSectPerTrack
109 #define bsHeads bsBPB.bpbHeads
110 #define bsHiddenSecs bsBPB.bpbHiddenSecs
111 #define bsHugeSectors bsBPB.bpbHugeSectors
112 #endif
Cache object: 8c29bec5b5e25920186d31e188c4b42c
|