Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "asm_support_x86.S" |
| 18 | |
| 19 | /* |
| 20 | * Portable resolution trampoline. |
| 21 | */ |
| 22 | DEFINE_FUNCTION art_jni_dlsym_lookup_stub |
Mark Mendell | a9abe87 | 2014-01-10 05:52:01 -0800 | [diff] [blame] | 23 | subl LITERAL(4), %esp // align stack |
Mark Mendell | 3f2d031 | 2014-01-20 17:20:27 -0800 | [diff] [blame^] | 24 | CFI_ADJUST_CFA_OFFSET(4) |
Mark Mendell | a9abe87 | 2014-01-10 05:52:01 -0800 | [diff] [blame] | 25 | SETUP_GOT // pushes ebx |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 26 | pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current() |
Mark Mendell | 3f2d031 | 2014-01-20 17:20:27 -0800 | [diff] [blame^] | 27 | CFI_ADJUST_CFA_OFFSET(4) |
| 28 | call PLT_SYMBOL(artFindNativeMethod) // (Thread*) |
Mark Mendell | a9abe87 | 2014-01-10 05:52:01 -0800 | [diff] [blame] | 29 | UNDO_SETUP_GOT |
| 30 | addl LITERAL(8), %esp // restore the stack |
Mark Mendell | 3f2d031 | 2014-01-20 17:20:27 -0800 | [diff] [blame^] | 31 | CFI_ADJUST_CFA_OFFSET(-12) |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 32 | cmpl LITERAL(0), %eax // check if returned method code is null |
| 33 | je no_native_code_found // if null, jump to return to handle |
| 34 | jmp *%eax // otherwise, tail call to intended method |
| 35 | no_native_code_found: |
| 36 | ret |
| 37 | END_FUNCTION art_jni_dlsym_lookup_stub |