-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapm.hpp
98 lines (89 loc) · 3.28 KB
/
apm.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#pragma once
#include <stdint.h>
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include "fusion_map_serialization.hpp"
struct APMDDMap {
uint32_t ddBlock; /* (driver's block start, sbBlkSize-blocks) */
uint16_t ddSize; /* (driver's block count, 512-blocks) */
uint16_t ddType; /* (driver's system type) */
};
BOOST_FUSION_ADAPT_STRUCT(
APMDDMap,
(uint32_t,ddBlock)
(uint16_t,ddSize)
(uint16_t,ddType))
BOOST_FUSION_ADD_SERIALIZER( APMDDMap )
struct APMBlock0 {
char sbSig[2]; /* (unique value for block zero, 'ER') */
uint16_t sbBlkSize; /* (block size for this device) */
uint32_t sbBlkCount; /* (block count for this device) */
uint16_t sbDevType; /* (device type) */
uint16_t sbDevId; /* (device id) */
uint32_t sbDrvrData; /* (driver data) */
uint16_t sbDrvrCount; /* (driver descriptor count) */
struct APMDDMap sbDrvrMap[8]; /* (driver descriptor table) */
uint8_t sbReserved[430]; /* (reserved for future use) */
};
typedef char APMBlock0SignatureType[2];
typedef struct APMDDMap sbDrvrMapArrayType[8];
typedef uint8_t APMBlock0ReservedType[430];
BOOST_FUSION_ADAPT_STRUCT(
APMBlock0,
(APMBlock0SignatureType,sbSig)
(uint16_t,sbBlkSize)
(uint32_t,sbBlkCount)
(uint16_t,sbDevType)
(uint16_t,sbDevId)
(uint32_t,sbDrvrData)
(uint16_t,sbDrvrCount)
(sbDrvrMapArrayType,sbDrvrMap)
(APMBlock0ReservedType,sbReserved))
BOOST_FUSION_ADD_SERIALIZER( APMBlock0 )
struct APMPartitionEntryStruct {
char signature[2];
uint16_t reserved;
uint32_t numberOfPartitions;
uint32_t startingSectorOfPartition;
uint32_t sizeOfPartiion;
char nameOfPartition[32];
char typeOfPartition[32];
uint32_t statringSectorOfDataArea;
uint32_t sectorsOfDataArea;
uint32_t statusOfPartition;
uint32_t startingSectorOfBootCode;
uint32_t sizeOfBootCode;
uint32_t addressOfBootloaderCode;
uint32_t reserved1;
uint32_t bootCodeEntryPoint;
uint32_t reserved2;
uint32_t bootCodeCheckSum;
char processorType[16];
uint8_t reserved3[376];
};
typedef char tSignature[2];
typedef char tPartitionMapStringType[32];
typedef char tProcessorType[16];
typedef uint8_t APMEntryReservedType[376];
BOOST_FUSION_ADAPT_STRUCT(
APMPartitionEntryStruct,
(tSignature,signature)
(uint16_t,reserved)
(uint32_t,numberOfPartitions)
(uint32_t,startingSectorOfPartition)
(uint32_t,sizeOfPartiion)
(tPartitionMapStringType,nameOfPartition)
(tPartitionMapStringType,typeOfPartition)
(uint32_t,statringSectorOfDataArea)
(uint32_t,sectorsOfDataArea)
(uint32_t,statusOfPartition)
(uint32_t,startingSectorOfBootCode)
(uint32_t,sizeOfBootCode)
(uint32_t,addressOfBootloaderCode)
(uint32_t,reserved1)
(uint32_t,bootCodeEntryPoint)
(uint32_t,reserved2)
(uint32_t,bootCodeCheckSum)
(tProcessorType,processorType)
(APMEntryReservedType,reserved3))
BOOST_FUSION_ADD_SERIALIZER( APMPartitionEntryStruct )