2 * Copyright 2010 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
9 #if !NACL_WINDOWS /* stdint is neither available nor needed on Windows */
13 #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h"
14 #include "native_client/src/include/nacl_macros.h"
16 /* Assembled equivalent of "ret" */
19 int NaClCheckDEP(void) {
21 * We require DEP, so forward this call to the OS-specific check routine.
23 return NaClAttemptToExecuteData();
26 nacl_void_thunk NaClGenerateThunk(char *buf, size_t size_in_bytes) {
28 * Place a "ret" at buf.
30 if (size_in_bytes < 1) return 0;
32 *buf = (char) INST_RET;
35 * ISO C prevents a direct data->function cast, because the pointers aren't
36 * guaranteed to be the same size. For our platforms this is fine, but we
37 * verify at compile time anyway before tricking the compiler:
39 NACL_ASSERT_SAME_SIZE(char *, nacl_void_thunk);
40 return (nacl_void_thunk) (uintptr_t) buf;