Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: third_party/courgette/encoded_program.h

Issue 115062: Move Courgette... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/courgette/encode_decode_unittest.cc ('k') | third_party/courgette/encoded_program.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/courgette/encoded_program.h
===================================================================
--- third_party/courgette/encoded_program.h (revision 15668)
+++ third_party/courgette/encoded_program.h (working copy)
@@ -1,84 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COURGETTE_ENCODED_PROGRAM_H_
-#define COURGETTE_ENCODED_PROGRAM_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "third_party/courgette/image_info.h"
-
-namespace courgette {
-
-class SinkStream;
-class SinkStreamSet;
-class SourceStreamSet;
-
-// An EncodedProgram is a set of tables that contain a simple 'binary assembly
-// language' that can be assembled to produce a sequence of bytes, for example,
-// a Windows 32-bit executable.
-//
-class EncodedProgram {
- public:
- EncodedProgram();
- ~EncodedProgram();
-
- // Generating an EncodedProgram:
- //
- // (1) The image base can be specified at any time.
- void set_image_base(uint64 base) { image_base_ = base; }
-
- // (2) Address tables and indexes defined first.
- void DefineRel32Label(int index, RVA address);
- void DefineAbs32Label(int index, RVA address);
- void EndLabels();
-
- // (3) Add instructions in the order needed to generate bytes of file.
- void AddOrigin(RVA rva);
- void AddCopy(int count, const void* bytes);
- void AddRel32(int label_index);
- void AddAbs32(int label_index);
- void AddMakeRelocs();
-
- // (3) Serialize binary assembly language tables to a set of streams.
- void WriteTo(SinkStreamSet *streams);
-
- // Using an EncodedProgram to generate a byte stream:
- //
- // (4) Deserializes a fresh EncodedProgram from a set of streams.
- bool ReadFrom(SourceStreamSet *streams);
-
- // (5) Assembles the 'binary assembly language' into final file.
- bool AssembleTo(SinkStream *buffer);
-
- private:
- enum OP; // Binary assembly language operations.
-
- void DebuggingSummary();
- void GenerateBaseRelocations(SinkStream *buffer);
- void DefineLabelCommon(std::vector<RVA>*, int, RVA);
- void FinishLabelsCommon(std::vector<RVA>* addresses);
-
- // Binary assembly language tables.
- uint64 image_base_;
- std::vector<RVA> rel32_rva_;
- std::vector<RVA> abs32_rva_;
- std::vector<OP> ops_;
- std::vector<RVA> origins_;
- std::vector<int> copy_counts_;
- std::vector<uint8> copy_bytes_;
- std::vector<uint32> rel32_ix_;
- std::vector<uint32> abs32_ix_;
-
- // Table of the addresses containing abs32 relocations; computed during
- // assembly, used to generate base relocation table.
- std::vector<uint32> abs32_relocs_;
-
- DISALLOW_COPY_AND_ASSIGN(EncodedProgram);
-};
-
-} // namespace courgette
-#endif // COURGETTE_ENCODED_FORMAT_H_
-
« no previous file with comments | « third_party/courgette/encode_decode_unittest.cc ('k') | third_party/courgette/encoded_program.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698