diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-12-24 15:06:41 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-12-24 17:33:49 +0800 |
commit | e6a7ef3ca6d7f1843a7ea3f873c8f16fe9efc48e (patch) | |
tree | 2d7e3bc66b180e579967357be6867f0371cd53b4 /src/mapi/mapi/entry_x86_tsd.h | |
parent | 897bff67734ec9ab213191386cdf09ddd051aebb (diff) |
mapi: Add and use entry_get_public.
Given a dispatch slot, entry_get_public returns the address of the
corresponding public entry point. There may be more than one of them.
But since they are all equivalent, it is fine to return any one of them.
With entry_get_public, the address of any public entry point can be
calculated at runtime when an assembly dispatcher is used. There is no
need to have a mapping table in such case. This omits the unnecessary
relocations from the binary.
Diffstat (limited to 'src/mapi/mapi/entry_x86_tsd.h')
-rw-r--r-- | src/mapi/mapi/entry_x86_tsd.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mapi/mapi/entry_x86_tsd.h b/src/mapi/mapi/entry_x86_tsd.h index f37c7473a6..0a07ad7424 100644 --- a/src/mapi/mapi/entry_x86_tsd.h +++ b/src/mapi/mapi/entry_x86_tsd.h @@ -32,7 +32,9 @@ #define X86_ENTRY_SIZE 32 -__asm__(".text"); +__asm__(".text\n" + ".balign 32\n" + "x86_entry_start:"); #define STUB_ASM_ENTRY(func) \ ".globl " func "\n" \ @@ -60,6 +62,13 @@ entry_patch_public(void) { } +mapi_func +entry_get_public(int slot) +{ + extern const char x86_entry_start[]; + return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE); +} + void entry_patch(mapi_func entry, int slot) { |