blob: 70d7d9742c4d034db0b4ded5bb548f42ecbd7288 [file] [log] [blame]
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001/*
2 * Copyright (C) 2014 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_mips64.S"
18
19 .set noreorder
20 .balign 16
21
22 /*
23 * Jni dlsym lookup stub.
24 */
25 .extern artFindNativeMethod
26ENTRY art_jni_dlsym_lookup_stub
27 daddiu $sp, $sp, -80 # save a0-a7 and $ra
28 .cfi_adjust_cfa_offset 80
29 sd $ra, 64($sp)
30 .cfi_rel_offset 31, 64
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020031 sd $a7, 56($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080032 .cfi_rel_offset 11, 56
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020033 sd $a6, 48($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080034 .cfi_rel_offset 10, 48
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020035 sd $a5, 40($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080036 .cfi_rel_offset 9, 40
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020037 sd $a4, 32($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080038 .cfi_rel_offset 8, 32
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020039 sd $a3, 24($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080040 .cfi_rel_offset 7, 24
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020041 sd $a2, 16($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080042 .cfi_rel_offset 6, 16
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020043 sd $a1, 8($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080044 .cfi_rel_offset 5, 8
Goran Jakovljevic75c40d42015-04-03 15:45:21 +020045 sd $a0, 0($sp)
Andreas Gampe1a5c4062015-01-15 12:10:47 -080046 .cfi_rel_offset 4, 0
Andreas Gampe1a5c4062015-01-15 12:10:47 -080047 move $a0, $s1 # pass Thread::Current()
Goran Jakovljevic04568812015-04-23 15:27:23 +020048 jal artFindNativeMethod # (Thread*)
49 .cpreturn # Restore gp from t8 in branch delay slot. gp is not used
50 # anymore, and t8 may be clobbered in artFindNativeMethod.
51
Andreas Gampe1a5c4062015-01-15 12:10:47 -080052 ld $a0, 0($sp) # restore registers from stack
53 .cfi_restore 4
54 ld $a1, 8($sp)
55 .cfi_restore 5
56 ld $a2, 16($sp)
57 .cfi_restore 6
58 ld $a3, 24($sp)
59 .cfi_restore 7
60 ld $a4, 32($sp)
61 .cfi_restore 8
62 ld $a5, 40($sp)
63 .cfi_restore 9
64 ld $a6, 48($sp)
65 .cfi_restore 10
66 ld $a7, 56($sp)
67 .cfi_restore 11
68 ld $ra, 64($sp)
69 .cfi_restore 31
70 beq $v0, $zero, .Lno_native_code_found
71 daddiu $sp, $sp, 80 # restore the stack
72 .cfi_adjust_cfa_offset -80
73 move $t9, $v0 # put method code result in $t9
74 jalr $zero, $t9 # leaf call to method's code
75 nop
76.Lno_native_code_found:
77 jalr $zero, $ra
78 nop
79END art_jni_dlsym_lookup_stub