Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / nacl / loader / nonsfi / elf_loader.h
blobc6f2771bc9fa70758466579973d6604e4a646ab1
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.
5 #ifndef COMPONENTS_NACL_LOADER_NONSFI_ELF_LOADER_H_
6 #define COMPONENTS_NACL_LOADER_NONSFI_ELF_LOADER_H_
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"
13 #if !defined(OS_LINUX)
14 #error Non SFI mode is currently supported only on linux.
15 #endif
17 struct NaClDesc;
19 namespace nacl {
20 namespace nonsfi {
22 class ElfImage {
23 public:
24 ElfImage();
25 ~ElfImage();
27 // Available only after Load() is called.
28 uintptr_t entry_point() const;
30 // Reads the ELF file from the descriptor and stores the header information
31 // into this instance.
32 NaClErrorCode Read(struct NaClDesc* descriptor);
34 // Loads the ELF executable to the memory.
35 NaClErrorCode Load(struct NaClDesc* descriptor);
37 private:
38 struct Data;
39 ::scoped_ptr<Data> data_;
41 DISALLOW_COPY_AND_ASSIGN(ElfImage);
44 } // namespace nonsfi
45 } // namespace nacl
47 #endif // COMPONENTS_NACL_LOADER_NONSFI_ELF_LOADER_H_