Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1 | /* |
| 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 |
| 26 | ENTRY 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 Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 31 | sd $a7, 56($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 32 | .cfi_rel_offset 11, 56 |
Goran Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 33 | sd $a6, 48($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 34 | .cfi_rel_offset 10, 48 |
Goran Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 35 | sd $a5, 40($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 36 | .cfi_rel_offset 9, 40 |
Goran Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 37 | sd $a4, 32($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 38 | .cfi_rel_offset 8, 32 |
Goran Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 39 | sd $a3, 24($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 40 | .cfi_rel_offset 7, 24 |
Goran Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 41 | sd $a2, 16($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 42 | .cfi_rel_offset 6, 16 |
Goran Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 43 | sd $a1, 8($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 44 | .cfi_rel_offset 5, 8 |
Goran Jakovljevic | 75c40d4 | 2015-04-03 15:45:21 +0200 | [diff] [blame] | 45 | sd $a0, 0($sp) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 46 | .cfi_rel_offset 4, 0 |
| 47 | jal artFindNativeMethod # (Thread*) |
| 48 | move $a0, $s1 # pass Thread::Current() |
| 49 | ld $a0, 0($sp) # restore registers from stack |
| 50 | .cfi_restore 4 |
| 51 | ld $a1, 8($sp) |
| 52 | .cfi_restore 5 |
| 53 | ld $a2, 16($sp) |
| 54 | .cfi_restore 6 |
| 55 | ld $a3, 24($sp) |
| 56 | .cfi_restore 7 |
| 57 | ld $a4, 32($sp) |
| 58 | .cfi_restore 8 |
| 59 | ld $a5, 40($sp) |
| 60 | .cfi_restore 9 |
| 61 | ld $a6, 48($sp) |
| 62 | .cfi_restore 10 |
| 63 | ld $a7, 56($sp) |
| 64 | .cfi_restore 11 |
| 65 | ld $ra, 64($sp) |
| 66 | .cfi_restore 31 |
| 67 | beq $v0, $zero, .Lno_native_code_found |
| 68 | daddiu $sp, $sp, 80 # restore the stack |
| 69 | .cfi_adjust_cfa_offset -80 |
| 70 | move $t9, $v0 # put method code result in $t9 |
| 71 | jalr $zero, $t9 # leaf call to method's code |
| 72 | nop |
| 73 | .Lno_native_code_found: |
| 74 | jalr $zero, $ra |
| 75 | nop |
| 76 | END art_jni_dlsym_lookup_stub |