blob: 2c0e75090d4f559ba4d5b16e42521ead4abced88 [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_mips.S"
18
19 .set noreorder
20 .balign 4
21
22 /*
23 * Jni dlsym lookup stub.
24 */
25 .extern artFindNativeMethod
26ENTRY art_jni_dlsym_lookup_stub
Goran Jakovljevicff734982015-08-24 12:58:55 +000027 addiu $sp, $sp, -48 # leave room for $f12, $f13, $f14, $f15, $a0, $a1, $a2, $a3, and $ra
28 .cfi_adjust_cfa_offset 48
29 sw $ra, 32($sp)
30 .cfi_rel_offset 31, 32
Chris Larsen715f43e2017-10-23 11:00:32 -070031 CHECK_ALIGNMENT $sp, $t0
32 sdc1 $f14, 24($sp)
33 sdc1 $f12, 16($sp)
Goran Jakovljevicff734982015-08-24 12:58:55 +000034 sw $a3, 12($sp)
Ian Rogers7655f292013-07-29 11:07:13 -070035 .cfi_rel_offset 7, 12
Goran Jakovljevicff734982015-08-24 12:58:55 +000036 sw $a2, 8($sp)
Ian Rogers7655f292013-07-29 11:07:13 -070037 .cfi_rel_offset 6, 8
Goran Jakovljevicff734982015-08-24 12:58:55 +000038 sw $a1, 4($sp)
Ian Rogers7655f292013-07-29 11:07:13 -070039 .cfi_rel_offset 5, 4
Goran Jakovljevicff734982015-08-24 12:58:55 +000040 sw $a0, 0($sp)
Ian Rogers7655f292013-07-29 11:07:13 -070041 .cfi_rel_offset 4, 0
Goran Jakovljevic590b1362016-03-21 14:24:43 +010042 la $t9, artFindNativeMethod
43 jalr $t9 # (Thread*)
Ian Rogers7655f292013-07-29 11:07:13 -070044 move $a0, $s1 # pass Thread::Current()
45 lw $a0, 0($sp) # restore registers from stack
46 lw $a1, 4($sp)
47 lw $a2, 8($sp)
48 lw $a3, 12($sp)
Chris Larsen715f43e2017-10-23 11:00:32 -070049 CHECK_ALIGNMENT $sp, $t0
50 ldc1 $f12, 16($sp)
51 ldc1 $f14, 24($sp)
Goran Jakovljevicff734982015-08-24 12:58:55 +000052 lw $ra, 32($sp)
Ian Rogers86bcdc22014-02-21 22:06:38 -080053 beq $v0, $zero, .Lno_native_code_found
Goran Jakovljevicff734982015-08-24 12:58:55 +000054 addiu $sp, $sp, 48 # restore the stack
55 .cfi_adjust_cfa_offset -48
Ian Rogers7655f292013-07-29 11:07:13 -070056 move $t9, $v0 # put method code result in $t9
Andreas Gampe8d365912015-01-13 11:32:32 -080057 jalr $zero, $t9 # leaf call to method's code
Ian Rogers7655f292013-07-29 11:07:13 -070058 nop
Ian Rogers86bcdc22014-02-21 22:06:38 -080059.Lno_native_code_found:
Andreas Gampe8d365912015-01-13 11:32:32 -080060 jalr $zero, $ra
Ian Rogers7655f292013-07-29 11:07:13 -070061 nop
62END art_jni_dlsym_lookup_stub