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

Side by Side Diff: components/nacl/loader/nonsfi/elf_util.h

Issue 100373005: Initial implementation of Bare Metal Mode for NaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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_UTIL_H_
6 #define COMPONENTS_NACL_LOADER_NONSFI_ELF_UTIL_H_
7
8 #include "base/basictypes.h"
9 #include "components/nacl/loader/nonsfi/nonsfi_error_code.h"
10 #include "native_client/src/include/elf32.h"
11 #include "native_client/src/include/portability.h"
12
13 #if !defined(OS_LINUX) || NACL_BUILD_SUBARCH != 32
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 // Limit of elf program headers allowed.
25 enum {
26 MAX_PROGRAM_HEADERS = 128
27 };
28
29 ElfImage();
30 ~ElfImage();
31
32 // Available only after Load() is called.
33 uintptr_t entry_point() const {
34 return ehdr_.e_entry + load_bias_;
35 }
36
37 // Reads the ELF file from the descriptor and stores the header information
38 // into this instance.
39 NonSfiErrorCode Read(struct NaClDesc* descriptor);
40
41 // Loads the ELF executable to the memory.
42 NonSfiErrorCode Load(struct NaClDesc* descriptor);
43
44 private:
45 Elf32_Ehdr ehdr_;
46 Elf32_Phdr phdrs_[MAX_PROGRAM_HEADERS];
47 Elf32_Addr load_bias_;
48
49 DISALLOW_COPY_AND_ASSIGN(ElfImage);
50 };
51
52 } // namespace nonsfi
53 } // namespace nacl
54
55 #endif // COMPONENTS_NACL_LOADER_NONSFI_ELF_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698