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

Side by Side Diff: src/trusted/service_runtime/sel_ldr-inl.h

Issue 10919162: [MIPS] Implementation of sel_ldr for MIPS architecture. (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 3 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 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 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 * 8 *
9 * DO NOT INCLUDE EXCEPT FROM sel_ldr.h 9 * DO NOT INCLUDE EXCEPT FROM sel_ldr.h
10 * 10 *
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 * the next two are for syscalls to do address translation, e.g., for 42 * the next two are for syscalls to do address translation, e.g., for
43 * system calls; -1 indicates an error, so the syscall can return 43 * system calls; -1 indicates an error, so the syscall can return
44 * EINVAL or EFAULT or whatever is appropriate. 44 * EINVAL or EFAULT or whatever is appropriate.
45 * 45 *
46 * the latter two interfaces are for use everywhere else in the loader 46 * the latter two interfaces are for use everywhere else in the loader
47 * / service runtime and will log a fatal error and abort the process 47 * / service runtime and will log a fatal error and abort the process
48 * when an error is detected. (0 is not a good error indicator, since 48 * when an error is detected. (0 is not a good error indicator, since
49 * 0 is a valid user address.) 49 * 0 is a valid user address.)
50 */ 50 */
51 51
52 #include "native_client/src/trusted/service_runtime/arch/sel_ldr_arch.h"
53
52 static INLINE uintptr_t NaClUserToSysAddrNullOkay(struct NaClApp *nap, 54 static INLINE uintptr_t NaClUserToSysAddrNullOkay(struct NaClApp *nap,
53 uintptr_t uaddr) { 55 uintptr_t uaddr) {
54 if (((uintptr_t) 1U << nap->addr_bits <= uaddr)) { 56 if (((uintptr_t) 1U << nap->addr_bits <= uaddr)) {
55 return kNaClBadAddress; 57 return kNaClBadAddress;
56 } 58 }
57 return uaddr + nap->mem_start; 59 return uaddr + nap->mem_start;
58 } 60 }
59 61
60 static INLINE uintptr_t NaClUserToSysAddr(struct NaClApp *nap, 62 static INLINE uintptr_t NaClUserToSysAddr(struct NaClApp *nap,
61 uintptr_t uaddr) { 63 uintptr_t uaddr) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 # else 183 # else
182 # error "What kind of x86 are we on anyway?!?" 184 # error "What kind of x86 are we on anyway?!?"
183 # endif 185 # endif
184 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm 186 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm
185 UNREFERENCED_PARAMETER(nap); 187 UNREFERENCED_PARAMETER(nap);
186 addr &= ~NACL_CONTROL_FLOW_MASK; 188 addr &= ~NACL_CONTROL_FLOW_MASK;
187 # if defined(NACL_TARGET_ARM_THUMB2_MODE) 189 # if defined(NACL_TARGET_ARM_THUMB2_MODE)
188 addr |= 0xf; 190 addr |= 0xf;
189 # endif /* defined(NACL_TARGET_ARM_THUMB2_MODE) */ 191 # endif /* defined(NACL_TARGET_ARM_THUMB2_MODE) */
190 return addr; 192 return addr;
193 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips
194 UNREFERENCED_PARAMETER(nap);
195 addr &= NACL_CONTROL_FLOW_MASK;
196 return addr;
Mark Seaborn 2012/09/08 02:43:14 Nit: combine this and just do "return addr & NACL_
petarj 2012/09/11 16:58:13 Done.
191 #else 197 #else
192 # error "What architecture are we on?!?" 198 # error "What architecture are we on?!?"
193 #endif 199 #endif
194 } 200 }
195 201
196 static INLINE int NaClIsValidJumpTarget(struct NaClApp *nap, 202 static INLINE int NaClIsValidJumpTarget(struct NaClApp *nap,
197 uintptr_t addr) { 203 uintptr_t addr) {
198 if (0 != (addr & (((uintptr_t) nap->bundle_size) - 1))) { 204 if (0 != (addr & (((uintptr_t) nap->bundle_size) - 1))) {
199 return 0; 205 return 0;
200 } 206 }
201 return addr < nap->dynamic_text_end; 207 return addr < nap->dynamic_text_end;
202 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698