1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2010 LunarG Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 * Chia-I Wu <[email protected]>
26 */
27
28 #include <stdlib.h>
29 #include <stdint.h>
30
31 #include "entry.h"
32 #include "u_current.h"
33 #include "util/u_endian.h"
34 #include "util/u_thread.h"
35
36 #define _U_STRINGIFY(x) #x
37 #define U_STRINGIFY(x) _U_STRINGIFY(x)
38
39 /* REALLY_INITIAL_EXEC implies __GLIBC__ */
40 #if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
41 #include "entry_x86_tls.h"
42 #elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
43 #include "entry_x86-64_tls.h"
44 #elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
45 #include "entry_ppc64le_tls.h"
46 #else
47
48 static inline const struct _glapi_table *
entry_current_get(void)49 entry_current_get(void)
50 {
51 return GET_DISPATCH();
52 }
53
54 /* C version of the public entries */
55 #define MAPI_TMP_DEFINES
56 #define MAPI_TMP_PUBLIC_DECLARES
57 #define MAPI_TMP_PUBLIC_ENTRIES
58 #include "mapi_tmp.h"
59
60 #ifndef MAPI_MODE_BRIDGE
61
62 void
entry_patch_public(void)63 entry_patch_public(void)
64 {
65 }
66
67 mapi_func
entry_get_public(int slot)68 entry_get_public(int slot)
69 {
70 /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
71 return public_entries[slot];
72 }
73
74 #endif /* MAPI_MODE_BRIDGE */
75
76 #if defined(_WIN32) && defined(_WINDOWS_)
77 #error "Should not include <windows.h> here"
78 #endif
79
80 #endif /* asm */
81