blob: 0a0d06a22a52a2093b3f5131df1fd47ad5850d58 [file] [log] [blame]
Ian Rogers7655f292013-07-29 11:07:13 -07001/*
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_arm.S"
18
19 /*
20 * Jni dlsym lookup stub.
21 */
22 .extern artFindNativeMethod
23ENTRY art_jni_dlsym_lookup_stub
24 push {r0, r1, r2, r3, lr} @ spill regs
25 .save {r0, r1, r2, r3, lr}
26 .pad #20
27 .cfi_adjust_cfa_offset 20
28 sub sp, #12 @ pad stack pointer to align frame
29 .pad #12
30 .cfi_adjust_cfa_offset 12
31 mov r0, r9 @ pass Thread::Current
32 blx artFindNativeMethod @ (Thread*)
33 mov r12, r0 @ save result in r12
34 add sp, #12 @ restore stack pointer
35 .cfi_adjust_cfa_offset -12
36 pop {r0, r1, r2, r3, lr} @ restore regs
37 .cfi_adjust_cfa_offset -20
38 cmp r12, #0 @ is method code null?
39 bxne r12 @ if non-null, tail call to method's code
40 bx lr @ otherwise, return to caller to handle exception
41END art_jni_dlsym_lookup_stub
42
43 /*
44 * Entry point of native methods when JNI bug compatibility is enabled.
45 */
46 .extern artWorkAroundAppJniBugs
47ENTRY art_quick_work_around_app_jni_bugs
48 @ save registers that may contain arguments and LR that will be crushed by a call
49 push {r0-r3, lr}
50 .save {r0-r3, lr}
51 .cfi_adjust_cfa_offset 16
52 .cfi_rel_offset r0, 0
53 .cfi_rel_offset r1, 4
54 .cfi_rel_offset r2, 8
55 .cfi_rel_offset r3, 12
56 sub sp, #12 @ 3 words of space for alignment
57 mov r0, r9 @ pass Thread::Current
58 mov r1, sp @ pass SP
59 bl artWorkAroundAppJniBugs @ (Thread*, SP)
60 add sp, #12 @ rewind stack
61 mov r12, r0 @ save target address
62 pop {r0-r3, lr} @ restore possibly modified argument registers
63 .cfi_adjust_cfa_offset -16
64 bx r12 @ tail call into JNI routine
65END art_quick_work_around_app_jni_bugs