| 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 21 matching lines...) Expand all Loading... |
| 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_Half phnum; /* number of Elf program headers */ | 38 Elf_Half phnum; /* number of Elf program headers */ |
| 39 Elf_Phdr* pheaders; /* copy of the Elf program headers */ | 39 Elf_Phdr* pheaders; /* copy of the Elf program headers */ |
| 40 Elf_Half shnum; /* number of Elf section headers */ | 40 Elf_Half shnum; /* number of Elf section headers */ |
| 41 Elf_Shdr* sheaders; /* copy of the Elf section headers */ | 41 Elf_Shdr* sheaders; /* copy of the Elf section headers */ |
| 42 int ncalign; | |
| 43 nc_loadfile_error_fn error_fn; /* The error printing routine to use. */ | 42 nc_loadfile_error_fn error_fn; /* The error printing routine to use. */ |
| 44 } ncfile; | 43 } ncfile; |
| 45 | 44 |
| 46 /* Loads the given filename into memory. If error_fn is NULL, a default | 45 /* Loads the given filename into memory. If error_fn is NULL, a default |
| 47 * error printing routine will be used. | 46 * error printing routine will be used. |
| 48 */ | 47 */ |
| 49 ncfile *nc_loadfile_depending(const char* filename, | 48 ncfile *nc_loadfile_depending(const char* filename, |
| 50 nc_loadfile_error_fn error_fn); | 49 nc_loadfile_error_fn error_fn); |
| 51 | 50 |
| 52 /* Loads the given filename into memory, applying native client rules. | 51 /* Loads the given filename into memory, applying native client rules. |
| 53 * Uses the default error printing function. | 52 * Uses the default error printing function. |
| 54 */ | 53 */ |
| 55 ncfile *nc_loadfile(const char *filename); | 54 ncfile *nc_loadfile(const char *filename); |
| 56 | 55 |
| 57 /* Loads the given filename into memory, applying native client rules. | 56 /* Loads the given filename into memory, applying native client rules. |
| 58 * Uses the given error printing function to record errors. | 57 * Uses the given error printing function to record errors. |
| 59 */ | 58 */ |
| 60 ncfile *nc_loadfile_with_error_fn(const char *filename, | 59 ncfile *nc_loadfile_with_error_fn(const char *filename, |
| 61 nc_loadfile_error_fn error_fn); | 60 nc_loadfile_error_fn error_fn); |
| 62 | 61 |
| 63 void nc_freefile(ncfile* ncf); | 62 void nc_freefile(ncfile* ncf); |
| 64 | 63 |
| 65 void GetVBaseAndLimit(ncfile* ncf, NaClPcAddress* vbase, NaClPcAddress* vlimit); | 64 void GetVBaseAndLimit(ncfile* ncf, NaClPcAddress* vbase, NaClPcAddress* vlimit); |
| 66 | 65 |
| 67 EXTERN_C_END | 66 EXTERN_C_END |
| 68 | 67 |
| 69 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCFILEUTIL_H_ */ | 68 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCFILEUTIL_H_ */ |
| OLD | NEW |