Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame^] | 1 | /* |
| 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 Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 16 | |
| 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 | |
| 25 | namespace art { |
| 26 | |
| 27 | class 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 Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 53 | class PACKED OatMethodOffsets { |
| 54 | public: |
| 55 | OatMethodOffsets(); |
| 56 | OatMethodOffsets(uint32_t code_offset, |
| 57 | uint32_t frame_size_in_bytes, |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 58 | uint32_t core_spill_mask, |
| 59 | uint32_t fp_spill_mask, |
| 60 | uint32_t mapping_table_offset, |
| 61 | uint32_t vmap_table_offset, |
Brian Carlstrom | e7d856b | 2012-01-11 18:10:55 -0800 | [diff] [blame] | 62 | uint32_t gc_map_offset, |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 63 | uint32_t invoke_stub_offset); |
| 64 | ~OatMethodOffsets(); |
| 65 | |
| 66 | uint32_t code_offset_; |
| 67 | uint32_t frame_size_in_bytes_; |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 68 | uint32_t core_spill_mask_; |
| 69 | uint32_t fp_spill_mask_; |
| 70 | uint32_t mapping_table_offset_; |
| 71 | uint32_t vmap_table_offset_; |
Brian Carlstrom | e7d856b | 2012-01-11 18:10:55 -0800 | [diff] [blame] | 72 | uint32_t gc_map_offset_; |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 73 | uint32_t invoke_stub_offset_; |
| 74 | }; |
| 75 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 76 | } // namespace art |
| 77 | |
| 78 | #endif // ART_SRC_OAT_H_ |