blob: 23e25af149a6a4ab3c9399bc80291a5da814f13e [file] [log] [blame]
Elliott Hughes2faa5f12012-01-30 14:42:07 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian Carlstrome24fa612011-09-29 00:53:55 -070016
17#ifndef ART_SRC_OAT_H_
18#define ART_SRC_OAT_H_
19
20#include <vector>
21
22#include "dex_file.h"
23#include "macros.h"
24
25namespace art {
26
27class PACKED OatHeader {
28 public:
29 OatHeader() {}
30 OatHeader(const std::vector<const DexFile*>* dex_files);
31
32 bool IsValid() const;
33 const char* GetMagic() const;
34 uint32_t GetChecksum() const;
35 void UpdateChecksum(const void* data, size_t length);
36 uint32_t GetDexFileCount() const;
37 uint32_t GetExecutableOffset() const;
38 void SetExecutableOffset(uint32_t executable_offset);
39
40 private:
41 static const uint8_t kOatMagic[4];
42 static const uint8_t kOatVersion[4];
43
44 uint8_t magic_[4];
45 uint8_t version_[4];
46 uint32_t adler32_checksum_;
47 uint32_t dex_file_count_;
48 uint32_t executable_offset_;
49
50 DISALLOW_COPY_AND_ASSIGN(OatHeader);
51};
52
Brian Carlstrom3320cf42011-10-04 14:58:28 -070053class PACKED OatMethodOffsets {
54 public:
55 OatMethodOffsets();
56 OatMethodOffsets(uint32_t code_offset,
57 uint32_t frame_size_in_bytes,
Brian Carlstrom3320cf42011-10-04 14:58:28 -070058 uint32_t core_spill_mask,
59 uint32_t fp_spill_mask,
60 uint32_t mapping_table_offset,
61 uint32_t vmap_table_offset,
Brian Carlstrome7d856b2012-01-11 18:10:55 -080062 uint32_t gc_map_offset,
Brian Carlstrom3320cf42011-10-04 14:58:28 -070063 uint32_t invoke_stub_offset);
64 ~OatMethodOffsets();
65
66 uint32_t code_offset_;
67 uint32_t frame_size_in_bytes_;
Brian Carlstrom3320cf42011-10-04 14:58:28 -070068 uint32_t core_spill_mask_;
69 uint32_t fp_spill_mask_;
70 uint32_t mapping_table_offset_;
71 uint32_t vmap_table_offset_;
Brian Carlstrome7d856b2012-01-11 18:10:55 -080072 uint32_t gc_map_offset_;
Brian Carlstrom3320cf42011-10-04 14:58:28 -070073 uint32_t invoke_stub_offset_;
74};
75
Brian Carlstrome24fa612011-09-29 00:53:55 -070076} // namespace art
77
78#endif // ART_SRC_OAT_H_