1 : /*
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
4 : * found in the LICENSE file.
5 : */
6 :
7 : #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_STACK_SAFETY_H_
8 : #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_STACK_SAFETY_H_
9 :
10 : #include "native_client/src/include/nacl_base.h"
11 : #include "native_client/src/include/portability.h"
12 :
13 : EXTERN_C_BEGIN
14 :
15 : /*
16 : * NB: Relying code should open-code -- not use a function call -- in
17 : * assembly the necessary code to read nacl_thread_on_safe_stack.
18 : */
19 :
20 : #if (NACL_WINDOWS && NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 && \
21 : NACL_BUILD_SUBARCH == 64)
22 :
23 : extern THREAD uint32_t nacl_on_safe_stack;
24 :
25 : static INLINE void NaClStackSafetyNowOnUntrustedStack(void) {
26 : nacl_on_safe_stack = 0;
27 : }
28 :
29 : static INLINE void NaClStackSafetyNowOnTrustedStack(void) {
30 : nacl_on_safe_stack = 1;
31 : }
32 :
33 : #else
34 :
35 : static INLINE void NaClStackSafetyNowOnUntrustedStack(void) {
36 3538690 : }
37 :
38 : static INLINE void NaClStackSafetyNowOnTrustedStack(void) {
39 3538671 : }
40 :
41 : #endif
42 :
43 : EXTERN_C_END
44 :
45 : #endif
|