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

Side by Side Diff: src/trusted/platform_qualify/arch/mips/nacl_dep_qualify_arch.c

Issue 18861003: [MIPS] Remove NaClCheckDEP for MIPS (Closed) Base URL: http://git.chromium.org/native_client/src/native_client.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | src/trusted/platform_qualify/build.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file.
5 */
6
7 #include <stddef.h>
8 #include <stdint.h>
9 #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h"
10 #include "native_client/src/include/nacl_macros.h"
11
12 /* Assembled equivalent of "jr ra" */
13 #define INST_JR_RA 0x3E00008
14 #define INST_NOP 0x0000000
15
16 int NaClCheckDEP(void) {
17 /*
18 * We require DEP, so forward this call to the OS-specific check routine.
19 */
20 return NaClAttemptToExecuteData();
21 }
22
23 nacl_void_thunk NaClGenerateThunk(char *buf, size_t size_in_bytes) {
24 /*
25 * Place a "jr ra" at the next aligned address after buf. Instructions
26 * are always little-endian, regardless of data setting. We also place opcode
27 * for "nop" (which is zero) because of delay slot in Mips.
28 */
29 uint32_t *aligned_buf = (uint32_t *) (((uintptr_t) buf + 3) & ~3);
30
31 if ((char*) aligned_buf + 8 > buf + size_in_bytes) return 0;
32
33 aligned_buf[0] = (uint32_t) INST_JR_RA;
34 aligned_buf[1] = (uint32_t) INST_NOP;
35
36 /*
37 * ISO C prevents a direct data->function cast, because the pointers aren't
38 * guaranteed to be the same size. For our platforms this is fine, but we
39 * verify at compile time anyway before tricking the compiler:
40 */
41 NACL_ASSERT_SAME_SIZE(char *, nacl_void_thunk);
42 return (nacl_void_thunk) (uintptr_t) aligned_buf;
43 }
OLDNEW
« no previous file with comments | « no previous file | src/trusted/platform_qualify/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698