blob: ff50599a3632e8e7ff96b96d2761372bac3de44b [file] [log] [blame]
Brian Carlstrome24fa612011-09-29 00:53:55 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#ifndef ART_SRC_OAT_H_
4#define ART_SRC_OAT_H_
5
6#include <vector>
7
8#include "dex_file.h"
9#include "macros.h"
10
11namespace art {
12
13class PACKED OatHeader {
14 public:
15 OatHeader() {}
16 OatHeader(const std::vector<const DexFile*>* dex_files);
17
18 bool IsValid() const;
19 const char* GetMagic() const;
20 uint32_t GetChecksum() const;
21 void UpdateChecksum(const void* data, size_t length);
22 uint32_t GetDexFileCount() const;
23 uint32_t GetExecutableOffset() const;
24 void SetExecutableOffset(uint32_t executable_offset);
25
26 private:
27 static const uint8_t kOatMagic[4];
28 static const uint8_t kOatVersion[4];
29
30 uint8_t magic_[4];
31 uint8_t version_[4];
32 uint32_t adler32_checksum_;
33 uint32_t dex_file_count_;
34 uint32_t executable_offset_;
35
36 DISALLOW_COPY_AND_ASSIGN(OatHeader);
37};
38
Brian Carlstrom3320cf42011-10-04 14:58:28 -070039class PACKED OatMethodOffsets {
40 public:
41 OatMethodOffsets();
42 OatMethodOffsets(uint32_t code_offset,
43 uint32_t frame_size_in_bytes,
44 uint32_t return_pc_offset_in_bytes,
45 uint32_t core_spill_mask,
46 uint32_t fp_spill_mask,
47 uint32_t mapping_table_offset,
48 uint32_t vmap_table_offset,
49 uint32_t invoke_stub_offset);
50 ~OatMethodOffsets();
51
52 uint32_t code_offset_;
53 uint32_t frame_size_in_bytes_;
54 uint32_t return_pc_offset_in_bytes_;
55 uint32_t core_spill_mask_;
56 uint32_t fp_spill_mask_;
57 uint32_t mapping_table_offset_;
58 uint32_t vmap_table_offset_;
59 uint32_t invoke_stub_offset_;
60};
61
Brian Carlstrome24fa612011-09-29 00:53:55 -070062} // namespace art
63
64#endif // ART_SRC_OAT_H_