| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * be found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/include/nacl_platform.h" | 7 #include "native_client/src/include/nacl_platform.h" |
| 8 #include "native_client/src/shared/platform/nacl_check.h" | 8 #include "native_client/src/shared/platform/nacl_check.h" |
| 9 #include "native_client/src/trusted/service_runtime/arch/sel_ldr_arch.h" | 9 #include "native_client/src/trusted/service_runtime/arch/sel_ldr_arch.h" |
| 10 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" | 10 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
| 11 #include "native_client/src/trusted/service_runtime/sel_addrspace.h" | 11 #include "native_client/src/trusted/service_runtime/sel_addrspace.h" |
| 12 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 12 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| 13 #include "native_client/src/trusted/service_runtime/sel_memory.h" | 13 #include "native_client/src/trusted/service_runtime/sel_memory.h" |
| 14 | 14 |
| 15 | 15 |
| 16 /* NOTE: This routine is almost identical to the x86_32 version. | 16 /* NOTE: This routine is almost identical to the x86_32 version. |
| 17 */ | 17 */ |
| 18 NaClErrorCode NaClAllocateSpace(void **mem, size_t addrsp_size) { | 18 NaClErrorCode NaClAllocateSpaceAslr(void **mem, size_t addrsp_size, |
| 19 enum NaClAslrMode aslr_mode) { |
| 19 int result; | 20 int result; |
| 20 void *tmp_mem = (void *) NACL_TRAMPOLINE_START; | 21 void *tmp_mem = (void *) NACL_TRAMPOLINE_START; |
| 21 | 22 |
| 23 UNREFERENCED_PARAMETER(aslr_mode); |
| 22 CHECK(NULL != mem); | 24 CHECK(NULL != mem); |
| 23 | 25 |
| 24 /* | 26 /* |
| 25 * On Mips, we also cheat slightly: we add two pages to the requested | 27 * On Mips, we also cheat slightly: we add two pages to the requested |
| 26 * allocation! This accomodates the guard region we require at the | 28 * allocation! This accomodates the guard region we require at the |
| 27 * top end of untrusted memory. | 29 * top end of untrusted memory. |
| 28 */ | 30 */ |
| 29 addrsp_size += NACL_ADDRSPACE_UPPER_GUARD_SIZE; | 31 addrsp_size += NACL_ADDRSPACE_UPPER_GUARD_SIZE; |
| 30 | 32 |
| 31 NaClAddrSpaceBeforeAlloc(addrsp_size); | 33 NaClAddrSpaceBeforeAlloc(addrsp_size); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 (uintptr_t) tmp_mem); | 65 (uintptr_t) tmp_mem); |
| 64 return LOAD_NO_MEMORY; | 66 return LOAD_NO_MEMORY; |
| 65 } | 67 } |
| 66 NaClLog(4, "NaClAllocateSpace: %"NACL_PRIxPTR", %"NACL_PRIxS"\n", | 68 NaClLog(4, "NaClAllocateSpace: %"NACL_PRIxPTR", %"NACL_PRIxS"\n", |
| 67 (uintptr_t) *mem, | 69 (uintptr_t) *mem, |
| 68 addrsp_size); | 70 addrsp_size); |
| 69 | 71 |
| 70 return LOAD_OK; | 72 return LOAD_OK; |
| 71 } | 73 } |
| 72 | 74 |
| OLD | NEW |