1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Declares the data structures that will be injected into images transformed
16 : // by hot patching transformations. These data structures contain the necessary
17 : // metadata that is required to perform the hot patching of blocks at runtime.
18 :
19 : #ifndef SYZYGY_BLOCK_GRAPH_HOT_PATCHING_METADATA_H_
20 : #define SYZYGY_BLOCK_GRAPH_HOT_PATCHING_METADATA_H_
21 :
22 : #include <vector>
23 :
24 : #include "base/basictypes.h"
25 :
26 m : namespace block_graph {
27 :
28 : // Ensure there are no padding bytes because these structs are going to be
29 : // written to the .syzyhp stream directly.
30 : #pragma pack(push, 1)
31 :
32 : // This data structure describes a single Block in the HotPatchingMetadata.
33 m : struct HotPatchingBlockMetadata {
34 : // The RVA of the start of the block.
35 m : uint32 relative_address;
36 :
37 : // The size of the block data.
38 m : uint16 data_size;
39 m : };
40 :
41 : // This struct contains the data that will be injected into images transformed
42 : // by hot patching transformations, it contains the necessary metadata that is
43 : // required to perform the hot patching of blocks at runtime.
44 m : struct HotPatchingMetadataHeader {
45 : // Version information.
46 m : uint32 version;
47 :
48 : // Number of HotPatchingBlockMetadata structures to follow.
49 m : uint32 number_of_blocks;
50 m : };
51 :
52 : #pragma pack(pop)
53 :
54 : // The current version of the HotPatchingMetadata structure. This needs to
55 : // be incremented if any time a non-backwards compatible change is made to the
56 : // serialization format.
57 m : const uint32 kHotPatchingMetadataVersion = 1U;
58 :
59 m : } // namespace block_graph
60 :
61 : #endif // SYZYGY_BLOCK_GRAPH_HOT_PATCHING_METADATA_H_
|