entry.c revision 848b8605
1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 2010 LunarG Inc. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17848b8605Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20848b8605Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21848b8605Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22848b8605Smrg * DEALINGS IN THE SOFTWARE. 23848b8605Smrg * 24848b8605Smrg * Authors: 25848b8605Smrg * Chia-I Wu <olv@lunarg.com> 26848b8605Smrg */ 27848b8605Smrg 28848b8605Smrg#include "entry.h" 29848b8605Smrg#include "u_current.h" 30848b8605Smrg#include "u_macros.h" 31848b8605Smrg 32848b8605Smrg/* define macros for use by assembly dispatchers */ 33848b8605Smrg#define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table) 34848b8605Smrg 35848b8605Smrg/* in bridge mode, mapi is a user of glapi */ 36848b8605Smrg#ifdef MAPI_MODE_BRIDGE 37848b8605Smrg#define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch" 38848b8605Smrg#else 39848b8605Smrg#define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_table_internal) 40848b8605Smrg#endif 41848b8605Smrg 42848b8605Smrg#if defined(USE_X86_ASM) && defined(__GNUC__) && !defined(__NetBSD__) 43848b8605Smrg# ifdef GLX_USE_TLS 44848b8605Smrg# include "entry_x86_tls.h" 45848b8605Smrg# else 46848b8605Smrg# include "entry_x86_tsd.h" 47848b8605Smrg# endif 48848b8605Smrg#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS) 49848b8605Smrg# include "entry_x86-64_tls.h" 50848b8605Smrg#else 51848b8605Smrg 52848b8605Smrg#include <stdlib.h> 53848b8605Smrg 54848b8605Smrgstatic INLINE const struct mapi_table * 55848b8605Smrgentry_current_get(void) 56848b8605Smrg{ 57848b8605Smrg#ifdef MAPI_MODE_BRIDGE 58848b8605Smrg return GET_DISPATCH(); 59848b8605Smrg#else 60848b8605Smrg return u_current_get_table(); 61848b8605Smrg#endif 62848b8605Smrg} 63848b8605Smrg 64848b8605Smrg/* C version of the public entries */ 65848b8605Smrg#define MAPI_TMP_DEFINES 66848b8605Smrg#define MAPI_TMP_PUBLIC_DECLARES 67848b8605Smrg#define MAPI_TMP_PUBLIC_ENTRIES 68848b8605Smrg#include "mapi_tmp.h" 69848b8605Smrg 70848b8605Smrg#ifndef MAPI_MODE_BRIDGE 71848b8605Smrg 72848b8605Smrgvoid 73848b8605Smrgentry_patch_public(void) 74848b8605Smrg{ 75848b8605Smrg} 76848b8605Smrg 77848b8605Smrgmapi_func 78848b8605Smrgentry_get_public(int slot) 79848b8605Smrg{ 80848b8605Smrg /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */ 81848b8605Smrg return public_entries[slot]; 82848b8605Smrg} 83848b8605Smrg 84848b8605Smrgmapi_func 85848b8605Smrgentry_generate(int slot) 86848b8605Smrg{ 87848b8605Smrg return NULL; 88848b8605Smrg} 89848b8605Smrg 90848b8605Smrgvoid 91848b8605Smrgentry_patch(mapi_func entry, int slot) 92848b8605Smrg{ 93848b8605Smrg} 94848b8605Smrg 95848b8605Smrg#endif /* MAPI_MODE_BRIDGE */ 96848b8605Smrg 97848b8605Smrg#endif /* asm */ 98