Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/MesaLib/dist/src/mapi mesa: sync w/ pkgsrc: d...



details:   https://anonhg.NetBSD.org/xsrc/rev/bf5b38d76fa0
branches:  trunk
changeset: 10425:bf5b38d76fa0
user:      tnn <tnn%NetBSD.org@localhost>
date:      Sat Feb 22 09:42:27 2020 +0000

description:
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

diffstat:

 external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h |  15 ++++++----
 external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h    |  28 ++++++++++--------
 2 files changed, 25 insertions(+), 18 deletions(-)

diffs (92 lines):

diff -r 8f87f2b03707 -r bf5b38d76fa0 external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
--- a/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h     Sun Feb 09 13:02:24 2020 +0000
+++ b/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h     Sat Feb 22 09:42:27 2020 +0000
@@ -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 @@
 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
diff -r 8f87f2b03707 -r bf5b38d76fa0 external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h
--- a/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h        Sun Feb 09 13:02:24 2020 +0000
+++ b/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h        Sat Feb 22 09:42:27 2020 +0000
@@ -43,6 +43,20 @@
        "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 @@
    ".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)      \



Home | Main Index | Thread Index | Old Index