~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/mapi/entry.c

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 <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
 
/* define macros for use by assembly dispatchers */
40
 
#define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table)
41
 
 
42
 
/* in bridge mode, mapi is a user of glapi */
43
 
#ifdef MAPI_MODE_BRIDGE
44
 
#define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch"
45
 
#else
46
 
#define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_table_internal)
47
 
#endif
48
 
 
49
 
/* REALLY_INITIAL_EXEC implies USE_ELF_TLS and __GNUC__ */
50
 
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
51
 
#include "entry_x86_tls.h"
52
 
#elif defined(USE_X86_ASM) && !defined(GLX_X86_READONLY_TEXT) && defined(__GNUC__)
53
 
#include "entry_x86_tsd.h"
54
 
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
55
 
#include "entry_x86-64_tls.h"
56
 
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
57
 
#include "entry_ppc64le_tls.h"
58
 
/* ppc64le non-IE TSD stubs are possible but not currently implemented */
59
 
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && !defined(USE_ELF_TLS) && defined(__GNUC__)
60
 
#include "entry_ppc64le_tsd.h"
61
 
#else
62
 
 
63
 
static inline const struct _glapi_table *
64
 
entry_current_get(void)
65
 
{
66
 
#ifdef MAPI_MODE_BRIDGE
67
 
   return GET_DISPATCH();
68
 
#else
69
 
   return u_current_get_table_internal();
70
 
#endif
71
 
}
72
 
 
73
 
/* C version of the public entries */
74
 
#define MAPI_TMP_DEFINES
75
 
#define MAPI_TMP_PUBLIC_DECLARES
76
 
#define MAPI_TMP_PUBLIC_ENTRIES
77
 
#include "mapi_tmp.h"
78
 
 
79
 
#ifndef MAPI_MODE_BRIDGE
80
 
 
81
 
void
82
 
entry_patch_public(void)
83
 
{
84
 
}
85
 
 
86
 
mapi_func
87
 
entry_get_public(int slot)
88
 
{
89
 
   /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
90
 
   return public_entries[slot];
91
 
}
92
 
 
93
 
mapi_func
94
 
entry_generate(int slot)
95
 
{
96
 
   return NULL;
97
 
}
98
 
 
99
 
void
100
 
entry_patch(mapi_func entry, int slot)
101
 
{
102
 
}
103
 
 
104
 
#endif /* MAPI_MODE_BRIDGE */
105
 
 
106
 
#endif /* asm */