summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mike Stroyan <stroyan@google.com> 2016-05-17 14:03:49 -0600
committer Mike Stroyan <stroyan@google.com> 2016-05-17 14:03:49 -0600
commitc3685dfb03b8fbcde865ff6c485b77d7481acca1 (patch)
tree4d9fbe65a68148a2cecbedfc68935342d4e8ad6c
parent853f8f9c0b95120731459c1f7567af69ce457fe0 (diff)
Preserve parameters to getProcAddress functions
The contents of register r0 parameter were overwritten after commit 4690754. That used an "r" register to hold larger offsets, but doing that overwrote r0 before it was passed on to the next call. Applying the offset as two parts allows the total largest offset of 3588+1020 to be reached without using a register to hold that value. Use an "addne" instruction to add the _api offset of up to 1020 within the extensions array. Use a "ldrne" offset to add the offset to the start of the extensions array. Bug: 26541117 Change-Id: Ie19e4aa584c9fa6fdec4de18e858777ac59d8dbd
-rw-r--r--opengl/libs/EGL/getProcAddress.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index bdfd21c820..336c2642ad 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -46,14 +46,15 @@ namespace android {
"ldr r12, [r12, %[tls]] \n" \
"cmp r12, #0 \n" \
"addne r12, %[api] \n" \
- "ldrne r12, [r12] \n" \
+ "ldrne r12, [r12, %[ext]] \n" \
"cmpne r12, #0 \n" \
"bxne r12 \n" \
"bx lr \n" \
: \
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
- [api] "r"(__builtin_offsetof(gl_hooks_t, \
- ext.extensions[_api])) \
+ [ext] "J"(__builtin_offsetof(gl_hooks_t, \
+ ext.extensions[0])), \
+ [api] "J"(_api*sizeof(void*)) \
: "r12" \
);