diff options
-rw-r--r-- | include/glvnd/GLdispatchABI.h | 47 | ||||
-rw-r--r-- | src/GLdispatch/GLdispatchPrivate.h | 19 | ||||
-rw-r--r-- | src/GLdispatch/vnd-glapi/mapi/entry.h | 10 | ||||
-rw-r--r-- | src/GLdispatch/vnd-glapi/mapi/entry_armv7_tsd.c | 3 | ||||
-rw-r--r-- | src/GLdispatch/vnd-glapi/mapi/entry_pure_c.c | 3 | ||||
-rw-r--r-- | src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tls.c | 3 | ||||
-rw-r--r-- | src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tsd.c | 3 | ||||
-rw-r--r-- | src/GLdispatch/vnd-glapi/mapi/entry_x86_tsd.c | 3 | ||||
-rw-r--r-- | tests/GLX_dummy/GLX_dummy.c | 28 |
9 files changed, 59 insertions, 60 deletions
diff --git a/include/glvnd/GLdispatchABI.h b/include/glvnd/GLdispatchABI.h index d0fea5e..989743c 100644 --- a/include/glvnd/GLdispatchABI.h +++ b/include/glvnd/GLdispatchABI.h @@ -44,18 +44,45 @@ extern "C" { * these client ABIs. */ -/* - * Thread-local implementation used by libglvnd. This is passed into - * the patch function callback via the type parameter. +/*! + * Thread-local implementation used by libglvnd. This is passed into the patch + * function callback via the type parameter. + * + * For most architectures, the vendor library can ignore this parameter, since + * it will always be the same value. It's used for systems like ARM, where the + * stubs might be use the ARM or Thumb instruction sets. + * + * The stub type does not make any distinction between TLS and TSD stubs. The + * entire purpose of entrypoint rewriting is to skip the dispatch table in + * libGLdispatch.so, so it doesn't matter how that dispatch table is stored. */ enum { - __GLDISPATCH_STUB_X86_TLS, - __GLDISPATCH_STUB_X86_64_TLS, - __GLDISPATCH_STUB_X86_TSD, - __GLDISPATCH_STUB_PURE_C, - __GLDISPATCH_STUB_X86_64_TSD, - __GLDISPATCH_STUB_ARMV7_THUMB_TSD, - __GLDISPATCH_STUB_NUM_TYPES + /*! + * Indicates that the stubs aren't defined in assembly. For example, if the + * dispatch stubs are written in C. Vendor libraries generally won't see + * this value. + */ + __GLDISPATCH_STUB_UNKNOWN, + + /*! + * Used for stubs on x86 systems. + */ + __GLDISPATCH_STUB_X86, + + /*! + * Used for stubs on x86-64 systems. + */ + __GLDISPATCH_STUB_X86_64, + + /*! + * Used for stubs on ARMv7, using the Thumb instruction set. + */ + __GLDISPATCH_STUB_ARMV7_THUMB, + + /*! + * Used for stubs on ARMv7, using the normal ARM instruction set. + */ + __GLDISPATCH_STUB_ARMV7_ARM }; /*! diff --git a/src/GLdispatch/GLdispatchPrivate.h b/src/GLdispatch/GLdispatchPrivate.h index b025483..aca8de7 100644 --- a/src/GLdispatch/GLdispatchPrivate.h +++ b/src/GLdispatch/GLdispatchPrivate.h @@ -37,25 +37,6 @@ #include "utils_misc.h" /*! - * XXX: Any changes to the internal mapi enum should be accompanied by an ABI - * update, and vice versa. - */ -#define TLS_TYPE_CHECK(x) STATIC_ASSERT((int)__GLDISPATCH_STUB_ ## x == (int)ENTRY_ ## x) - -static inline void UNUSED __unused_tls_type_check(void) -{ - TLS_TYPE_CHECK(X86_TLS); - TLS_TYPE_CHECK(X86_64_TLS); - TLS_TYPE_CHECK(X86_TSD); - TLS_TYPE_CHECK(PURE_C); - TLS_TYPE_CHECK(X86_64_TSD); - TLS_TYPE_CHECK(ARMV7_THUMB_TSD); - TLS_TYPE_CHECK(NUM_TYPES); -} - -#undef TLS_TYPE_CHECK - -/*! * Private dispatch table structure. This is used by GLdispatch for tracking * and updating dispatch tables. */ diff --git a/src/GLdispatch/vnd-glapi/mapi/entry.h b/src/GLdispatch/vnd-glapi/mapi/entry.h index 35758a2..bea812d 100644 --- a/src/GLdispatch/vnd-glapi/mapi/entry.h +++ b/src/GLdispatch/vnd-glapi/mapi/entry.h @@ -32,16 +32,6 @@ typedef void (*mapi_func)(void); -enum { - ENTRY_X86_TLS, - ENTRY_X86_64_TLS, - ENTRY_X86_TSD, - ENTRY_PURE_C, - ENTRY_X86_64_TSD, - ENTRY_ARMV7_THUMB_TSD, - ENTRY_NUM_TYPES -}; - extern const int entry_type; extern const int entry_stub_size; diff --git a/src/GLdispatch/vnd-glapi/mapi/entry_armv7_tsd.c b/src/GLdispatch/vnd-glapi/mapi/entry_armv7_tsd.c index be394c9..7bd9da0 100644 --- a/src/GLdispatch/vnd-glapi/mapi/entry_armv7_tsd.c +++ b/src/GLdispatch/vnd-glapi/mapi/entry_armv7_tsd.c @@ -39,6 +39,7 @@ #include "u_macros.h" #include "u_current.h" #include "utils_misc.h" +#include "glvnd/GLdispatchABI.h" /* * See: https://sourceware.org/binutils/docs/as/ARM-Directives.html @@ -157,7 +158,7 @@ __asm__(".balign 4096\n" __asm__(".arm\n\t"); #endif -const int entry_type = ENTRY_ARMV7_THUMB_TSD; +const int entry_type = __GLDISPATCH_STUB_ARMV7_THUMB; const int entry_stub_size = ARMV7_ENTRY_SIZE; static const int TEMPLATE_OFFSET_CURRENT_TABLE = ARMV7_BYTECODE_SIZE - 3*4; diff --git a/src/GLdispatch/vnd-glapi/mapi/entry_pure_c.c b/src/GLdispatch/vnd-glapi/mapi/entry_pure_c.c index 7b9ea82..134143e 100644 --- a/src/GLdispatch/vnd-glapi/mapi/entry_pure_c.c +++ b/src/GLdispatch/vnd-glapi/mapi/entry_pure_c.c @@ -30,6 +30,7 @@ #include <stdlib.h> #include "glapi/glapi.h" +#include "glvnd/GLdispatchABI.h" static INLINE const struct _glapi_table * entry_current_get(void) @@ -48,7 +49,7 @@ entry_current_get(void) #define MAPI_TMP_PUBLIC_ENTRIES #include "mapi_tmp.h" -const int entry_type = ENTRY_PURE_C; +const int entry_type = __GLDISPATCH_STUB_UNKNOWN; const int entry_stub_size = 0; void diff --git a/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tls.c b/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tls.c index 7ac068c..d99c8a4 100644 --- a/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tls.c +++ b/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tls.c @@ -36,6 +36,7 @@ #include "utils_misc.h" #include "u_macros.h" #include "glapi/glapi.h" +#include "glvnd/GLdispatchABI.h" #define ENTRY_STUB_ALIGN 32 #define ENTRY_STUB_SIZE ENTRY_STUB_ALIGN @@ -74,7 +75,7 @@ __asm__("x86_64_current_tls:\n\t" extern unsigned long x86_64_current_tls(); -const int entry_type = ENTRY_X86_64_TLS; +const int entry_type = __GLDISPATCH_STUB_X86_64; const int entry_stub_size = ENTRY_STUB_SIZE; void entry_generate_default_code(char *entry, int slot) diff --git a/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tsd.c b/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tsd.c index e2199a0..008d5ea 100644 --- a/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tsd.c +++ b/src/GLdispatch/vnd-glapi/mapi/entry_x86_64_tsd.c @@ -38,6 +38,7 @@ #include "u_macros.h" #include "glapi/glapi.h" +#include "glvnd/GLdispatchABI.h" #define X86_64_ENTRY_SIZE 64 @@ -90,7 +91,7 @@ __asm__(".balign 4096\n" "public_entry_end:"); __asm__(".text\n"); -const int entry_type = ENTRY_X86_64_TSD; +const int entry_type = __GLDISPATCH_STUB_X86_64; const int entry_stub_size = X86_64_ENTRY_SIZE; static const unsigned char ENTRY_TEMPLATE[] = diff --git a/src/GLdispatch/vnd-glapi/mapi/entry_x86_tsd.c b/src/GLdispatch/vnd-glapi/mapi/entry_x86_tsd.c index 1f58642..4c23239 100644 --- a/src/GLdispatch/vnd-glapi/mapi/entry_x86_tsd.c +++ b/src/GLdispatch/vnd-glapi/mapi/entry_x86_tsd.c @@ -36,6 +36,7 @@ #include "u_macros.h" #include "glapi/glapi.h" +#include "glvnd/GLdispatchABI.h" #define X86_ENTRY_SIZE 32 @@ -68,7 +69,7 @@ __asm__(".balign 4096\n" "public_entry_end:"); __asm__(".text\n"); -const int entry_type = ENTRY_X86_TSD; +const int entry_type = __GLDISPATCH_STUB_X86; const int entry_stub_size = X86_ENTRY_SIZE; static const unsigned char ENTRY_TEMPLATE[] = diff --git a/tests/GLX_dummy/GLX_dummy.c b/tests/GLX_dummy/GLX_dummy.c index 436eb30..5b864f4 100644 --- a/tests/GLX_dummy/GLX_dummy.c +++ b/tests/GLX_dummy/GLX_dummy.c @@ -503,7 +503,7 @@ static void dummySetDispatchIndex (const GLubyte *procName, int ind #if defined(PATCH_ENTRYPOINTS) PUBLIC int __glXSawVertex3fv; -static void patch_x86_64_tls(char *writeEntry, +static void patch_x86_64(char *writeEntry, const char *execEntry, int stubSize) { @@ -535,7 +535,7 @@ static void patch_x86_64_tls(char *writeEntry, #endif } -static void patch_x86_tls(char *writeEntry, +static void patch_x86(char *writeEntry, const char *execEntry, int stubSize) { @@ -575,7 +575,7 @@ static void patch_x86_tls(char *writeEntry, #endif } -static void patch_armv7_thumb_tsd(char *writeEntry, +static void patch_armv7_thumb(char *writeEntry, const char *execEntry, int stubSize) { @@ -621,11 +621,9 @@ static void patch_armv7_thumb_tsd(char *writeEntry, static GLboolean dummyCheckPatchSupported(int type, int stubSize) { switch (type) { - case __GLDISPATCH_STUB_X86_64_TLS: - case __GLDISPATCH_STUB_X86_TLS: - case __GLDISPATCH_STUB_X86_TSD: - case __GLDISPATCH_STUB_X86_64_TSD: - case __GLDISPATCH_STUB_ARMV7_THUMB_TSD: + case __GLDISPATCH_STUB_X86_64: + case __GLDISPATCH_STUB_X86: + case __GLDISPATCH_STUB_ARMV7_THUMB: return GL_TRUE; default: return GL_FALSE; @@ -646,16 +644,14 @@ static GLboolean dummyInitiatePatch(int type, if (lookupStubOffset("Vertex3fv", &writeAddr, &execAddr)) { switch (type) { - case __GLDISPATCH_STUB_X86_64_TLS: - case __GLDISPATCH_STUB_X86_64_TSD: - patch_x86_64_tls(writeAddr, execAddr, stubSize); + case __GLDISPATCH_STUB_X86_64: + patch_x86_64(writeAddr, execAddr, stubSize); break; - case __GLDISPATCH_STUB_X86_TLS: - case __GLDISPATCH_STUB_X86_TSD: - patch_x86_tls(writeAddr, execAddr, stubSize); + case __GLDISPATCH_STUB_X86: + patch_x86(writeAddr, execAddr, stubSize); break; - case __GLDISPATCH_STUB_ARMV7_THUMB_TSD: - patch_armv7_thumb_tsd(writeAddr, execAddr, stubSize); + case __GLDISPATCH_STUB_ARMV7_THUMB: + patch_armv7_thumb(writeAddr, execAddr, stubSize); break; default: assert(0); |