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