projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mapi: Improve the x86 tsd stubs performance.
[mesa.git]
/
src
/
mapi
/
entry_x86_tsd.h
diff --git
a/src/mapi/entry_x86_tsd.h
b/src/mapi/entry_x86_tsd.h
index ece00fac0b75743449bf9b4f65d39728d47dce6c..9526cdcef1a83ef3440f1cfcd7adab6e530b3dd5 100644
(file)
--- a/
src/mapi/entry_x86_tsd.h
+++ b/
src/mapi/entry_x86_tsd.h
@@
-25,9
+25,13
@@
* Chia-I Wu <olv@lunarg.com>
*/
* Chia-I Wu <olv@lunarg.com>
*/
-#include "u_macros.h"
+#ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY
+#define HIDDEN __attribute__((visibility("hidden")))
+#else
+#define HIDDEN
+#endif
-#define X86_ENTRY_SIZE
32
+#define X86_ENTRY_SIZE
64
__asm__(".text\n"
".balign 32\n"
__asm__(".text\n"
".balign 32\n"
@@
-40,12
+44,19
@@
__asm__(".text\n"
func ":"
#define STUB_ASM_CODE(slot) \
func ":"
#define STUB_ASM_CODE(slot) \
- "movl " ENTRY_CURRENT_TABLE ", %eax\n\t" \
+ "call 1f\n\t" \
+ "1:\n\t" \
+ "popl %ecx\n\t" \
+ "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx\n\t" \
+ "movl " ENTRY_CURRENT_TABLE "@GOT(%ecx), %eax\n\t" \
+ "mov (%eax), %eax\n\t" \
"testl %eax, %eax\n\t" \
"testl %eax, %eax\n\t" \
- "je 1f\n\t" \
- "jmp *(4 * " slot ")(%eax)\n" \
+ "jne 1f\n\t" \
+ "push %ebx\n\t" \
+ "movl %ecx, %ebx\n\t" \
+ "call " ENTRY_CURRENT_TABLE_GET "@PLT\n\t" \
+ "popl %ebx\n\t" \
"1:\n\t" \
"1:\n\t" \
- "call " ENTRY_CURRENT_TABLE_GET "\n\t" \
"jmp *(4 * " slot ")(%eax)"
#define MAPI_TMP_STUB_ASM_GCC
"jmp *(4 * " slot ")(%eax)"
#define MAPI_TMP_STUB_ASM_GCC
@@
-59,8
+70,8
@@
__asm__(".balign 32\n"
#include <string.h>
#include "u_execmem.h"
#include <string.h>
#include "u_execmem.h"
-
static const char x86_entry_start[]
;
-
static const char x86_entry_end[]
;
+
extern const char x86_entry_start[] HIDDEN
;
+
extern const char x86_entry_end[] HIDDEN
;
void
entry_patch_public(void)
void
entry_patch_public(void)