sel_ldr: Remove support for rodata segment at start of executable
[nativeclient.git] / service_runtime / nacl_globals.h
blobec0384a8fb1aff951f0e69b1253507c7bbd51e66
1 /*
2 * Copyright 2008, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * NaCl Server Runtime globals.
36 #ifndef SERVICE_RUNTIME_NACL_GLOBALS_H__
37 #define SERVICE_RUNTIME_NACL_GLOBALS_H__ 1
39 /* for LDT_ENTRIES */
40 #include "native_client/include/nacl_platform.h"
42 #include "native_client/service_runtime/nacl_config.h"
43 #include "native_client/service_runtime/nacl_sync.h"
44 #include "native_client/service_runtime/sel_rt.h"
45 #include "native_client/service_runtime/nacl_app_thread.h"
47 extern struct NaClThreadContext *nacl_user[LDT_ENTRIES];
48 extern struct NaClThreadContext *nacl_sys[LDT_ENTRIES];
50 * nacl_user and nacl_sys are accessed w/o holding any locks. once a
51 * thread is live, only that thread itself may read/write the register
52 * context contents (based on its %gs), and this allows a thread to
53 * context switch from the application to the runtime, since we must
54 * have a secure stack before calling any code, including lock
55 * acquisition code.
58 extern struct NaClMutex nacl_thread_mu;
59 extern struct NaClAppThread *nacl_thread[LDT_ENTRIES];
61 * nacl_thread_mu protects access to nacl_thread, which are
62 * dynamically allocated (kernel stacks are too large to keep around
63 * one for each potential thread). once the pointer is accessed and
64 * the object's lock held, nacl_thread_mu may be dropped.
67 void NaClGlobalModuleInit(void);
68 void NaClGlobalModuleFini(void);
70 extern uint16_t nacl_global_cs;
71 extern uint16_t nacl_global_ds;
73 /* hack for gdb */
74 extern uintptr_t nacl_global_xlate_base;
76 struct NaClApp *GetCurProc(void);
77 struct NaClAppThread *GetCurThread(void);
79 extern int NaClSrpcFileDescriptor;
80 #endif