OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "courgette/encoded_program.h" | 5 #include "courgette/encoded_program.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 693 |
694 // RelocBlock has the layout of a block of relocations in the base relocation | 694 // RelocBlock has the layout of a block of relocations in the base relocation |
695 // table file format. | 695 // table file format. |
696 // | 696 // |
697 struct RelocBlockPOD { | 697 struct RelocBlockPOD { |
698 uint32 page_rva; | 698 uint32 page_rva; |
699 uint32 block_size; | 699 uint32 block_size; |
700 uint16 relocs[4096]; // Allow up to one relocation per byte of a 4k page. | 700 uint16 relocs[4096]; // Allow up to one relocation per byte of a 4k page. |
701 }; | 701 }; |
702 | 702 |
703 COMPILE_ASSERT(offsetof(RelocBlockPOD, relocs) == 8, reloc_block_header_size); | 703 static_assert(offsetof(RelocBlockPOD, relocs) == 8, "reloc block header size"); |
704 | 704 |
705 class RelocBlock { | 705 class RelocBlock { |
706 public: | 706 public: |
707 RelocBlock() { | 707 RelocBlock() { |
708 pod.page_rva = 0xFFFFFFFF; | 708 pod.page_rva = 0xFFFFFFFF; |
709 pod.block_size = 8; | 709 pod.block_size = 8; |
710 } | 710 } |
711 | 711 |
712 void Add(uint16 item) { | 712 void Add(uint16 item) { |
713 pod.relocs[(pod.block_size-8)/2] = item; | 713 pod.relocs[(pod.block_size-8)/2] = item; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 if (assembled) | 788 if (assembled) |
789 return C_OK; | 789 return C_OK; |
790 return C_ASSEMBLY_FAILED; | 790 return C_ASSEMBLY_FAILED; |
791 } | 791 } |
792 | 792 |
793 void DeleteEncodedProgram(EncodedProgram* encoded) { | 793 void DeleteEncodedProgram(EncodedProgram* encoded) { |
794 delete encoded; | 794 delete encoded; |
795 } | 795 } |
796 | 796 |
797 } // namespace courgette | 797 } // namespace courgette |
OLD | NEW |