LCOV - code coverage report
Current view: directory - src/trusted/service_runtime - nacl_globals.h (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 3 3 100.0 %
Date: 2014-06-18 Functions: 0 0 -

       1                 : /*
       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
       4                 :  * found in the LICENSE file.
       5                 :  */
       6                 : 
       7                 : /*
       8                 :  * NaCl Server Runtime globals.
       9                 :  */
      10                 : 
      11                 : #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_GLOBALS_H__
      12                 : #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_GLOBALS_H__
      13                 : 
      14                 : #include "native_client/src/include/portability.h"
      15                 : #include "native_client/src/shared/platform/nacl_check.h"
      16                 : #include "native_client/src/trusted/service_runtime/arch/sel_ldr_arch.h"
      17                 : #include "native_client/src/trusted/service_runtime/nacl_app_thread.h"
      18                 : 
      19                 : EXTERN_C_BEGIN
      20                 : struct NaClThreadContext;
      21                 : struct NaClAppThread;
      22                 : struct NaClMutex;
      23                 : struct NaClApp;
      24                 : 
      25                 : #if NACL_WINDOWS
      26                 : __declspec(dllexport)
      27                 : /*
      28                 :  * This array is exported so that it can be used by a debugger.  However, it is
      29                 :  * not a stable interface and it may change or be removed in the future.  A
      30                 :  * debugger using this interface could break.
      31                 :  */
      32                 : #endif
      33                 : extern struct NaClThreadContext *nacl_user[NACL_THREAD_MAX];
      34                 : #if NACL_WINDOWS
      35                 : /*
      36                 :  * NaCl Idx -> Thread ID mapping. Gdb scans this array to find NaCl index
      37                 :  * by Thread ID.
      38                 :  *
      39                 :  * This is not a stable interface and it may change or be removed in
      40                 :  * the future.  A debugger using this interface could break.
      41                 :  */
      42                 : __declspec(dllexport) extern uint32_t nacl_thread_ids[NACL_THREAD_MAX];
      43                 : #endif
      44                 : /*
      45                 :  * nacl_user is accessed without holding any locks.  once a thread is
      46                 :  * live, only that thread itself may read/write the register context
      47                 :  * contents (based on its %gs), and this allows a thread to context
      48                 :  * switch from the application to the runtime, since we must have a
      49                 :  * secure stack before calling any code, including lock acquisition
      50                 :  * code.
      51                 :  */
      52                 : 
      53                 : void  NaClGlobalModuleInit(void);
      54                 : void  NaClGlobalModuleFini(void);
      55                 : 
      56                 : /* this is defined in src/trusted/service_runtime/arch/<arch>/ sel_rt.h */
      57                 : void NaClInitGlobals(void);
      58                 : 
      59                 : static INLINE struct NaClAppThread *NaClAppThreadGetFromIndex(
      60           30032 :     uint32_t thread_index) {
      61          120128 :   DCHECK(thread_index < NACL_THREAD_MAX);
      62           30032 :   return NaClAppThreadFromThreadContext(nacl_user[thread_index]);
      63                 : }
      64                 : 
      65                 : /* hack for gdb */
      66                 : #if NACL_WINDOWS
      67                 : __declspec(dllexport)
      68                 : #endif
      69                 : extern uintptr_t nacl_global_xlate_base;
      70                 : 
      71                 : EXTERN_C_END
      72                 : 
      73                 : #endif  /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_GLOBALS_H__ */

Generated by: LCOV version 1.7