1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_NACL_LOADER_NONSFI_ELF_LOADER_H_ 6 #define COMPONENTS_NACL_LOADER_NONSFI_ELF_LOADER_H_ 7 8 #include "base/basictypes.h" 9 #include "base/memory/scoped_ptr.h" 10 #include "native_client/src/include/portability.h" 11 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" 12 13 #if !defined(OS_LINUX) 14 #error Non SFI mode is currently supported only on linux. 15 #endif 16 17 struct NaClDesc; 18 19 namespace nacl { 20 namespace nonsfi { 21 22 class ElfImage { 23 public: 24 ElfImage(); 25 ~ElfImage(); 26 27 // Available only after Load() is called. 28 uintptr_t entry_point() const; 29 30 // Reads the ELF file from the descriptor and stores the header information 31 // into this instance. 32 NaClErrorCode Read(struct NaClDesc* descriptor); 33 34 // Loads the ELF executable to the memory. 35 NaClErrorCode Load(struct NaClDesc* descriptor); 36 37 private: 38 struct Data; 39 ::scoped_ptr<Data> data_; 40 41 DISALLOW_COPY_AND_ASSIGN(ElfImage); 42 }; 43 44 } // namespace nonsfi 45 } // namespace nacl 46 47 #endif // COMPONENTS_NACL_LOADER_NONSFI_ELF_LOADER_H_ 48