Module Name: xsrc
Committed By: martin
Date: Tue Feb 25 19:33:40 UTC 2020
Modified Files:
xsrc/external/mit/MesaLib/dist/src/mapi [netbsd-9]: entry_x86-64_tls.h
entry_x86_tls.h
Log Message:
Pull up following revision(s) (requested by tnn in ticket #724):
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h: revision 1.6
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h: revision 1.5
mesa: sync w/ pkgsrc: don't assume the current gl dispatch table points
to noop if NULL, instead call the ENTRY_CURRENT_TABLE_GET function.
Additionally the previous i386 implementation probably never worked
because it looks like it used the wrong asm label when computing GOT ptr.
Likely relevant to PR port-i386/54782.
XXX pullup -9
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
cvs rdiff -u -r1.5 -r1.5.2.1 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4.2.1
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4 Tue Apr 9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h Tue Feb 25 19:33:40 2020
@@ -32,24 +32,27 @@
#endif
__asm__(".text\n"
- ".balign 32\n"
+ ".balign 64\n"
"x86_64_entry_start:");
#define STUB_ASM_ENTRY(func) \
".globl " func "\n" \
".type " func ", @function\n" \
- ".balign 32\n" \
+ ".balign 64\n" \
func ":"
#ifndef __ILP32__
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
+#if defined(__NetBSD__)
#define STUB_ASM_CODE(slot) \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
"movq %fs:(%rax), %r11\n\t" \
"testq %r11, %r11\n\t" \
- "cmoveq table_noop_array@GOTPCREL(%rip), %r11\n\t" \
- "jmp *(8 * " slot ")(%r11)"
+ "je 1f\n\t" \
+ "jmp *(8 * " slot ")(%r11)\n\t" \
+ "1:\n\t" \
+ "callq " ENTRY_CURRENT_TABLE_GET "@PLT\n\t" \
+ "jmp *(8 * " slot ")(%rax)"
#else
#define STUB_ASM_CODE(slot) \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
@@ -86,7 +89,7 @@ x86_64_entry_start[] HIDDEN;
mapi_func
entry_get_public(int slot)
{
- return (mapi_func) (x86_64_entry_start + slot * 32);
+ return (mapi_func) (x86_64_entry_start + slot * 64);
}
void
Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5.2.1
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5 Tue Apr 9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h Tue Feb 25 19:33:40 2020
@@ -43,6 +43,20 @@ __asm__("x86_current_tls:\n\t"
"movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t"
"ret");
+#if defined(__NetBSD__)
+__asm__("x86_current_table_helper:\n\t"
+ "movl %gs:(%eax), %eax\n\t" \
+ "testl %eax, %eax\n\t" \
+ "je 1f\n\t" \
+ "ret\n\t" \
+ "1:\n\t" \
+ "call 2f\n\t" \
+ "2:\n\t" \
+ "popl %eax\n\t" \
+ "addl $_GLOBAL_OFFSET_TABLE_+[.-2b], %eax\n\t" \
+ "jmp *" ENTRY_CURRENT_TABLE_GET "@GOT(%eax)");
+#endif
+
#ifndef GLX_X86_READONLY_TEXT
__asm__(".section wtext, \"awx\", @progbits");
#endif /* GLX_X86_READONLY_TEXT */
@@ -56,20 +70,10 @@ __asm__(".balign 16\n"
".balign 16\n" \
func ":"
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
-extern const mapi_func table_noop_array[];
+#if defined(__NetBSD__)
#define STUB_ASM_CODE(slot) \
"call x86_current_tls\n\t" \
- "movl %gs:(%eax), %eax\n\t" \
- "testl %eax, %eax\n\t" \
- "je 1f\n\t" \
- "jmp *(4 * " slot ")(%eax)\n\t" \
- "1:\n\t" \
- "call 2f\n" \
- "2:\n\t" \
- "popl %eax\n\t" \
- "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \
- "movl table_noop_array@GOT(%eax), %eax\n\t" \
+ "call x86_current_table_helper\n\t" \
"jmp *(4 * " slot ")(%eax)"
#else
#define STUB_ASM_CODE(slot) \