Home | History | Annotate | Download | only in mapi
      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 <olv (at) lunarg.com>
     26  */
     27 
     28 #include "entry.h"
     29 #include "u_current.h"
     30 
     31 #define _U_STRINGIFY(x) #x
     32 #define U_STRINGIFY(x) _U_STRINGIFY(x)
     33 
     34 /* define macros for use by assembly dispatchers */
     35 #define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table)
     36 
     37 /* in bridge mode, mapi is a user of glapi */
     38 #ifdef MAPI_MODE_BRIDGE
     39 #define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch"
     40 #else
     41 #define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_table_internal)
     42 #endif
     43 
     44 #if defined(USE_X86_ASM) && defined(__GNUC__)
     45 #   ifdef GLX_USE_TLS
     46 #      include "entry_x86_tls.h"
     47 #   else
     48 #      include "entry_x86_tsd.h"
     49 #   endif
     50 #elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS)
     51 #   include "entry_x86-64_tls.h"
     52 #else
     53 
     54 #include <stdlib.h>
     55 
     56 static inline const struct mapi_table *
     57 entry_current_get(void)
     58 {
     59 #ifdef MAPI_MODE_BRIDGE
     60    return GET_DISPATCH();
     61 #else
     62    return u_current_get_table();
     63 #endif
     64 }
     65 
     66 /* C version of the public entries */
     67 #define MAPI_TMP_DEFINES
     68 #define MAPI_TMP_PUBLIC_DECLARES
     69 #define MAPI_TMP_PUBLIC_ENTRIES
     70 #include "mapi_tmp.h"
     71 
     72 #ifndef MAPI_MODE_BRIDGE
     73 
     74 void
     75 entry_patch_public(void)
     76 {
     77 }
     78 
     79 mapi_func
     80 entry_get_public(int slot)
     81 {
     82    /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
     83    return public_entries[slot];
     84 }
     85 
     86 mapi_func
     87 entry_generate(int slot)
     88 {
     89    return NULL;
     90 }
     91 
     92 void
     93 entry_patch(mapi_func entry, int slot)
     94 {
     95 }
     96 
     97 #endif /* MAPI_MODE_BRIDGE */
     98 
     99 #endif /* asm */
    100