Home | History | Annotate | Download | only in mips64
      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
     31     sd     $a7, 56($sp)
     32     .cfi_rel_offset 11, 56
     33     sd     $a6, 48($sp)
     34     .cfi_rel_offset 10, 48
     35     sd     $a5, 40($sp)
     36     .cfi_rel_offset 9, 40
     37     sd     $a4, 32($sp)
     38     .cfi_rel_offset 8, 32
     39     sd     $a3, 24($sp)
     40     .cfi_rel_offset 7, 24
     41     sd     $a2, 16($sp)
     42     .cfi_rel_offset 6, 16
     43     sd     $a1, 8($sp)
     44     .cfi_rel_offset 5, 8
     45     sd     $a0, 0($sp)
     46     .cfi_rel_offset 4, 0
     47     move   $a0, $s1             # pass Thread::Current()
     48     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 
     52     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
     79 END art_jni_dlsym_lookup_stub
     80