mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-26 16:30:23 +01:00
mapi: Clean up entry_patch_public for x86 tls
Remove hard coded 16 and use entry_generate_or_patch to patch public stubs. The generated code actually is sightly tighter than before since the "nop" instructions before the final "jmp" get removed. Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Lepton Wu <lepton@chromium.org>
This commit is contained in:
parent
1fb75bee90
commit
b2b8639d8e
1 changed files with 7 additions and 10 deletions
|
|
@ -33,6 +33,8 @@
|
||||||
#define HIDDEN
|
#define HIDDEN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define X86_ENTRY_SIZE 16
|
||||||
|
|
||||||
__asm__(".text");
|
__asm__(".text");
|
||||||
|
|
||||||
__asm__("x86_current_tls:\n\t"
|
__asm__("x86_current_tls:\n\t"
|
||||||
|
|
@ -87,23 +89,18 @@ void
|
||||||
entry_patch_public(void)
|
entry_patch_public(void)
|
||||||
{
|
{
|
||||||
#ifndef GLX_X86_READONLY_TEXT
|
#ifndef GLX_X86_READONLY_TEXT
|
||||||
char patch[8] = {
|
|
||||||
0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */
|
|
||||||
0x90, 0x90 /* nop's */
|
|
||||||
};
|
|
||||||
char *entry;
|
char *entry;
|
||||||
|
int slot = 0;
|
||||||
*((unsigned long *) (patch + 2)) = x86_current_tls();
|
for (entry = x86_entry_start; entry < x86_entry_end;
|
||||||
|
entry += X86_ENTRY_SIZE, ++slot)
|
||||||
for (entry = x86_entry_start; entry < x86_entry_end; entry += 16)
|
entry_generate_or_patch(slot, entry, X86_ENTRY_SIZE);
|
||||||
memcpy(entry, patch, sizeof(patch));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
mapi_func
|
mapi_func
|
||||||
entry_get_public(int slot)
|
entry_get_public(int slot)
|
||||||
{
|
{
|
||||||
return (mapi_func) (x86_entry_start + slot * 16);
|
return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue