• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Mesa 3-D graphics library
3  * Version:  7.9
4  *
5  * Copyright (C) 2010 LunarG Inc.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation
10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11  * and/or sell copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  *
25  * Authors:
26  *    Chia-I Wu <olv@lunarg.com>
27  */
28 
29 #include "entry.h"
30 #include "u_current.h"
31 #include "u_macros.h"
32 
33 /* define macros for use by assembly dispatchers */
34 #define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table)
35 
36 /* in bridge mode, mapi is a user of glapi */
37 #ifdef MAPI_MODE_BRIDGE
38 #define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch"
39 #else
40 #define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_internal)
41 #endif
42 
43 #if defined(USE_X86_ASM) && defined(__GNUC__)
44 #   ifdef GLX_USE_TLS
45 #      include "entry_x86_tls.h"
46 #   else
47 #      include "entry_x86_tsd.h"
48 #   endif
49 #elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS)
50 #   include "entry_x86-64_tls.h"
51 #else
52 
53 #include <stdlib.h>
54 
55 static INLINE const struct mapi_table *
entry_current_get(void)56 entry_current_get(void)
57 {
58 #ifdef MAPI_MODE_BRIDGE
59    return GET_DISPATCH();
60 #else
61    return u_current_get();
62 #endif
63 }
64 
65 /* C version of the public entries */
66 #define MAPI_TMP_DEFINES
67 #define MAPI_TMP_PUBLIC_DECLARES
68 #define MAPI_TMP_PUBLIC_ENTRIES
69 #include "mapi_tmp.h"
70 
71 #ifndef MAPI_MODE_BRIDGE
72 
73 void
entry_patch_public(void)74 entry_patch_public(void)
75 {
76 }
77 
78 mapi_func
entry_get_public(int slot)79 entry_get_public(int slot)
80 {
81    /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
82    return public_entries[slot];
83 }
84 
85 mapi_func
entry_generate(int slot)86 entry_generate(int slot)
87 {
88    return NULL;
89 }
90 
91 void
entry_patch(mapi_func entry,int slot)92 entry_patch(mapi_func entry, int slot)
93 {
94 }
95 
96 #endif /* MAPI_MODE_BRIDGE */
97 
98 #endif /* asm */
99