OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * ncfileutil.h - open an executable file. FOR TESTING ONLY. | 8 * ncfileutil.h - open an executable file. FOR TESTING ONLY. |
9 */ | 9 */ |
10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCFILEUTIL_H_ | 10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCFILEUTIL_H_ |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 /* Function signature for error printing. */ | 29 /* Function signature for error printing. */ |
30 typedef void (*nc_loadfile_error_fn)(const char* format, | 30 typedef void (*nc_loadfile_error_fn)(const char* format, |
31 ...) ATTRIBUTE_FORMAT_PRINTF(1, 2); | 31 ...) ATTRIBUTE_FORMAT_PRINTF(1, 2); |
32 | 32 |
33 typedef struct { | 33 typedef struct { |
34 const char* fname; /* name of loaded file */ | 34 const char* fname; /* name of loaded file */ |
35 NaClPcAddress vbase; /* base address in virtual memory */ | 35 NaClPcAddress vbase; /* base address in virtual memory */ |
36 NaClMemorySize size; /* size of program memory */ | 36 NaClMemorySize size; /* size of program memory */ |
37 uint8_t* data; /* the actual loaded bytes */ | 37 uint8_t* data; /* the actual loaded bytes */ |
| 38 Elf_Ehdr* eheader; /* copy of the Elf header */ |
38 Elf_Half phnum; /* number of Elf program headers */ | 39 Elf_Half phnum; /* number of Elf program headers */ |
39 Elf_Phdr* pheaders; /* copy of the Elf program headers */ | 40 Elf_Phdr* pheaders; /* copy of the Elf program headers */ |
40 Elf_Half shnum; /* number of Elf section headers */ | 41 Elf_Half shnum; /* number of Elf section headers */ |
41 Elf_Shdr* sheaders; /* copy of the Elf section headers */ | 42 Elf_Shdr* sheaders; /* copy of the Elf section headers */ |
42 int ncalign; | 43 int ncalign; |
43 nc_loadfile_error_fn error_fn; /* The error printing routine to use. */ | 44 nc_loadfile_error_fn error_fn; /* The error printing routine to use. */ |
44 } ncfile; | 45 } ncfile; |
45 | 46 |
46 /* Loads the given filename into memory. If error_fn is NULL, a default | 47 /* Loads the given filename into memory. If error_fn is NULL, a default |
47 * error printing routine will be used. | 48 * error printing routine will be used. |
(...skipping 12 matching lines...) Expand all Loading... |
60 ncfile *nc_loadfile_with_error_fn(const char *filename, | 61 ncfile *nc_loadfile_with_error_fn(const char *filename, |
61 nc_loadfile_error_fn error_fn); | 62 nc_loadfile_error_fn error_fn); |
62 | 63 |
63 void nc_freefile(ncfile* ncf); | 64 void nc_freefile(ncfile* ncf); |
64 | 65 |
65 void GetVBaseAndLimit(ncfile* ncf, NaClPcAddress* vbase, NaClPcAddress* vlimit); | 66 void GetVBaseAndLimit(ncfile* ncf, NaClPcAddress* vbase, NaClPcAddress* vlimit); |
66 | 67 |
67 EXTERN_C_END | 68 EXTERN_C_END |
68 | 69 |
69 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCFILEUTIL_H_ */ | 70 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCFILEUTIL_H_ */ |
OLD | NEW |